Blog/

Cache Stampede / Thundering Herd

Lesson overview

Cache Stampede / Thundering Herd

When a hot cache key expires, thousands of requests miss at once and stampede the database. One request should rebuild the cache (often with a lock); the rest wait or keep serving stale data.

This problem is called Cache Stampede/ Thundering herd

follow me for more system design concept

Cache: 42 seats Available Seats

10000 requests are coming

Relational DB

Application server

cache expired

Request 1 - lock - work Request 2: wait Request 3: wait Request 4: wait Request 5: wait Request 1 - release

Request 2: wait Request 3: lock - work Request 4: wait Request 5: wait

Every Request will check cache

Comment 'Link'

Loading Cache Stampede / Thundering Herd