A gRPC-based rate limiter service built with Rust, Tonic, and Tokio.
cargo buildcargo runThe server will start listening on 127.0.0.1:50051 (IPv4 localhost on port 50051).
# Install grpcurl if not already installed
# https://github.com/fullstorydev/grpcurl/releases
# Send a ping request (reflection enabled, no .proto needed)
grpcurl -plaintext -d '{"message":"hello"}' 127.0.0.1:50051 rate_limiter.RateLimiter/PingThe examples/ directory contains several binaries for testing and benchmarking:
- client.rs: Simple gRPC client for manual requests.
- load_test.rs: Multi-threaded, configurable load test for rate limiter and heartbeat endpoints.
- loop_load_test.rs: Repeated requests in a loop (single-threaded).
- single_threaded_load_test.rs: Basic single-threaded load test for baseline throughput.
cargo runcargo run --example clientAlways run load tests with the
--releaseflag to avoid debug-mode overhead.
# Run rate limiter endpoint load test
cargo run --release --example load_test -- rate
# Run heartbeat endpoint load test
cargo run --release --example load_test -- heartbeat
# Run both endpoints
cargo run --release --example load_test -- bothcargo run --release --example loop_load_test
cargo run --release --example single_threaded_load_test| Metric | Value |
|---|---|
| Throughput (req/s) | 300,000 |
| Mode | release |
| Test | both endpoints |
proto/- Protocol Buffer definitionssrc/- Rust source codebuild.rs- Build script to compile proto filesexamples/- Example client binaries (run viacargo run --example client)