Problem
Key-based routing sends all traffic for one key to one node. When a single item goes viral, that node saturates while the rest of the cluster sits idle, and adding nodes does not help.
Also known as: hot-partition-mitigation, hot-shard-handling
Prevent a single disproportionately popular key from overloading one cache node or partition.
Key-based routing sends all traffic for one key to one node. When a single item goes viral, that node saturates while the rest of the cluster sits idle, and adding nodes does not help.
A hot key is one key whose traffic exceeds what a single node can serve. Consistent hashing and partitioning balance the number of keys, not the number of requests, so a single popular key defeats them.
Read-side replication:
write(k, v): for i in 0..N-1: cache.set(k + "#" + i, v)
read(k): i = random(N); return cache.get(k + "#" + i)
Each suffixed key hashes to a different node, so reads divide roughly by N. Updates must touch all copies, so use this for data that changes rarely.
Write-side splitting for counters:
increment(k): shard = random(16); incr(k + ":" + shard)
total(k): sum(get(k + ":" + s) for s in 0..15)
A local cache with a one to five second TTL in each application instance is often the cheapest fix: with 200 instances, a node sees at most 200 requests per TTL for that key instead of millions.
Detect hot keys with sampled counters in the proxy or client library, then promote only those keys to replication. Many stores, such as DynamoDB with adaptive capacity, also offer automatic isolation of hot partitions, but only up to per-partition limits.
Extra memory for replicas and local caches
Medium: monitoring and tuning
Medium: key splitting semantics
Hot key detected too late and the node already failed
Replicated copies serve stale data after an update
Split counter aggregation reads become expensive and slow