System Design Patterns: From Fundamentals to Real Systems
0% completed
Cache Stampede Prevention
What happens in the 50 ms after product:4417 expires? The flash sale opened at 10:00 AM, and the page for product 4417, the wireless earbuds, is read 12,000 times per second. Its cache entry was stored at 9:01 AM with the catalog's 1-hour TTL, so Redis removes it at exactly 10:01:00. The next request finds nothing, reads the database, and starts to rebuild the entry.
On a quiet evening, that rebuild would take 15 ms. During the sale, the database is busy, and the same query takes 50 ms. Requests do not stop arriving while the first one waits. In those 50 ms, 12,000 x 0
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%