Mock Interviewer
Ask Coach
Tap a question to start, or type your own below.
Design a Rate Limiter
Visual Problem Diagram

Scenario
Picture paying for something on your phone with a weak signal. The app does not hear back in time, so it sends the same checkout again, and again, until it has sent it twenty times in one second. The store would like to let a couple of those through and tell the rest to wait, so they do not all land on the payment system together. The part of the system that does this is called a rate limiter, and it only works if the store keeps one shared count of how many tries this person has made. If each of the store's front-door servers keeps its own private count instead, none of them sees the real total, and all twenty tries get through. A rate limiter slows the flood down, while a separate tool called an idempotency key makes sure the repeats still become one charge, so a good answer explains both.
Clarify this problem here, or open Pathway Coach if you want a prep plan first.
This problem asks you to design a rate limiter, which is the part of a system that decides, for every request, whether the caller is still within their allowance. Think of an API (the doors an app calls to talk to a server) that only does its work while the caller is under their allowance. Once a caller goes over, the API stops them and tells them how long to wait before trying again. The allowance can belong to a person, to an API key, or to a network address, and a paid plan can get a bigger allowance than a free one. Different routes can also have different allowances, because a login attempt and a catalog search do not cost the same.
In the interview you need to explain five things. First, how every front-door server shares one count instead of each keeping a private one. Second, how you count when a caller may burst for a moment and then has to slow down. Third, how two front doors avoid both approving the very last request under the limit. Fourth, whether you block everyone or let everyone through when the shared counter is briefly unavailable. Fifth, how one very chatty caller avoids overloading the single machine that holds their counter. The exact names of the response headers matter much less, so mention them briefly and move on.
Constraints
Limit how many calls one client can make in a time window. Support more than one way of counting. Set a limit per person and per paid tier. Allow a bypass list for trusted callers. Tell the caller their limit and how long to wait.
The check should add very little time to each request, ideally well under a millisecond of the gateway's own work, so the API's real work still sets the pace. It must keep up at a very high request rate. The count must be tight enough that a client cannot quietly multiply the published limit by the number of servers. The same limit must hold no matter which server answers.
About 100 million distinct clients. The hot action is the limit check that runs on every request, at about 10 million checks a second. That check rate is the heavy flow. Each client takes about 100 bytes, which is roughly 10 GB of counters for a 1-minute window.
Stages ahead
Not ready to design yet?
Try the free Coach trial — ask how to prep, what to practice first, or how InterviewCrafted works. Sign in when you want to start this problem.
Log in to start practicing
Preview the problem below. Sign in to start your timed session, save progress, and use the AI coach.
Want full access now? View Pro pricing