Gossip Protocol
Is communication protocol used in a distributed system to distribute the information effectively. The main concept is that each node randomly choose a set of nodes to exchange the information.
Therefore better in synchronisation and communication.
Think of it like co-workers gossip with eachother
Use cases
- Centralised state management
- Fault detection
Example
For example in the case where we need to detect which node is down in our system.
The Gossip protocol, each node will:
- Maintain a list of other nodes which contains their ID and heartbeats.
- Periodically increment heartbeat counter of each node in its membership
- If 1 node heartbeat has not been incremented for a period of time, it's considered as offline.
- This information is then send to other node in the membership list to verify
Example:
- s0 maintains a membership node as shown
- s0 notice that s2 (ID = 2) heartbeat has not incremented for a while
- s0 then send that list of heartbeats to other node which include s2 heartbeat counter.
- Other nodes then confirm if s2 has not been updated for awhile. If so this node will be marked down