hardDesignScenarioSeniorStaffLead
One celebrity account is ninety per cent of your write traffic on a single partition. What do you do about a key you cannot rebalance?
A hot partition from one account cannot be fixed by ordinary rebalancing because it is one key. Split the key into write-sharded sub-keys or aggregate writes before storage; both choices move cost to reads, ordering, rollups or approximation.
5 min readUpdated 2026-08-15
Answer
Short answer
A single hot key cannot be rebalanced across partitions; moving it only moves the hotspot. Either stop it being one key by write-sharding into numbered sub-keys, or reduce the write rate before storage with aggregation or batching. The trade-off is on reads: they now scatter and merge, read rollups, or accept approximate counters.
Was this answer helpful?
Likely follow-ups
- Your sub-key count is 32 and the account grows tenfold. How do you change the count without a migration that stops writes?
- What breaks if the writes to this key have to be read back in the exact order they were made?
- How would you handle this if the hot key is a counter that must be exact rather than a stream of events?
- Who decides an account is hot, and what stops that decision flapping every few minutes?
Related questions
- How do you choose a datastore, and then how do you choose its shard key?hardAlso on sharding and hot-partitions6 min
- You are asked to design something distributed and your honest answer is one Postgres box. When is that the strongest answer in the room, and when does it end the interview?hardAlso on sharding5 min
- Your data is pinned per region, but login must be globally unique and admins want one global search. How do you build that?hardAlso on sharding6 min
- The table is 800GB and the shard key turned out wrong. How do you reshard while writes continue?hardAlso on sharding5 min