Design a Rate Limiter — Token Bucket, Sliding Window, and Distributed Counters
Rate limiter design at scale: algorithms (token bucket vs sliding window), single-node vs distributed, Redis Lua, fair queueing, and operational concerns.
Rate limiter design at scale: algorithms (token bucket vs sliding window), single-node vs distributed, Redis Lua, fair queueing, and operational concerns.
Designing customer-facing API rate limits. Tier structure, quota types (per-second / per-minute / per-day), Stripe / GitHub-style response headers, 429 with Retry-After, and the patterns customers actually integrate with.
When single-Redis stops being enough. Sharded rate limiters, hybrid local/global counters, sliding-window approximations, fairness, and the patterns from CDN-scale services.
How to design a distributed rate limiter end-to-end. The four classic algorithms, when to pick each, a Redis Lua implementation, distributed coordination, and the gotchas (clock skew, hot keys, fairness).
A practical comparison of rate limiting algorithms (fixed window, sliding window, leaky bucket, token bucket), production-ready Redis implementations, and the headers your API should return.