call(back)

Design a Rate Limiter

Design a rate limiter for a public API that enforces per-client limits such as 100 requests per minute. Cover the algorithm choice (fixed window, sliding window, token bucket), where counters live in a multi-node deployment, failure modes when the counter store is down, and what response a throttled client should receive.

Hints

Hint 1

Compare fixed window, sliding window log, and token bucket by the burst behavior each allows.

Hint 2

Centralized counters (for example in Redis) trade latency for accuracy. Decide when approximately correct is acceptable.

Asked at