caching
Cache Stampede Protection
Prevent thundering herd when a popular cache key expires and many requests arrive simultaneously
ProtectionON
DB Hits0
Lock🔓 Free
CacheCOLD
// concurrent requests
Click "Simulate Stampede" to see the effect// event log
No events yet.
// how it works
- Popular key expires → many requests arrive at once
- Without protection: all hit DB (thundering herd)
- With locking: first request fetches, others wait
- Once cache is repopulated, all get served from cache
// strategies
- Mutex/Lock — only one fetcher at a time
- Probabilistic early recomputation (jitter)
- Background refresh before expiry
- Lock adds latency for waiting requests