Skip to main content

Hot Partition (Hot Shard)

A hot partition concentrates traffic on one shard because of a skewed or low-cardinality key, overloading it while others idle and capping throughput at one node. Choose high-cardinality keys, salt hot keys, and cache hot reads so load spreads evenly.

A hot partition (or hot shard / hot key) occurs when the key used to distribute data or load across partitions concentrates a large fraction of traffic onto a single partition. Partitioning is supposed to spread work evenly so the system scales horizontally, but a poorly chosen key sends most reads or writes to one node, which becomes the bottleneck while its peers are nearly idle.

Why It Happens

Keys are often chosen for convenience or natural grouping rather than for even distribution. Low-cardinality keys (status, country, tenant, date) cluster data. Monotonic keys (timestamps, auto-increment IDs) send all new writes to the newest partition. Real-world traffic is skewed by power laws: a few celebrity users, popular products, or viral items attract orders of magnitude more access than the median. The design tests fine with uniform synthetic data and only goes hot when real, skewed traffic arrives.

Why It Hurts

The overloaded partition throttles, times out, or falls behind on replication, while total cluster capacity sits unused — you pay for N nodes but are limited by one. Adding nodes does not help, because rebalancing cannot fix a key that inherently maps everything to one place. In managed stores (DynamoDB, Kafka, Cassandra, sharded SQL) hot partitions trigger per-partition rate limits and tail-latency spikes that affect every user touching that partition.

Warning Signs

  • One shard/partition consistently at high utilization while others are idle.
  • Per-partition throttling, timeouts, or replication lag on specific keys.
  • Partition key with low cardinality or monotonic ordering.
  • Throughput that does not improve when you add nodes.

Better Alternatives

  • High-cardinality keys: choose a key that naturally spreads traffic across many partitions.
  • Key salting / compound keys: append a hash or bucket suffix to a hot key to fan it across partitions.
  • Consistent hashing with virtual nodes for even, stable distribution.
  • Write sharding for monotonic keys (prefix with a hash or reverse the timestamp).
  • Caching or read replicas in front of unavoidably hot read keys.

How to Refactor Out of It

Measure per-partition load to confirm and locate the hotspot. If the key is low-cardinality or monotonic, redesign it: pick a higher-cardinality key, or add a salt/bucket suffix so a single logical key spreads across several physical partitions (and aggregate on read). For monotonic write keys, hash-prefix to scatter writes. For genuinely hot read keys (a viral item), front them with a cache or replicas instead of repartitioning. Re-measure to confirm load is even across partitions and throughput now scales with node count.