System design interview questions
Show answer
Pick a key (user, API key or IP) and an algorithm: fixed window (simple, bursty at edges), sliding window, or token bucket (allows short bursts). Store counters in a fast shared store such as Redis with expiry, return 429 with a
Retry-Afterheader, and apply stricter limits to expensive or sensitive endpoints like login.