Concept Simulators / Copies and agreement
Gossip and failure detection
News spreads like a rumour, and silent nodes are noticed.
On the roadmap:Advanced · step 4: Distributed systems
Settings
What to look at
Rounds until 99% know
9
Know after 5 rounds
22%
Messages per node per round
1.7
Total messages
67,268
99% of 1,000 nodes knew after 9 rounds, with 1.7 messages per node per round. Growing the cluster ten times adds only a few rounds.
Share of the cluster that knows, round by round
share that knows
Rounds until 99% know, as the cluster grows
rounds
In plain words
In gossip, every node regularly tells a few random others what it knows, and they pass it on. Like a rumour, news reaches the whole cluster in a handful of rounds with no central server. Nodes also gossip heartbeats, so a node that goes quiet is noticed by everyone.
Why it matters
Large clusters need to know who is alive and what changed, without one machine that everyone depends on. Gossip is simple, tolerates lost messages, and spreads in time that grows only with the logarithm of the cluster size. The catch is a trade-off in failure detection: how long to wait before calling a node dead.
How real systems do it
The simulation is a simplified model. Here is what production systems add or do.
- Apache Cassandra uses gossip so that every node learns which others are in the cluster and what state they are in. It decides whether a node is down with a phi accrual failure detector, which adapts to the delays it sees instead of a fixed timeout.
- HashiCorp's Serf and Consul gossip using a protocol based on SWIM, which checks nodes directly and asks other nodes to check on its behalf before declaring one dead, to cut false alarms.
- Amazon's Dynamo paper describes using a gossip protocol so that nodes learn about membership changes and failures without a central coordinator.
- Gossip spreads information in a number of rounds proportional to the logarithm of the number of nodes. The price is that news arrives eventually, not at once, and different nodes briefly disagree.
Study: Gossip and failure detection
Once you have played with it, learn the same idea from people who build these systems. Watch first for the picture, then read for the detail.
6 minHow Key value Stores Work (Redis, DynamoDB, Memcached)?
ByteByteGo · 59K views
Then
20 minAmazon DynamoDB: A Scalable, Predictably Performant, and Fully Managed NoSQL Database ServiceGaurav Sen · 54K views
3 minDesign Patterns for DynamoDBGaurav Sen · 41K views
49 minDynamo - Why Amazon Ditched SQL | Distributed Systems Deep Dives With Ex-Google SWEJordan has no life · 26K views
25 minApache Cassandra - Just a Dynamo Clone?? | Distributed Systems Deep Dives With Ex-Google SWEJordan has no life · 9K views