Rate limiting.
A bouncer at the door letting people in at a steady pace, not all at once.
- In! In! In!1
A service buckles when everyone shows up at once and pounds on it.
- One at a time, folks.2
So you put a bouncer on the door who admits people at a steady pace.
- 3
For each caller, he keeps a tally: how many requests this minute, against the cap.
- Come back in a minute.4
Over the cap, you are turned away with a 429 until the window resets.
- 5
The token-bucket trick: each request spends a token, and tokens drip back at a fixed rate.
- Saved these up.6
A quiet caller banks tokens, so it can briefly burst — generous, but never over the average.
Semicolony semicolony.dev/eli5/rate-limiting/comic