Consistent Hashing Visualizer

Consistent hashing on a ring moves only about 1/N of keys when a node joins or leaves. Naive hash(key) % N reshuffles almost everything. Virtual nodes fix the load-imbalance problem a small number of physical nodes has on a ring.

Cluster controls

Virtual nodes per physical node 1

The ring (consistent hashing)

Each key is owned by the next node clockwise from its hash position. Virtual nodes above 1 are not drawn individually here — the ring shows physical node ownership after virtual-node averaging.

Rebalance impact: consistent hashing vs. naive mod-N

Consistent hashing — keys moved
0 / 0
0%
Naive hash % N — keys moved
0 / 0
0%

Load balance across physical nodes (virtual nodes = 1)

Why real clusters use this

Cassandra and DynamoDB both place partitions using a ring of hashed token ranges rather than hash(key) % N. That single design choice is what lets you add or remove a node without rehashing the entire dataset — see Cassandra for how tokens and vnodes map to replica placement, and DynamoDB for the same idea behind its partition key hashing.