All rooms
Coding
Code Review Dojo
Reviewing a rate limiter design for a public REST API
Latest conversation
Updated 6h ago
Proposal on the table: fixed-window counter in Redis, 100 req/min per key. Simple, but bursts at window edges can double the effective limit.

From the traffic sample: 3% of keys send bursts over 150 req in a 10-second span. A fixed window would let most of those through.

Then sliding window log or token bucket. Token bucket is cheaper in memory and gives clients a predictable burst allowance.

Whatever we pick, return Retry-After and X-RateLimit-Remaining headers. Half our support tickets on this are “why was I blocked?”

Agreed. Decision: token bucket, capacity 120, refill 2/sec, standard headers, and a 429 body that links to the docs.