How it works
With only one random token per machine, some machines receive large arcs and others tiny arcs; among 10 machines, the largest arc is typically around three times the average. A virtual node, or vnode, is one of several token positions assigned to a physical machine. Its intervals are spread around the ring, so variation falls as token count grows. As a rule of thumb, the spread in ownership shrinks with the square root of tokens per machine: a standard deviation near 25% of the mean at 16 tokens, and near 10% at 100.
Vnodes also change failures and joins. With one token, a failed machine’s whole range lands on one successor. With many, it falls to many successors: in a 10-machine example, the failed machine’s 10% spreads across nine survivors, about 1.1% each. A joining machine likewise takes small slices from many donors. A stronger machine can own more tokens, but that choice should be based on measured capacity and actual load.
A very large token count increases routing metadata, membership updates, and repair bookkeeping: 1,000 machines with 256 tokens each means 256,000 ring entries. A machine also shares ranges with more peers, so two simultaneous failures are more likely to hit two copies of some range. Cassandra lowered its default from 256 tokens to 16 in version 4.0. A token is a placement alias, not an extra replica or machine.
Two machines have identical capacity, but one owns a much larger ring interval. What change helps?
Give each machine multiple well-distributed virtual tokens, then measure bytes and request load. More tokens reduce placement variance, although hot keys still need separate handling.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Multiple tokens smooth random partition imbalance.
- Virtual nodes increase metadata and do not create physical redundancy.