Caching and Redis interview questions
Cache-aside and write strategies, invalidation, stampedes, TTL jitter, eviction, HTTP and CDN caching, Redis data structures and durability.
– interview-ready · 12 questions in this topic
– of 12 tried
Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.
Questions
- Cache-aside: the default caching patternOrder the steps
- Write-through, write-behind and write-aroundPick the fix
- Keeping a cache consistent with the databaseOrder the steps
- Cache stampede on a hot keyPick the fix
- Spreading expiries with TTL jitterPredict
- Eviction: LRU, LFU and maxmemoryPredict
- HTTP caching headersPick the fix
- What to put behind a CDNPick the fix
Practise this topic
Flashcards · 18
Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.
Quick quiz · 12 questions
One exercise per question, checked as you go. Needs JavaScript.
Mock interview · 2 sets
Timed, out loud, then tick what you covered. Needs JavaScript.
Quick facts
Recall the answer first, then tap Show to check.
Redis Cluster slots
16,384 hash slots, spread across primaries; hash tags {…} keep related keys in one slot.
HyperLogLog
Counts distinct items in about 12 KB with roughly 0.81% standard error.
Default maxmemory-policy
noeviction: writes fail when memory is full. Pure caches usually want allkeys-lru or allkeys-lfu.
no-cache vs no-store
no-cache: store but revalidate before use. no-store: never store.
TTL jitter in our run
1,000 keys with a fixed 60 s TTL expired in one second; a 55-65 s spread cut the busiest second to about a tenth (Redis 7.4.6, EXPIRETIME).
appendfsync everysec
Redis's usual AOF setting: a crash loses up to about one second of writes.
Printable cheat sheet · Review your weak spots in this topic
Share your progress
Sources: Topic outline informed by System Design Primer by Donne Martin and the Zalando RESTful API Guidelines, both licensed under CC BY 4.0. Every question and answer is written by Best Latest Apps. Credits and license