Chapter 38: Load Testing and Benchmarking
ghz — gRPC Load Testing Tool
# Install
$ go install github.com/bojand/ghz/cmd/ghz@latest
# Run load test: 10000 requests, 50 concurrent
$ ghz --insecure --proto service.proto \
--call mypackage.MyService/GetUser \
-d '{"user_id":"123"}' \
-n 10000 -c 50 \
localhost:50051
# Output: QPS, latency percentiles, error rate
Key Metrics from Load Tests
- Throughput: requests/sec at target concurrency
- Latency p50/p95/p99: response time distribution
- Error rate: % of failed RPCs under load
- Saturation point: where latency spikes (server overloaded)