Recall & Review
beginner
What is a cache stampede?
A cache stampede happens when many requests try to fetch data from the cache at the same time, but the cache is empty or expired. This causes all requests to hit the database or backend, leading to overload.
Click to reveal answer
intermediate
Explain the 'lock' or 'mutex' method for cache stampede prevention.
This method uses a lock to allow only one request to fetch and update the cache while others wait. It prevents multiple requests from hitting the backend simultaneously.
Click to reveal answer
intermediate
What is 'early recomputation' in cache stampede prevention?
Early recomputation means refreshing the cache before it expires. This way, requests get fresh data and avoid many requests triggering backend calls at once.
Click to reveal answer
advanced
Describe the 'request coalescing' technique.
Request coalescing groups multiple requests for the same data into one backend call. The result is shared among all waiting requests, reducing load.
Click to reveal answer
intermediate
Why is random expiration time useful in cache stampede prevention?
Random expiration times spread out cache expiry moments. This avoids many caches expiring simultaneously, which can cause a stampede.
Click to reveal answer
What problem does cache stampede prevention solve?
✗ Incorrect
Cache stampede prevention stops many requests from hitting the backend at once when cache expires.
Which method allows only one request to update the cache while others wait?
✗ Incorrect
Lock or mutex ensures only one request updates the cache to prevent stampede.
What does early recomputation do?
✗ Incorrect
Early recomputation refreshes cache before it expires to avoid many backend hits.
How does random expiration help prevent stampede?
✗ Incorrect
Random expiration spreads expiry times to avoid many caches expiring simultaneously.
What is request coalescing?
✗ Incorrect
Request coalescing groups multiple requests into one backend call to reduce load.
Explain what causes a cache stampede and describe two methods to prevent it.
Think about what happens when cache is empty and how to control request flow.
You got /3 concepts.
Describe how request coalescing works and why it helps in cache stampede prevention.
Imagine many friends asking the same question and one person answering for all.
You got /4 concepts.