01
Design a rate limiter for an API that serves millions of requests per minute.
Tap to write answer
0 words | 0 charsPress Enter ↵ to reveal
Your Attempt
0 wordsRefined Model Answer
ReferenceI would first ask whether the limit is per user, per API key, per IP, or per endpoint, because that changes the design. My default choice would be a token bucket because it handles bursts better than a strict fixed window. I would enforce the limit as close to the edge as possible so the backend does not waste resources on requests that should be rejected. The reason I choose this approach is that it keeps the system responsive while still protecting it from overload. I would also talk about where the counter state lives, what happens if that store fails, and whether the system should fail open or fail closed.