Skip to content
StackDecode
System Design
7. Caching ArchitectureAnimated

Cache Avalanche

Many entries expire at once, flooding the database.

The idea

If a batch of keys share the same TTL, they all vanish together.

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. 1Entries are set with the same TTL
  2. 2They expire together
  3. 3Traffic floods the database
  4. 4The database slows or fails

Where it is used

Bulk cache loads.

Watch out for

Randomise TTLs and warm gradually.

Related