Rate limiting: five algorithms, a token bucket on Redis, and designing a distributed limiter
Fixed window, sliding log, sliding window counter, leaky bucket and token bucket compared on one example; why token bucket is the usual pick; a token bucket in Redis Lua, fetching tokens in batches, and what to decide when Redis is slow or down.