System Design · Senior · Question 22 of 75
What is a cache stampede and how do you prevent it?
- ✓Correct answer: An avalanche of recomputations of an expired entry; locks and SWR help
- 2The cache overflows and evicts all entries at once
- 3Users clear their browser cache en masse
Explanation
When a popular key expires, thousands of requests hit the DB at once. Solutions: request coalescing (one recomputes, the others wait), stale-while-revalidate, random TTL jitter, warming.