We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
This idea carries a full system design question on its own. Each walks through the full answer.
System Design Masterclass · Capstone
Free preview: the first 2 parts of this 14-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Capstone
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
In January 2021, a single user figured out they could scrape the entire Twitter API by making 15,000 requests per second from a botnet. Twitter's API slowed to a crawl for everyone, real users, app developers, everyone. The incident lasted four hours before Twitter's infrastructure team patched the gap.
Every API you've ever used has a rate limiter guarding it. GitHub gives you 5,000 requests per hour. Stripe allows 100 requests per second. OpenAI has token-per-minute limits. The moment you hit those limits, you get a 429 Too Many Requests response and you wait.
Rate limiting sounds simple, just count requests and say "no" when there are too many. But when you're handling millions of requests per second across dozens of servers, "just counting" becomes one of the hardest distributed systems problems there is.
In this capstone, you'll design a rate limiter that can protect a massive-scale API, one that works across multiple servers, handles bursty traffic gracefully, and doesn't become a bottleneck itself.
/search = 10/s, /tweets = 100/s)Retry-After header when exceededA rate limiter can be placed at three different levels:
For most systems, you want it at both the API gateway level (coarse-grained protection) and the middleware level (fine-grained, per-endpoint rules).