← Lessons

quiz vs the machine

Gold1430

Databases

Hot Key Mitigation in Caches

When one key gets hammered, spread, replicate, or shield it to avoid a meltdown.

5 min read · core · beat Gold to climb

When One Key Dominates

A hot key is a single cache entry that receives a huge share of traffic, like a celebrity profile or a flash sale item. Because that key lives on one node, that node saturates while the rest of the cluster idles. This caps throughput and risks an outage on that shard.

Detecting It

Track per key request rates or sample traffic. A sudden spike concentrated on one key signals a hot key. Many cache systems expose metrics to surface these.

Mitigation Tactics

  • Replicate the value across several nodes and have clients read a random copy, spreading the load.
  • Add a local cache in the application so most reads never reach the shared cache at all.
  • Split the key into shards, for example by appending a small random suffix, then merge results client side.
  • Throttle or precompute the expensive value so a miss does not stampede the backend.

Key idea

A hot key overloads the single node that owns it, so you spread the load by replicating the value, caching it locally, or splitting it across multiple keys.

Check yourself

Answer to earn rating on the learn ladder.

1. Why does a hot key limit cluster throughput?

2. Which tactic spreads a hot key's read load across nodes?