Place nodes and keys on a SHA-1 hash ring. Each key maps to the first node clockwise. Tune virtual nodes to balance load, then add or remove a node to see exactly which keys move โ the rest stay put.
key-N identifiers.When a node joins or leaves, only the keys that hash to its arc need to move. Run a what-if to see the exact percentage.
With plain hash(key) % N, changing N rehashes almost every key. Consistent hashing places nodes and keys on the same circular hash space; each key is owned by the first node clockwise. Adding or removing a node only moves the keys in that node's arc โ about 1/N of all keys.
K / N keys move (N = node count, K = key count).(ln N)/N of the ring, so heavy skew at small N.V arcs; the standard deviation of load drops by ~1/โV.libketama), Akamai, and many sharded caches.