Gossip Protocol in Cassandra

In this article, we’ll be looking briefly at the Gossip protocol that is implemented in the Apache Cassandra database. In this article, we will discuss Gossip protocol and How Cassandra achieves coordination between nodes and How nodes stay in-synch.

In Cassandra, all nodes are the same and have peer to peer architecture and there is no concept of a master-slave node. In Cassandra all nodes communicating with each other via a gossip protocol. Gossip is the message system that Cassandra node use to make their data consistent with each other.

What is Gossip protocol ?
Gossip is the message system that Cassandra nodes, virtual nodes used to make their data consistent with each other, and is used to enforce the replication factor in a cluster. So, let’s imagine and Cassandra cluster as a ring system where each node contains a certain partition of each table in the database. And, can only communicate with adjacent nodes.

How Cassandra achieve coordination between nodes ?
Let’s consider an example with 6 nodes in a cluster. one and two three four five and six, and you can see that node number three is down. So, there is a question, how Cassandra will behave in such situations. So, Gossip is a peer-to-peer communication protocol in which nodes periodically exchange state information about themselves and about other nodes they know about.



The Gossip protocol runs every second and exchange state messages with up to three other nodes in the cluster.
In Cassandra, Gossip protocol is very useful because nodes exchange information about themselves and about the other nodes that they have gossiped about, so all nodes quickly learn about other nodes in the cluster.

How nodes stay in-synch ?
This is how Gossip protocol works if any node goes down. Let’s discuss with Gossip protocol definition. Gossip message has a version associated with it, so that during a Gossip exchange, other information is overwritten with the most current state for a particular node.

We can split when that we have a quorum of four nodes and two nodes are not to trouble. When the network heals and we have an again cluster of six nodes, so everything is connected. Then, we need to do something with the state that is a style in those two nodes. So, we need to merge those new states in a cluster of quorum with other nodes. And, then Gossip protocol will choose that newest state, so there is a possibility of losing state.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.