Token bucket, sliding window, and fixed window — protect APIs from abuse while maintaining fair access.
Five passes over the same idea, each from a different angle. Do them in order, or jump to whichever you need.
Rate limiting controls how many requests a client can make in a time window. Algorithms: fixed window, sliding window log, sliding window counter, token bucket, and leaky bucket. Implementation with Redis, response headers (X-RateLimit-*), retry-after, and 429 status codes.
Where this topic shows up outside its home domain: