Rate Limiting Algorithms Compared
Rate Limiting Algorithms Compared
HardBackend0% accepted
You must limit each API key to N requests per minute across a fleet of servers. Compare fixed-window, sliding-window-log, sliding-window-counter, token bucket, and leaky bucket. Cover: burst behaviour, the fixed-window boundary spike problem, memory cost, and how to enforce the limit consistently across multiple instances (e.g., Redis).
Approach
Fixed window is simple but allows 2x burst at boundaries. Sliding window smooths this. Token bucket allows controlled bursts; leaky bucket smooths output. Use Redis INCR/Lua for a shared, atomic counter across instances.
More Backend problems
Browse all coding problems →Scenarios & Expected Answers
No example scenarios for this problem.
Sign in to continue
Create a free account to view answers and mark progress.
- Free forever — no credit card
- Theory Q&A with detailed answers
- Points, streaks & leaderboards