Part 1 of 7 · 1 min read
Why this page comes last in the level
In this module you will
- Say why a service limits the rate of requests, and where in a design the limit is applied.
- Run the token bucket, leaky bucket, fixed window, sliding window log and sliding window counter by hand on a short list of requests.
- Pick an algorithm for a need such as allowing bursts, smoothing traffic or saving memory.
- Estimate the memory that counters need for millions of users.
- Explain the race condition in a shared counter, and a fix that removes it.
- Return a clear answer to a blocked caller with status 429 and rate limit headers, and write a client that backs off.
Everything in this level carries traffic: the request path, the API, the balancer, the CDN and the gateway. A rate limiter decides how much traffic may enter. It sits at the gateway or just behind it, so this page closes the level. The full case study, with a shared limiter across servers, comes in Level 10. The numbers on this page are made up to show the idea, unless the text names a book.