Definition
A cache stampede (or thundering herd) is the failure mode where a hot cache entry expires and, in the moment before it is repopulated, hundreds or thousands of concurrent requests all miss simultaneously and hammer the database with identical queries. The database, sized for the normal cache-hit-rate load, can collapse under the burst — which then slows the repopulation and prolongs the stampede.
Standard mitigations: request coalescing / a per-key lock so only one request recomputes while others wait or serve stale; probabilistic early refresh (each request has a small chance of refreshing before expiry, spreading the work); jittered TTLs so many keys never expire in the same second; and serving stale data while revalidating in the background.
How it comes up in interviews
This is a favorite "what breaks at scale?" probe after a candidate adds a cache. The expected shape: name the scenario unprompted for any hot-key cache (a viral post, the home page), then give one concrete mitigation — single-flight locking and TTL jitter are the most commonly cited.