Database Reference
In-Depth Information
Consistent hashing
Before you understand its implication and application in Cassandra, let's understand con-
sistent hashing as a concept.
Consistent hashing works on the concept in its name—that is hashing and as we know, for
a said hashing algorithm, the same key will always return the same hash code—thus, mak-
ing the approach pretty deterministic by nature and implementation. When we use this ap-
proach for sharding or dividing the keys across the nodes in the cluster, consistent hashing
is the technique that determines which node is stored in which node in the cluster.
Have a look at the following diagram to understand the concept of consistent hashing; ima-
gine that the ring depicted in the following diagram represents the Cassandra ring and the
nodes are marked here in letters along with the numerals that actually mark the objects (in-
verted triangles) to be mapped to the ring.
Consistent hashing for the Cassandra cluster
To compute the ownership of the object to the node it belongs to, all that's required is tra-
versal in clockwise to encounter the next node. The node that follows the data item, which
is an inverted triangle, is the node that owns the object, for example:
1 belongs to node A
2 belongs to node B
3 belongs to node C
4 belongs to node C
5 belongs to node D
6 belongs to node E
7 belongs to node F
8 belongs to node H
Search WWH ::




Custom Search