One key receives a large share of all requests. Hash partitioning does not help. What do you do?
Sketch your own answer first, then compare it with the one below.
A strong answer
All requests for a key go to the partition that owns it, whatever the hash function or the number of partitions. So the fix has to spread or absorb the load for that key.
Options: cache the key in front of the database, which works well for reads. Replicate the hot partition more heavily and spread reads over those replicas. For write-heavy hot keys, split the key in the application into several sub-keys, for example by appending a small random number, write to one of them, and combine them when reading. That costs extra reads and some complexity. A hot key can also be given a dedicated partition.
Spotting the key takes metrics at key level, not just per partition. The sub-key approach also needs the application to know which keys to treat that way.
Sources
- Martin Kleppmann (2017). Designing Data-Intensive Applications.