Fixed window, sliding log, sliding counter, and token bucket can all claim the same limit, and still let very different amounts of traffic reach your service. The difference shows up at the edges: a window boundary, a sudden spike, or a steady overload.
This lab runs every request through all four algorithms. Compare how many get through in the worst span, and what each algorithm costs to keep.
Which rate limiter lets the burst through?
Four common algorithms, all given the same limit and the same traffic. Every request below is really run through each algorithm, so what you see is what it would do.
Requests arriving 200 requests: a full allowance just before a window boundary, then another just after it
Commit to an answer first. Being wrong here is the useful part.
What this model assumes
- Each request costs one unit and arrives at an exact, repeatable time, with no randomness.
- A single limiter sees every request. A real distributed limiter also has to keep shared counters correct under concurrency.
- The token bucket holds as many tokens as the limit and refills at the limit divided by the window. Other sizes change how large a burst it allows.
- “Peak in any window” is the most requests admitted in any span one window long, which is what the protected service experiences.
This lab goes with a lesson: Pick the accuracy and memory tradeoff