Token bucket allows controlled bursts up to capacity while enforcing a steady refill rate (great for APIs). Fixed window is simple in Redis (INCR + EXPIRE) but allows 2x bursts across window edges. Sliding window counter smooths edge spikes with O(1) memory. Enforce coarse IP limits at the edge/API gateway and per-tenant/token-budget limits in Redis at the app layer.
Follow-up Interview Question · Should rate limiting fail open or fail closed if Redis becomes unreachable?