# What are virtual nodes?

> Virtual nodes (vnodes) give each physical server many positions on a hash ring instead of one. Its share becomes the sum of many small arcs, so load evens out, and when a server leaves, its data spreads over several neighbors instead of landing on one.

- Author: Zeeshan Adil (https://www.internalswithzee.com/about)
- Published: 2026-11-12
- Source: https://www.internalswithzee.com/concepts/virtual-nodes

Also called: vnodes, tokens.

## The problem it solves

On a [consistent hashing](/concepts/consistent-hashing) ring with one position per server, ownership depends on where the hashes happen to land. Three servers can easily end up with 50%, 30% and 20% of the keys, and a real run can be far worse. Also, when one server leaves, all its keys fall onto the single next server, which can double that machine's load.

## How it works

Give each server many tokens, for example by hashing `"A#0"`, `"A#1"`, `"A#2"` and so on. These are logical positions, not extra machines: three database servers with three tokens each are nine tokens on the ring.

| Database | Its tokens |
|---|---|
| A | 10, 50, 80 |
| B | 20, 60, 90 |
| C | 30, 40, 70 |

A token owns the arc from just after the previous token up to itself. Because each server owns many small, scattered arcs, bad luck in one place is canceled by good luck in another.

Remove DB B and each of its arcs goes to the next token clockwise: B60 falls to C70, B20 falls to C30, B90 wraps to A10. B's data went to two databases, so both neighbors share the work.

Two more uses follow. A bigger machine can take more tokens than a smaller one. And a join becomes many small copies from many sources rather than one large copy from one.

## What it does not do

- **Vnodes are not replicas.** All of B's tokens sit on the same machine and fail together. Replicas must be on different physical servers, so a replica list takes the next different servers clockwise and counts each machine once.
- **They are not free.** More tokens mean a bigger ring to distribute and more small range copies during a join.
- **They do not fix a hot key.** Balanced keys is not balanced traffic. One [hot key](/concepts/hot-key) still goes to one server.

## Measured

In my [sharding challenge](/challenges/distributed-systems/where-does-each-comment-live), the ring was built over 4 databases with different token counts, and the share of the ring each database owned was measured.

| Tokens each | Busiest database | Quietest database |
|---|---|---|
| 1 | 98.6% | 0.20% |
| 16 | 29.8% | 19.1% |
| 64 | 29.4% | 19.2% |
| 256 | 26.5% | 23.0% |

The fair share is 25%. Sixteen tokens each was already decent. The biggest single handoff to a fifth database also fell, from 61.5% of the keys with one token to 0.32% with 256.

In the same challenge, a ring with 64 tokens each moved 28.3% of 100,000 posts when a fourth database joined (the fair share is 25%).

## Related

- Challenge to run: https://www.internalswithzee.com/challenges/distributed-systems/where-does-each-comment-live
- Related concept: https://www.internalswithzee.com/concepts/consistent-hashing
- Related concept: https://www.internalswithzee.com/concepts/hot-key

## Sources

- [DeCandia et al., Dynamo: Amazon's Highly Available Key-value Store (SOSP 2007)](https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf)

