How it works
For a replicated store, choose distinct physical nodes after the primary token, often with failure-domain rules so copies do not share one rack or region. Merely selecting the next few virtual tokens can accidentally place multiple copies on the same physical host. Suppose the walk from a key meets tokens A1, A2, B1, B2, C1. With three copies, the next three tokens give A, A, B, which is only two machines. Skipping repeats gives A, B, C. Dynamo calls the result a preference list, and Cassandra’s NetworkTopologyStrategy applies a similar walk by rack. Reads, writes, and repair then depend on the consistency policy of the storage system, not on hashing alone.
A single key that receives extreme traffic still maps to one primary range. Virtual nodes spread many keys, but cannot split that key’s load. Take an example key with 60,000 reads per second on nodes that each handle 20,000. A cache with a one-second lifetime on each of 200 app servers cuts store traffic for that key to at most 200 reads per second, in exchange for up to a second of staleness.
Writes need a different tool. Split a counter such as likes:42 into 16 keys, add to a random one, and sum all 16 on read, so reads get more expensive. DynamoDB’s documentation describes this kind of suffix as write sharding. Keep hot-key mitigation separate from general partition balance.
A celebrity profile key saturates its owner despite hundreds of virtual nodes. What would you try?
Replicate or cache reads for that key, or split the data and writes if possible. Adding virtual tokens alone leaves the individual key assigned to one primary owner.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Replica placement must select distinct physical failure domains.
- Virtual nodes do not solve a single hot key.