Skip to the guide

Gossip and failure detection

AdvancedConcept3 pages

In a cluster of hundreds of machines with no master, every node needs to know which others are alive. Gossip spreads that news peer to peer, and a good failure detector decides "dead" with care. Interviewers ask about both in designs like a key-value store or a distributed cache.

News in a village

In a village with no newspaper, each morning everyone chats with two or three neighbours picked at random and passes on everything they've heard. News of a wedding on Monday has reached nearly everyone by Thursday, though nobody told more than three people a day. When the old man at number 12 doesn't answer his door, his neighbour doesn't call an ambulance straight away: she asks two others to knock too. Only if nobody gets an answer does she tell the village he may be unwell. And if he turns up at the shop, he tells everyone himself: "I'm fine."

  • the villagers → the nodes of the cluster
  • chatting with a few random neighbours → gossip: each node regularly swaps what it knows with a few random peers
  • known by everyone within days → news spreads in about log N rounds
  • the neighbour knocking at number 12 → the node whose ping failed
  • asking two others to knock → indirect probes: confirm a failure from other places
  • "may be unwell" → a node marked suspect before it's declared dead
  • "I'm fine" → a node refuting the suspicion with a newer incarnation number