Design a Rate Limiter
Talk it through out loud with your AI coach.
The problem
- medium
- Pro
Your public API is being overloaded by a few clients sending far too many requests. Design a rate limiter that allows each API key, say, a hundred requests per minute across all of your servers. Explain the algorithm, where it runs, and what the client sees when they're limited.
What a strong answer covers
- A comparison of a few counting approaches and how each copes with bursts.
- How the limit is enforced consistently when many servers share the traffic.
- Where the limiter lives and what it does if its own storage fails.
- What a limited client receives so it knows how to behave.
Common mistake: Keeping a separate count on each server, so a client spread across servers gets far more than its limit.
Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.
Practise it out loud