Rate Limiter (Token Bucket vs Sliding Window)

The 17th’s race gate: a token bucket, a fixed window and a sliding window decide real requests at their own times. How many get through when a group arrives…

Why it matters

Every serious API has a rate limiter, and its algorithm decides whether a fair burst gets through, whether there is a burst gap at a window’s change, and how much memory it eats when busy. The right answer for a request turned away is 429 Too Many Requests with Retry-After.

The key idea

A token bucket allows bursts, a sliding window counts strictly

Common mistakes

Try it in this playground