The Runtime Theory

Gossip Protocol Flow: Random Peers, State Exchange, and Convergence

Watch a gossip protocol spread membership state — random peer selection, versioned heartbeat exchange, failure detection, and convergence in O(log N) rounds.

The Runtime Theory Team07 stages

trace / request.md

NODE JOINSRANDOMPEER CHOSENSTATE DIGEST SENTLATESTVERSION WINSCONVERGENCEFAILURE DETECTIONDEATH SPREADS

readyA new node contacts a seed node and receives the current membership list — every known member with a versioned heartbeat. It has no state of its own yet.

Gossip protocols trade determinism for robustness: instead of a leader telling everyone, each node tells a random neighbor, and state spreads like an infection. The unit of state is the versioned heartbeat — one counter per member — and the merge rule is trivially correct: the highest version wins. That makes convergence a matter of counting rounds, not negotiating.

Failure detection is gossip's killer feature. A node that stops incrementing its heartbeat is noticed locally — suspicion, then death — and the verdict propagates by the same mechanism that spreads membership. No one pings everyone; each node pings someone, and the information does the rest. This is why Cassandra, Consul, and Docker Swarm all gossip: clusters of hundreds of nodes can maintain membership with constant per-node overhead, and no single node's death takes the view down with it.