Top 5 Redis Interview Questions
Browse 5 real-world technical and behavioral interview questions about Redis. Review scenarios, edge cases, and architectural best practices.
Your rate limiter has to work across twenty gateway instances. What does Redis do, and what breaks first?
Redis gives twenty gateways one counter mutated atomically through INCR or a Lua script, so rate limiting is fleet-wide. What breaks first is usually latency, not throughput: a slow Redis stalls every request for its timeout. Hot keys, caller clocks inside scripts and counts lost on async failover follow.
A popular key expires and forty thousand requests reach the database in the same second. What do you change?
A cache stampede happens when one hot key expires and every concurrent miss rebuilds the same value. Let one request rebuild while the rest wait or serve stale, then prevent repeats with stale-while-revalidate, jittered TTLs and refresh-before-expiry. Use this caching answer to show the decision, trade-off, and evidence rather than a memorised definition.
Your rate limiter runs in five regions with a cap of 100 requests a minute per user. One user gets 500 through. Where did the counting go wrong?
Global rate limiting fails when each region owns a local counter, because five regions each allowing 100 requests creates a 500-request ceiling. Use one atomic shared counter, route each user to an owning region, or lease regional budget deliberately. It also connects distributed counters to the point an interviewer is testing.
How do you handle cache invalidation, and what goes wrong at scale?
Pick a write policy that matches your consistency requirement rather than treating invalidation as an afterthought, then defend against the three failure modes that only appear under load: stampede on expiry, staleness from lost invalidation messages, and unbounded growth from missing eviction.
You need to enforce 100 requests per minute per API key across a fleet of forty servers. Which limiting algorithm, and where does the counter live?
Fixed windows permit twice the limit across a boundary; the two sliding windows fix that at a memory or an accuracy cost; token bucket permits a bounded burst and leaky bucket smooths output instead. Across a fleet the counter must sit in one store mutated atomically, or each node silently enforces its own limit.