advanced practice · system design prompt
Distributed rate limiter
Design a rate limiter for an API: 1000 req/min per user, deployed across 10 app servers. Compare token bucket vs sliding window, and where the counter lives.
The mechanism
Distributed systems multiply the ways things can fail. Every network call can be slow, retried, lost, or duplicated. Design for partial failure first — timeouts, idempotency, bounded queues — and worry about speed second.
Expected evidence
Algorithm choice + storage backend (Redis?) + how you handle a Redis outage.
Try this drill in the practice workspace →
Hints when you need them
- Per-instance counters undercount; central counters add latency.
- Approximation (e.g. sketch) can be acceptable.