throttlecrab
High-performance rate limiting server with HTTP, gRPC, and Redis protocol support.
9.5K
A high-performance, standalone rate limiting service with multiple protocol support. Implements GCRA (Generic Cell Rate Algorithm) for smooth, fair rate limiting.
docker run -d -p 8080:8080 lazureykis/throttlecrab
Features
- Multiple Protocols: HTTP/JSON, gRPC, Native Binary
- GCRA Algorithm: Smooth rate limiting without sudden spikes
- Production Ready: Health checks, configurable logging, minimal resource usage
- Flexible Storage: Adaptive, periodic, or probabilistic cleanup strategies
- Easy Integration: Simple REST API works with any language
Usage
Basic HTTP Example
curl -X POST http://localhost:8080/throttle \
-H "Content-Type: application/json" \
-d '{"key": "user:123", "max_burst": 10, "count_per_period": 100, "period": 60}'
Docker Compose
services:
throttlecrab:
image: lazureykis/throttlecrab:latest
ports:
- "8080:8080" # HTTP
- "50051:50051" # gRPC
- "8072:8072" # Native
environment:
THROTTLECRAB_STORE: "adaptive"
THROTTLECRAB_LOG_LEVEL: "info"
Configuration
All settings via environment variables with THROTTLECRAB_ prefix:
- THROTTLECRAB_HTTP=true - Enable HTTP protocol
- THROTTLECRAB_GRPC=true - Enable gRPC protocol
- THROTTLECRAB_NATIVE=true - Enable native protocol
- THROTTLECRAB_STORE=adaptive - Store type (adaptive/periodic/probabilistic)
- THROTTLECRAB_STORE_CAPACITY=100000 - Maximum keys to track
- THROTTLECRAB_LOG_LEVEL=info - Logging level
Links
- https://github.com/lazureykis/throttlecrab
- https://docs.rs/throttlecrab-server
- https://crates.io/crates/throttlecrab-server
Content type
Image
Digest
sha256:3e299b6ac…
Size
2.1 MB
Last updated
2 months ago
docker pull lazureykis/throttlecrab