Skip to content
StackDecode
System Design
7. Caching ArchitectureAnimated

Cache Stampede

Many requests rebuild the same missing entry at once.

The idea

When a hot key expires, thousands of requests miss together and overload the database.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

UserCDN edgeOriginGET /video.mp4
  • current message
  • earlier
  • failure or attack

The user is routed to the nearest edge location.

step:
1/6
from:
User
to:
CDN edge
1/6

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Hot key expires
  2. 2Many requests miss
  3. 3All hit the database
  4. 4Database overloads

Where it is used

Hot keys.

Watch out for

Use locking, request coalescing or early refresh with jitter.

Related