Design a Distributed Rate Limiter
It sounds small and hides a real distributed-systems problem. The job is simple to state. For every incoming request, decide in a millisecond or two whether to allow it or reject it. On a reject, return HTTP 429 with a Retry-After header so a well-behaved client knows to back off. The limiter exists to protect the API from overload and to keep one merchant's traffic burst from starving everyone else. The trap is the word "distributed." The decision runs on a fleet of many API servers, so the count of how much a merchant has used cannot live on one server. It has to be shared, and sharing a fast-changing counter across a fleet is where the design gets interesting.
Frame the goal before drawing anything. Abuse detection, fraud scoring, and billing all live elsewhere. What this system does is smooth load. A merchant gets a steady rate of requests plus some room to burst. Past that we shed their excess, so the shared API stays healthy for everyone behind it. The limiter has to be far cheaper than the work it guards, since it runs on the hot path of every single call. And it has to honor the limit fleet-wide even though no single server sees all the traffic.
- 1 diagram
- 5 sections
- about 40 min
Premium lessonStripe interview guide
These took digging.
What candidates walked out with, from 20,000+ reports, forum threads behind logins and write-ups in Chinese. Then solved step by step.
100 companies. Checked every month.
Unlock all 100 companies$49 a year · less than $1 a week · Cancel anytime
Stripe interview guideKnow what Stripe asks before you walk in.
21 coding · 4 system design · 31 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.