Consistent hashing ring
Add a node and count the keys that move, with and without virtual nodes, against hash mod N.
Last change: 10 → 11 nodes, on the same 10,000 keys.
Going 10 → 11 nodes moved 9.9% of the keys on the ring and 90.6% with hash % N: one cache cluster stays warm, the other goes cold.
How it's calculated · assumptions
owner(key) = first vnode token clockwise from hash(key) · N → N+1 moves ~1/(N+1) on a ring, ~N/(N+1) with hash % N
Virtual nodes buy balance: spread ≈ 1/√V, so 100 vnodes ≈ 10%.
Keys "key:0…9999" and tokens "node-k#i" are hashed (FNV-1a + murmur3 finalizer) onto a 32-bit ring; every percentage is measured on these keys. Ticks outside the ring: vnode tokens (up to 400 drawn). Dots: 60 sample keys colored by owner, each parked at the token that owns it (the first clockwise from its hash); outlined dots moved on the last change. Rules of thumb from the consistent hashing concept.