A storm of identical work
When a popular cache entry expires, many requests arrive at once and all miss together. Without protection they each hit the database for the same value, a stampede that can overload the backend.
Coalescing
Request coalescing, also called single flight, lets only the first caller do the work while the rest wait for that one result.
- First caller starts the fetch and registers it as in flight.
- Followers for the same key attach to the in flight call instead of starting their own.
- One result is shared to everyone waiting when it returns.
Where it helps
- Cache miss stampedes collapse to a single backend call.
- Expensive computations run once per key not once per caller.
- External API calls stay within rate limits.
Limits
Coalescing only merges requests that are truly identical and concurrent. It does not help spread out load over time, so pair it with staggered expiry or a short stale window for the best result.
Key idea
Coalesce identical in flight requests so the backend does the work once and shares the answer with every waiting caller.