Getting Started¶
Installation¶
Using Go Install¶
From Source¶
Docker¶
Running GoCC¶
Basic Usage¶
Start with default settings (100 requests/second per key):
Custom Settings¶
View All Options¶
Your First Rate Limit¶
With GoCC running, let's test rate limiting:
# First request - approved
curl -X POST http://localhost:8080/rate/test-key
# {"request_id":"abc123..."}
# Make many requests quickly
for i in {1..150}; do
curl -s -o /dev/null -w "%{http_code}\n" -X POST http://localhost:8080/rate/test-key
done
# First 100: 200
# Rest: 429
Using the Queue¶
When rate limited, clients can wait in a queue:
# This will wait if rate limited (instead of returning 429)
curl -X POST "http://localhost:8080/rate/test-key?canWait=true"
Debug Endpoints¶
View the state of all rate limiters:
View a specific key:
Health Check¶
Next Steps¶
- Configuration - CLI flags, environment variables, and config files
- Queueing - How FIFO queueing works
- Architecture - How GoCC works internally