TLDR Web Dev · ARTICLES & TUTORIALS

THUNDERING HERD PROBLEM: PREVENTING THE STAMPEDE

distributed-computing-musings.com8 min read

Summary from the TLDR Web Dev newsletter

The "thundering herd" problem occurs when a cache miss leads to a large number of concurrent requests hitting the database for the same record, overwhelming it. There are two solutions: using a distributed lock to allow only one request to access the database, or using in-process synchronization with (as an example) Java's `CompletableFuture` and `ConcurrentHashMap`. While the distributed lock works across multiple nodes, the in-process synchronization avoids network calls but doesn't coordinate across nodes.