Gossip protocols (epidemic algorithms) propagate information through a cluster via periodic, pairwise state exchanges. They are the standard for decentralized membership and failure detection in large-scale systems (Cassandra, Consul, Dynamo).
Information spread in a gossip network follows the logic of a viral infection. In a cluster of Nnodes, if each node gossips withkrandom neighbors everyTseconds, the time to achieve full convergence (t_{conv}) is:
Gossip is highly resilient: even if$50%of nodes fail, the rumor still reaches all surviving nodes withO(\log N)$latency.
SWIM (Scalable Weakly-consistent Infection-style Membership) decouples failure detection from membership updates.
Instead of a binary "Up/Down" state, nodes track the inter-arrival time of heartbeats.
Propagating configuration or ring topology. Implementation (Pseudo-Code):
def gossip_round(local_state):
# Pick k random peers
peers = random.sample(cluster_nodes, k)
for peer in peers:
# Push-Pull: Send what I know, ask what they know
remote_delta = peer.exchange(local_state.summary())
local_state.merge(remote_delta)
| Metric | Gossip (Epidemic) | Consensus (Raft/Paxos) |
|---|---|---|
| Consistency | Eventual | Strong (Linearizable) |
| Scalability | $10,000+nodes |<100$nodes | |
| Coordination | Peer-to-peer | Leader-based |
| Typical Use | Failure detection, metadata | Transactions, locks |