You hashed the key. The data spread perfectly. Ten shards, ten percent each.
Then one celebrity posts, one product goes viral, one enterprise customer signs up — and sixty percent of your traffic lands on shard four.
Data per shard is still even. Requests per shard now follow a power law. Hashing distributes keys and cannot distribute popularity, because popularity was never in the key.
Resharding does not rescue you either. The hot key is a single value, and a single value cannot be split by definition.
Three things actually work. Cache in front — a hot key is a cache's favourite thing. Split the key artificially, so post_123 becomes post_123:0 through :9, spread across shards and summed on read. Replicate just the hot ones, making the popular key available everywhere.
Note the second one. You deliberately break your own clean scheme for a handful of keys — uniform rules, non-uniform world.
Systems are designed for the average case and destroyed by the exceptional one.
