Database Reference
In-Depth Information
a while because we are streaming from one machine. To solve all these problems, Cas-
sandra 1.2 introduced virtual nodes ( vnodes ).
The following figure shows 16 vnodes distributed over four servers:
In the preceding figure, each node is responsible for a single continuous range. In the case
of a replication factor of 2 or more, the data is also stored on other machines than the one
responsible for the range. ( Replication factor ( RF ) represents the number of copies of a
table that exist in the system. So, RF=2, means there are two copies of each record for the
table.) In this case, one can say one machine, one range. With vnodes, each machine can
have multiple smaller ranges and these ranges are automatically assigned by Cassandra.
How does this solve those issues? Let's see. If you have a 30 ring cluster and a node with
256 vnodes had to be replaced. If nodes are well-distributed randomly across the cluster,
each physical node in remaining 29 nodes will have 8 or 9 vnodes (256/29) that are rep-
licas of vnodes on the dead node. In older versions, with a replication factor of 3, the data
had to be streamed from three replicas (10 percent utilization). In the case of vnodes, all
the nodes can participate in helping the new node get up.
The other benefit of using vnodes is that you can have a heterogeneous ring where some
machines are more powerful than others, and change the vnodes ' settings such that the
stronger machines will take proportionally more data than others. This was still possible
without vnodes but it needed some tricky calculation and rebalancing. So, let's say you
have a cluster of machines with similar hardware specifications and you have decided to
add a new server that is twice as powerful as any machine in the cluster. Ideally, you
would want it to work twice as harder as any of the old machines. With vnodes, you can
achieve this by setting twice as many num_tokens as on the old machine in the new
machine's cassandra.yaml file. Now, it will be allotted double the load when com-
pared to the old machines.
Search WWH ::




Custom Search