Database Reference
In-Depth Information
The components of Cassandra
We have gone through how read and write takes place in highly distributed Cassandra
clusters. It's time to look into the individual components of it a little deeper.
The messaging service
The messaging service is the mechanism that manages inter-node socket communication in
a ring. Communications, for example gossip, read, read digest, write, and so on, processed
via a messaging service, can be assumed as a gateway messaging server running at each
node.
To communicate, each node creates two socket connections per node. This implies that if
you have 101 nodes, there will be 200 open sockets on each node to handle communication
with other nodes. The messages contain a verb handler within them that basically tells the
receiving node a couple of things: how to deserialize the payload message and what hand-
ler to execute for this particular message. The execution is done by the verb handlers (sort
of an event handler). The singleton class that orchestrates the messaging service mechan-
ism is org.apache.cassandra.net.MessagingService .
Gossip
Cassandra uses the gossip protocol for inter-node communication. As the name suggests,
the protocol spreads information in the same way an office rumor does. It can also be com-
pared to a virus spread. There is no central broadcaster, but the information (virus) gets
transferred to the whole population. It's a way for nodes to build the global map of the sys-
tem with a small number of local interactions.
Cassandra uses gossip to find out the state and location of other nodes in the ring (cluster).
The gossip process runs every second and exchanges information with, at the most, three
other nodes in the cluster. Nodes exchange information about themselves and other nodes
that they come to know about via some other gossip session. This causes all the nodes to
eventually know about all the other nodes. Like everything else in Cassandra, gossip mes-
sages have a version number associated with them. So, whenever two nodes gossip, the
older information about a node gets overwritten with newer information. Cassandra uses an
anti-entropy version of the gossip protocol that utilizes Merkle trees (discussed later) to re-
pair unread data.
Search WWH ::




Custom Search