Virtual node in Cassandra:
- Prior to Cassandra 1.2, every node was allocate to a particular token range.
- Instead of a node being responsible for one large range of tokens, it is responsible for many smaller ranges.
- In this way, one physical node is essentially hosting many smaller “virtual” nodes.
- One of the new features slated for Cassandra 1.2’s release later this year is virtual nodes (vnodes.)
- Vnodes:
- If you recall how token selection works currently, there’s one token per node, and a node owns exactly one contiguous range in the ring space.
- Vnodes modify this paradigm from one token per node to many token per node.
- Within a cluster these can be randomly selected and be non-contiguous, giving us many smaller ranges that belong to each node.
![virtual node in cassandra](https://cdn.wikitechy.com/interview-questions/cassandra/virtual-node-in-cassandra.png)
Advantages of virtual nodes
- Tokens are automatically measured and allocate to every node.
- when adding or removing nodes Re-balancing a cluster is automatically accomplished.
- When a node merge the cluster, it assumes responsibility for an even portion of data from the other nodes in the cluster.
- If a node fails, the load is develop evenly across other nodes in the cluster.
- Number of vNodes can be set as node level.