In this article, we will discuss the overview of Gossip protocol and mainly focus on working of gossip protocol and what is the role in the cluster to communicate with other nodes. Let’s discuss it one by one.
Gossip protocol :
In Cassandra, the nodes communicate with each other that is through gossip protocol. The main role of the gossip protocol is to identify what other nodes are doing in a ring. The main existence of the Gossip protocol to ensure that each node knows the state of itself and every other node in the ring.
Working of Gossip Protocol :
In this, we will discuss the working of the Gossip protocol where we will see how actually Gossip protocol works and will mainly focus on how communication happened between two nodes. Gossip protocol has to ability to know how other nodes are doing and find other nodes up to. Now, we will discuss the functioning one by one.
It is most likely a TCP 3-way handshake protocol.
- SYN –
In the synchronization part, it will send the GossipDigestSynMessage request to receiving node in a cluster, and receiving node will get this request and will respond accordingly.
- ACK –
After requesting synchronization and once receiving node will get the request then it will acknowledge the request and will send the GossipDigestAckMessage.
- ACK2 –
Finally, the initial node will get acknowledge then it will send GossipDigestAck2Message to the receiving node to acknowledge the acknowledgment response from receiving node.
Working steps of Gossip protocol :
- Initially, To receive endpoint state information, it will be done when Cassandra starts up, it registers itself with the Gossiper.
- After that, Periodically, typically once per second then Gossiper will choose the random node in a ring to start a Gossip session.
- After that, Initiating node will send the request GossipDigestSynMessage to the receiving node which simply means that it is requesting a synchronization.
- After that, when receiving node will get the request then it will acknowledge the request with GossipDigestAckMessage message to acknowledge the request.
- Finally, when Initiating node will get the acknowledgment from receiving node then again it will send the acknowledgment with GossipDigestAck2Message.