01
Design a rate limiting system for an API gateway.
Tap to write answer
0 words | 0 charsPress Enter ↵ to reveal
Your Attempt
0 wordsRefined Model Answer
ReferenceI would first clarify whether the limit is per user, per API key, per IP, or per endpoint, because that changes the storage model and the enforcement point. My default choice would be a token bucket because it allows short bursts while still enforcing a long-term limit. I would place the limiter as close to the edge as possible so the backend does not spend resources on requests that should be rejected. The reason I choose this approach is that it is practical, scalable, and easy to reason about during real traffic spikes. I would also discuss where the counter state lives, how to keep it consistent across servers, and what happens if the limiter store fails.