Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. Why hash mod N hurts
  2. 2. The ring and virtual nodes
  3. 3. Add a node to the ring and to mod N
  4. 4. What the ring balances and what it leaves
  5. 5. How many virtual nodes is enough
  6. 6. Rendezvous hashing and Maglev tables
  7. 7. Check ownership, balance and hot keys

Topic 3

Add a node to the ring and to mod N

7 min read

Add a node

The lab keeps two assignments side by side for the same keys: the ring, and hash mod N. Press Add a node and read how many keys each one moved. Bars show keys per node for both.

Predict before you press the button

You turn virtual nodes from 1 up to 200, with the node count fixed. What happens to the imbalance (busiest node divided by average)?
or remove one with its Remove button below.
8 nodes800 points

Each tick is one virtual node. Keys are placed and settled: 20000 of 20000.

Keys per node

  • node 02503 / 2456
  • node 12165 / 2460
  • node 22653 / 2489
  • node 32370 / 2510
  • node 42837 / 2551
  • node 52225 / 2458
  • node 62363 / 2477
  • node 72884 / 2599

ring, keys on node hash mod N, keys on node

imbalance, ring
1.15max / mean
imbalance, mod N
1.04max / mean
mean keys per node
2500
nodes
8

Keys moved by the last change

Add or remove a node to see how many keys have to move.

Full-page version with guided experiments: Consistent hashing lab.

Poke at the ring

  1. Press Add a node once. Compare the two moved percentages.
  2. Set virtual nodes to 1 and look at the keys-per-node bars. Then slide it to 256.
  3. Remove a node. The ring moves exactly that node’s keys.
  4. Keep adding nodes. Each new join moves a smaller share than the last.

The full-page lab has five guided experiments.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms