rpcserver

command
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 10 Imported by: 0

README

Example RPC Server usage.

  • Implement a simple RPC server
  • Handle requests with different processing times and gc-heavy operations
  • Use pprof for profiling
  • Use Vegeta for load testing

Getting started:

cd examples/rpcserver

# Run the RPC server
go run main.go

# Example requests
curl 'http://localhost:8080' --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"slow","params":[],"id":2}'

# Using packaged payloads
curl 'http://localhost:8080' --header 'Content-Type: application/json' --data "@rpc-payload-fast.json"
curl 'http://localhost:8080' --header 'Content-Type: application/json' --data "@rpc-payload-slow.json"

# Load testing with Vegeta
vegeta attack -rate=10000 -duration=60s -targets=targets.txt | tee results.bin | vegeta report

# Grab pprof profiles
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
go tool pprof http://localhost:6060/debug/pprof/heap

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL