TOPIC #105Advanced 8 min read

Cache Stampede & Thundering Herd Defenses

CSD
CompleteSystemDesign Editorial
Report an issue
Key takeawayCore Architecture Summary

Prevent database meltdown on cache key expiration: Mutex locking, probabilistic early expiration (XFetch), and background refresh.

Key Glossary Concepts in this TopicAll Glossary Terms

01.What is a Cache Stampede (Thundering Herd)?

A Cache Stampede (also referred to as the Thundering Herd Problem or Cache Breakdown) is a catastrophic failure scenario that occurs in high-concurrency systems when an intensely accessed, computationally expensive cached key expires or is evicted:

The Anatomy of the Meltdown:

  1. The Hot Key: A key (e.g., homepage:top_deals or live_match_score) receives 10,000 requests per second with a 99.99\% cache hit ratio.
  2. Instant Expiration: At 12:00:00 UTC, the key's 1-hour TTL expires, and Redis evicts it.
  3. The Stampede: At 12:00:01 UTC, all 10,000 concurrent requests encounter a cache miss simultaneously.
  4. Database Meltdown: All 10,000 application worker threads bypass the cache and fire complex multi-table SQL join queries directly at the primary database at the exact same millisecond.
  5. Cascading Failure: The database CPU hits 100\%, connection pools are exhausted, queries time out, application threads hang, and the entire platform crashes.

Cache Stampede Meltdown vs Mutex Lock Defense 🛡️

PRO Architecture Blueprint

Cache Stampede Meltdown vs Mutex Lock Defense 🛡️

When a hot key expires, thousands of concurrent threads rush the database.

Cache Stampede Meltdown vs Mutex Lock Defense 🛡️
100%
Touchpad: Pinch to zoom • Drag to pan
Rendering visual architecture flowchart...
PRO & LIFETIME CURRICULUM

Unlock Topic #105: Cache Stampede & Thundering Herd Defenses

You are viewing a preview. The full in-depth engineering deep dive, interactive simulators, architecture flowcharts for this topic, along with self-assessment quizzes, are available with Pro or Lifetime Access.

Production Deep Dive

Failure modes, high-throughput bottlenecks, and real FAANG implementation decisions.

Interactive Blueprints

Interactive system topology diagrams, live parameter simulators, and downloadable SVG charts.

Knowledge Assessment

Staff-level multiple-choice quiz questions with instant feedback and answer explanations.

Cross-Device Progress Sync

Firebase Google authentication automatically syncs your completed topics and quiz scores.

Rate This Architecture ChapterFeedback & Rating

How clear and actionable was this distributed systems breakdown?

Interactive Engineering Workbenches: