Token bucket, sliding window, and leaky bucket algorithms — protect services from abuse and overload.
Five passes over the same idea, each from a different angle. Do them in order, or jump to whichever you need.
Rate limiting controls the number of requests a client can make within a time window. Algorithms include fixed window, sliding window, token bucket, and leaky bucket. Implementation at API gateway, application, and database levels provides defense in depth. Distributed rate limiting across multiple instances requires shared state (Redis).
Where this topic shows up outside its home domain: