core practice · coding problem

Cache stampede

Hot key expires, 1000 requests miss together. Name two mitigations.

The mechanism

A cache trades memory and staleness for speed. The hard parts are not the hit — they are invalidation, the stampede when a hot key expires, and deciding how stale is acceptable.

Study Caching

Expected evidence

Probabilistic early expiry, request coalescing/singleflight, mutex per key.

Try this drill in the practice workspace →

Hints when you need them
  • TTL jitter spreads expiry.
  • One backend fetch serves many waiters.

Watch for these mistakes

  • Cache-aside with no stampede protection on a hot key
  • No TTL, so stale data lives forever
  • Caching per-user data in a shared key

Check the sources

Browse all practice briefs