Performance

Cache stampede

When a popular cache key expires and many concurrent requests miss simultaneously.


In plain terms

Each miss does the expensive backend work; backend gets crushed. Mitigations: probabilistic early expiration, request coalescing, lock-on-miss.

Origin

The pathology has been around as long as caches; the name and mitigations (probabilistic early expiration, request coalescing, lock-on-miss) were formalised in writeups from Instagram, Memcache, and Stack Overflow in the early 2010s.

Where it shows up in production
  • Instagram — thundering herd Engineering blog walks through promise-based coalescing in their feed cache.
  • Memcached GET hits with no value can serialise behind one fetch via the `add` lock trick.
On Semicolony
Sources & further reading
Found this useful?