03
Consistent hashing
Add a node and move a few keys — not all of them.
Map both keys and nodes onto a circular hash space (a ring). A key is owned by the first node found clockwise from its position. When a node joins, it takes over only the keys between it and its predecessor; everyone else is untouched. When a node leaves, only its keys move to the next node.
Keys land on the ring, owned by the next node clockwise
Node A
→
Node B
→
Node C
↺
Adding Node D between B and C moves only B→C's keys onto D — roughly 1/N of the data, not all of it.
One refinement matters in practice: virtual nodes. Each physical machine is placed at many points on the ring, so load is even and removing a node spreads its keys across all survivors rather than dumping them on one neighbour.