What is a Cache Stampede?

Test your Systems Design Concepts knowledge with our comprehensive quiz. Utilize flashcards and multiple choice questions to enhance your study session. Prepare thoroughly with detailed explanations for each answer and ace your examination!

Multiple Choice

What is a Cache Stampede?

Explanation:
A cache stampede happens when an item in the cache has expired and a burst of requests all miss at the same time, each trying to recompute or fetch the data from the underlying store. Because they all observe a miss, they all hit the database (or the slow path) concurrently, which can overwhelm the database, spike latency for many users, and cause a ripple of performance problems. The scenario described matches this idea precisely: many concurrent requests miss an expired cache entry and hit the database simultaneously. Understanding this helps you see why simply relying on a cache without coordination is risky after expirations. To prevent stampedes, you can coordinate refreshes by locking per key so only one request refreshes and others reuse the refreshed value, implement a single-flight or request-coalescing mechanism, use refresh-ahead strategies (pre-warming or background refreshing), or apply smarter TTLs and jitter to spread out refresh work.

A cache stampede happens when an item in the cache has expired and a burst of requests all miss at the same time, each trying to recompute or fetch the data from the underlying store. Because they all observe a miss, they all hit the database (or the slow path) concurrently, which can overwhelm the database, spike latency for many users, and cause a ripple of performance problems. The scenario described matches this idea precisely: many concurrent requests miss an expired cache entry and hit the database simultaneously.

Understanding this helps you see why simply relying on a cache without coordination is risky after expirations. To prevent stampedes, you can coordinate refreshes by locking per key so only one request refreshes and others reuse the refreshed value, implement a single-flight or request-coalescing mechanism, use refresh-ahead strategies (pre-warming or background refreshing), or apply smarter TTLs and jitter to spread out refresh work.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy