Cache Stampede
PronunciationKASH stam-PEED
Definition
A cache stampede happens when a popular cached item expires and many requests miss at the same moment, so they all hit the database to rebuild it.
Where you hear it
In Redis and CDN performance incidents, and system design interviews about hot keys.
Examples
The homepage key expired and 5,000 requests hit the database.
Add jitter to the TTLs so keys don't all expire together.
We added a lock so that only one request rebuilds the expired key during a stampede.
Common mistake
Giving every key the same TTL. They all expire together and cause a spike.
Don't confuse with
A thundering herd, the broader problem of many clients reacting at once. A stampede is the cache-specific case.
Say it at work
- In a meeting or chat
Use a lock so only one request rebuilds the key.
- In an email or ticket
Serve stale data while one worker refreshes it.
Keep exploring
More in Architecture & Design