Sitemap
SAHIL SHARMA

SAHIL SHARMA

Press enter or click to view image in full size
Cache invalidation strategies that prevent thundering herd stampedes — Facebook cut DB queries 92% with leases. Write-through, event-driven, and probabilistic patterns

Member-only story

Taming the Thundering Herd: How Do You Handle Cache Invalidation in Distributed Systems?

11 min readMar 10, 2026

--

Phil Karlton famously called cache invalidation one of the two hardest problems in computer science. He wasn’t joking. When Facebook’s Memcached cluster served billions of requests per second, a single cache key expiring at the wrong moment could spike database queries from 1,300 to 17,000 per second (USENIX, 2013). That’s not a theoretical risk — it’s a thundering herd stampede that can flatten your infrastructure in seconds.

This guide breaks down the cache invalidation strategies that actually work at scale. You’ll learn what causes thundering herds, how to pick the right invalidation pattern for your architecture, and why a higher cache hit ratio doesn’t always mean better performance.

TL;DR: Cache invalidation failures cause thundering herd stampedes that can spike database load by 13x in milliseconds. Strategies like lease-based locking, probabilistic early expiration, and request coalescing prevent this — Facebook cut peak DB queries by 92% using leases alone (USENIX, 2013). Choose your invalidation pattern based on consistency requirements, not convenience.

What Is the Thundering Herd Problem (and Why Should You Care)?

--

--