Gossip: how a cluster knows who is alive
Lesson 6.03 gave you consensus: a majority agreeing on a single value, correct and expensive. Not every fact in a cluster deserves that. Membership — which nodes exist, which are reachable right now — is the standard example, because it changes constantly, it is never quite knowable, and running a consensus round per heartbeat across a thousand machines is not something you can afford.
The shape
Each node, on a timer, picks a small number of peers at random and exchanges what it believes about everyone. That is the whole protocol. There is no coordinator, no quorum, and no node whose death stops it. Information spreads the way a rumour does — exponentially, reaching the whole cluster in a number of rounds proportional to the logarithm of its size, which is why a hundred nodes and ten thousand nodes converge in remarkably similar time.
What you buy is scale and the absence of a leader to lose. What you pay is that membership is now eventually consistent: for a window measured in seconds, two nodes hold different views of who is up, and everything built on top has to tolerate that. This is why a real cluster usually runs both mechanisms — gossip for the churning facts, consensus for the handful that must be unique, like which node owns a shard or which configuration version is current.
Detection is the hard part, not dissemination
Spreading news is easy. Deciding what the news is runs straight into Lesson 6.06: you cannot distinguish a dead node from a slow network, and a fixed timeout is wrong in both directions.
Set it short and you evict healthy nodes during a load spike — which removes capacity at the exact moment the cluster needed it, increasing the load on what remains, which triggers more evictions. That feedback loop has taken down more clusters than hardware has.
Set it long and you keep routing requests to a machine that is gone, so every client pays a timeout to learn what the cluster already suspected.
The better answer is to stop producing a boolean. Adaptive detectors track the distribution of observed heartbeat intervals for each peer and emit a suspicion level — how surprising this silence is, given how that particular node normally behaves. The threshold then becomes an explicit statement about how much risk of a false eviction you will accept, which is a decision somebody can make, rather than a timeout somebody guessed.
Ask a friend before declaring a death
The other refinement is indirect probing. Before marking a peer dead, a node asks a few others to probe it and report back. That single step separates "I cannot reach it" from "nobody can reach it" — the difference between one bad link and a dead machine, and a distinction no amount of local timeout tuning can make.
You meet all of this in Dynamo-lineage stores, in service-discovery agents, and in the cluster buses of several databases. It is also what keeps Lesson 4.05's hash ring current: the ring is only useful while the nodes roughly agree on who is in it.
The flapping node. One machine with a marginal link or long garbage-collection pauses gets marked down, then up, then down again. Each transition is a membership change, and a membership change is not free — it rebalances the ring, churns connections, and makes every client reconfigure. A node oscillating every thirty seconds can generate more cluster-wide work than simply being dead would, and the cluster spends its capacity reacting to one sick machine instead of serving traffic. Damping is the fix and it is not polish: require a node to be stably reachable for a period before readmitting it, and rate-limit how fast membership may change at all, so that the cluster's response to instability is bounded even when the instability is not.
The tradeoff sheet
- Problem solved
- A cluster needing to know which of its nodes are reachable right now, at a size and churn rate where asking a quorum on every heartbeat is unaffordable.
- Rejected, and why
- A consensus group holding the membership list is authoritative and costs a quorum round per change. A central registry every node polls is simpler and is a component whose death blinds the whole cluster.
- The trade
- Membership is eventually consistent, so two nodes hold different views of who is up for seconds at a time, and everything built above has to tolerate a stale one.
- First to break at 10x
- The failure detector, under load rather than at scale. Latency rises, heartbeats look late, healthy nodes are evicted, and the lost capacity makes the latency worse — a loop that feeds itself.
- What it does to the bill
- Continuous background chatter proportional to node count times fanout. Trivial per node, and a real line item across zones once the cluster is large (Lesson 14.02).
- Day-2 operations
- Alert on the rate of membership change, not the node count. A cluster revising its view every thirty seconds is one sick machine generating work for a thousand healthy ones.
Going deeper
- SWIM: Scalable Weakly-consistent Infection-style Process Group Membership Protocol Das, Gupta & Motivala, 2002
Separates failure detection from dissemination and introduces the indirect probe. Short, and the source of the design most systems now use.