Free — no signup required

Virtual Nodes (VNodes): The Solution to Skew

2 min read

Splitting Each Server into Many Points

Instead of placing each physical server at one point on the ring, we place it at many points — called Virtual Nodes or VNodes. Each VNode is a separate hash entry that maps back to the same physical server.

Server A → A_1 (pos 5), A_2 (pos 33), A_3 (pos 67), A_4 (pos 88), ...
Server B → B_1 (pos 18), B_2 (pos 41), B_3 (pos 72), B_4 (pos 95), ...
Server C → C_1 (pos 9), C_2 (pos 28), C_3 (pos 55), C_4 (pos 81), ...

With 100–200 VNodes per physical server, the ring looks like this:

[A_3][B_1][C_2][A_1][B_3][C_1][A_4][B_2][C_3][A_2][B_4][C_4] ...

The VNodes interleave across the ring. Each physical server owns many small arcs instead of one large arc.

Benefits of Virtual Nodes

1. Uniform Load Distribution
With enough VNodes, the law of large numbers takes over. Each server's many small arcs average out to approximately equal total coverage. Cassandra uses 256 VNodes per node by default; this produces load distribution within a few percent of perfect uniformity.

2. Heterogeneous Capacity
Assign VNode counts proportional to server capacity:

Server A (4-core,  16 GB RAM) → 100 VNodes
Server B (8-core,  32 GB RAM) → 200 VNodes
Server C (16-core, 64 GB RAM) → 400 VNodes

Server C will statistically own 400/700 ≈ 57% of the keyspace, matching its proportional capacity.

3. Graceful Failure Distribution
When a node fails, its VNodes are scattered across the ring. The keys from each VNode are absorbed by different neighbors — spreading the extra load across many servers rather than dumping it all on one neighbor (which could trigger a cascading failure).

Interview Tip

A common interview question is: "What is the trade-off of using more virtual nodes?" More VNodes means better load distribution and more graceful failure absorption, but it also means more memory overhead (the ring data structure grows) and more metadata to track and replicate. In practice, 150–256 VNodes per node is the sweet spot used by systems like Cassandra and DynamoDB. If an interviewer asks why not use 10,000 VNodes, the answer is diminishing returns on uniformity plus non-trivial memory and coordination cost.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free