Pattern 11 / CACHE

Cache Stampede Prevention

Use this when preventing one expired hot key from stampeding the database.

Pressure
Preventing one expired hot key from stampeding the database
Mechanism
Coalesce concurrent loads, refresh early with jitter, or let one requester hold a refresh lock
Toll
Locks, jitter, and stale-while-revalidate logic add operational complexity
Architecture plate11
Diagram for Cache Stampede Prevention
Executive brief

Cache Stampede Prevention fits when preventing one expired hot key from stampeding the database. Mechanism: coalesce concurrent loads, refresh early with jitter, or let one requester hold a refresh lock. Use it for celebrity profiles, homepage configs, product pages, and viral content. The toll: locks, jitter, and stale-while-revalidate logic add operational complexity.

Use when

Celebrity profiles, homepage configs, product pages, and viral content.

Example

One process refreshes a trending item while other requests wait or get stale data.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Caching Patterns

07Cache-Aside (Lazy Loading)08Write-Through09Write-Behind (Write-Back)10Read-Through
โ† 1012 โ†’