← Lessons

quiz vs the machine

Platinum1820

System Design

Hot Key Mitigation With Request Coalescing

Collapsing a stampede of identical requests for one popular key into a single fetch.

6 min read · advanced · beat Platinum to climb

The hot key problem

A hot key is a single item so popular that requests for it overwhelm the one shard or cache node that owns it. A viral post or a celebrity profile can concentrate millions of reads onto one key while the rest of the system idles.

When the cache misses

The danger peaks at a cache miss. The moment a hot key expires, thousands of concurrent requests all see the miss and all rush to the database at once. This is a localized stampede.

Request coalescing

Request coalescing, also called single flight, fixes this. When many requests want the same missing key, only the first goes to the backend. The others wait and share its result.

  • One in flight fetch per key.
  • All concurrent waiters receive the same answer.
  • The backend sees one request instead of thousands.

Combine coalescing with techniques like replicating the hot key across nodes and serving slightly stale values to spread and reduce the load further.

Key idea

Request coalescing collapses many simultaneous requests for one hot key into a single backend fetch whose result is shared.

Check yourself

Answer to earn rating on the learn ladder.

1. What is a hot key?

2. What does request coalescing do on a cache miss for a hot key?

3. Which extra technique helps spread hot key load?