Skip to content
Commitwise
Menu

Cache stampede

Also called: Thundering herd, Dog-pile effect

Many requests missing the same cache entry at once and all rebuilding it from the database at the same time.

Definition

When a popular key expires or the cache is flushed, every concurrent request misses and queries the database, often overloading it exactly when traffic is highest. Defenses are letting only one request rebuild each key (single flight or a lock), refreshing hot keys before they expire, and adding random jitter to TTLs so keys don't expire together.

In practice

A home page cached for 60 seconds expires at 12:00:00 and 5,000 requests query the database in the same second.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.