Gossip is a non-distributed to be used in a system strong consistency method for synchronizing status for each node.
Because in the center of the cluster to the environment, each node insight into important information to other nodes "real time" is very important. This message includes:
- Heartbeat node
- state of the node (fail inspection / live / dead)
- current load node
Gossip is designed to be low CPU overhead and low network bandwidth. Making it ideal for large-scale P2P network. Gossip periodically and randomly selecting a node initiates a session Gossip, Gossip comprising a three messages. For example NodeA to initiate a Gossip Node B:
- A → B GossipRequestMessage
- B → A GossipAckMessage
- A → B GossipResponseMessage
Further, the above message delivery to and fro based on detecting a failure or not.
protocol
1GossiperSummary
Summary information node
Ip
Node ip address
generation
generation:
If the update state represents a large change, such as the data model modifier
version
version:
A small version of the update status, such as node restart
2 GossipAppState
Application status messages
HeartBeat
Heartbeat:
generation
version
event
Status (状态事件):bootstrap/join/leaving/moving/removing/..
load (load event)
datamodel (data model events)
3GossiperRequestMessage
Generated by gossiper, to a gossipee
The current state of the List <GossiperSummary> originating node comprising
4GossipeeAckMessage
Upon receipt of a request gossiper, generated by gossipee, and sent back to the gossiper
List<GossiperSummary>in
Comprising GossiperRequestMessage difference with the incoming, i.e., information of the local node (gossipee) is outdated, the initiator (gossiper), updated information, need to be synchronized in.
Map<Ip,GossipAppState> out
Local node (gossipee) has updated GossipAppState information needs to be synchronized back to the originator (gossiper)
5GossiperResponseMessage
After receiving the responses gossipee generated by the gossiper
Map<Ip,GossipAppState> out
Gossipee difference portion back to the request (i.e. there is an updated gossipee found gossiper GossipAppState information required gossiper return)
Process flow
1. gossiper topology information based on their own local system cache, the cache is created for each node separately GossiperSummary, and then based on this list, create GossiperRequestMessage
2. Send GossiperRequestMessage to each live node
3. The resolution request message recipient gossipee total own outdated state information GossiperSummary
4. recipient gossipee calculated simultaneously update their ratio gossiper (sender) of status information GossipAppState
5. gossipee Based on the above calculations, create GossipeeAckMessage
6. gossipee send a message to the sender GossipeeAckMessage
7. sender based gossipee sent over GossipAppState update their status
8. The gossipee request sender calculates GossipAppState (i.e., this information is out of date state gossipee)
9. calculated based on the sender, information created GossiperResponseMessage
10. The transmission direction information gossipee transmission GossiperResponseMessage
11. gossipee loopback over according to the sender GossipAppState update their status
Reproduced in: https: //www.cnblogs.com/ericsun/archive/2013/06/10/3130766.html