Examples
A token bucket rate limiter, request by request
A burst of five requests meets a bucket of three tokens: three get through, two are refused with a 429, and the bucket refills so an idle client can burst again.
This video was made with the System design skill.
- 1:05
- System design
- Narrated by Iapetus
- English
Made from a prompt
Design a rate limiter with a token bucket. Show a burst of requests and which ones get a 429.
Video transcript
Five simultaneous requests can overwhelm your API unless you control the burst.
You start with a client calling your API directly, but sustained traffic pushes utilization to ninety-five percent.
We insert a token bucket limiter before the API, starting with three tokens and refilling one each second.
Each request spends one token, so five arriving together let three through and reject two with HTTP four twenty-nine.
Why reject instead of queueing? Immediate refusal bounds waiting, and clients should retry later with backoff.
The bucket refills continuously up to its capacity, so an idle client can burst again.
The cost is rejected work, and multiple API replicas must share an atomic bucket per client.
Use this at API entry points: the client sends, the limiter admits, and the API handles accepted work.
More examples
-
Where the money goes when you buy a $5 coffee A $5 latte split into what it pays for, one hand-drawn picture at a time: ingredients, staff, rent and running costs, the 50¢ left over, and why a quiet day makes every cup carry more rent. 2:14 · English -
Why your stomach gets gassy Where gas comes from, drawn and painted in as it is said: swallowed air, gut bacteria and foods like beans and milk, what normal looks like, what helps, and when to see a doctor. 2:17 · English -
A train’s average speed, then a triangle’s area Two problems on a teacher’s board: the options in a row, every line of working written as it is said, each answer checked before it is drawn. 2:07 · English
Your topic, drawn in about a minute.
Your first 2 videos are free, up to 1 minute each, watermarked. No card required. Full product, every voice and style included.