Tech
Why your Cache won't save you from a "Thundering Herd" π
We've all been there: you add Redis, and your latency drops. But have you planned for the Thundering Herd?
The Problem A Thundering Herd occurs when a massive, synchronized search of processes or user requests hits a backend resource at once.
The Pseudo-Code Risk Most of us write logic like this:
let data = await cache.get(key);
if (!data) {
data = await db.query(query); // The Bottleneck!
await cache.set(key, data);
}
return data;
If 100k users hit this code at the sam...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to