0
0
HLDsystem_design~5 mins

Cache stampede prevention in HLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ACache data being outdated
BToo many requests hitting backend when cache expires
CCache memory running out
DSlow network connections
Which method allows only one request to update the cache while others wait?
ALock or mutex
BEarly recomputation
CRandom expiration
DRequest coalescing
What does early recomputation do?
ADeletes cache early
BGroups requests
CRefreshes cache before expiry
DLocks cache access
How does random expiration help prevent stampede?
ABy making cache expire at the same time
BBy deleting cache
CBy locking cache
DBy spreading cache expiry times
What is request coalescing?
AGrouping requests to one backend call
BMaking multiple backend calls
CDeleting cache early
DLocking cache access
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.