Implement Consistent Hashing

hash ring with virtual nodes

Challenge 2 of Partitioning & ReplicationAdvanced~70 min

Distribute keys across nodes with a hash ring so that adding or removing a node reshuffles only a small fraction of keys. Add virtual nodes for balance, replica sets for redundancy, and node weights.

5 steps

  1. 1The Hash Ring
  2. 2Minimal Reshuffling on Removal
  3. 3Virtual Nodes
  4. 4Replica Sets for Redundancy
  5. 5Weighted Nodes
Start step 1