Spread news like a rumour: each machine tells a few random others.
A gossip protocol spreads information through a group of machines the way a rumour spreads through an office: each machine regularly tells a few randomly chosen others what it knows, and they do the same.
Imagine a cluster of 1,000 machines. One of them learns something: a new node joined, a node died, or a setting changed. How do all the others find out? The simple way is for that one machine to message all 999 others. But that machine becomes a bottleneck, and if it crashes halfway, only some machines know.
Gossip takes a different path. Every round (say once a second), each machine picks a few random peers and shares what it knows. A machine that just heard the news does the same in the next round. The group that knows roughly doubles each round: 1, 2, 4, 8, 16... After about logβ(N) rounds, almost everyone knows. For 1,000 machines that is only about 10 rounds.
The same idea is called an epidemic protocol, because news spreads like a disease: the more machines are infected, the faster it spreads, until nearly everyone has it.
| Style | How it works | Good and bad |
|---|---|---|
| Push | Machines that know the news send it to random peers | Fast at the start, when few know. Wasteful at the end, as most pushes hit machines that already know. |
| Pull | Machines ask random peers if they have anything new | Slow at the start, fast at the end. Good for finishing off the last few machines. |
| Push-pull | Two peers swap and merge what each knows | Fastest overall. Used by most real systems, at the cost of bigger messages. |
| Setting | What it means | Why it matters |
|---|---|---|
| Fan-out | How many peers each machine tells per round | More means faster spread, but more traffic and more duplicates. |
| Gossip interval | Time between rounds (often about 1 second) | Shorter means faster news but more network use. |
| Message content | Only the latest changes, or the whole state | Small digests save bandwidth. Full state is simpler and more robust. |
| Stop rule | When to stop spreading an old rumour | Without it, old news circulates forever and wastes bandwidth. |
A simplified push-gossip model: in each round every informed machine picks 2 random other machines and sends the news. The picks come from a fixed seeded sequence, so the same settings always replay the same story. Real systems also pull and exchange state, and they check for failures.
| Term | Meaning in easy words |
|---|---|
| Gossip / epidemic protocol | Spreading information by random peer-to-peer exchanges, like a rumour or an infection |
| Round | One cycle in which every machine gossips once |
| Fan-out | How many peers a machine contacts in each round |
| Push, pull, push-pull | Whether the news is sent, asked for, or swapped both ways |
| Convergence | The point when all machines hold the same information |
| Anti-entropy | Comparing and repairing differences between replicas, so they drift back together |
| Rumour mongering | Spreading a fresh update until most peers already know it, then stopping |
| Digest | A short summary of what a machine knows, used to find what is missing |
| Membership list | The list of machines a node thinks are in the cluster |
| Seed node | A well-known machine that new nodes contact first to join the gossip |
| SWIM | A popular gossip-style protocol for membership and failure detection |
| Choice | We gain | We lose |
|---|---|---|
| Bigger fan-out | Faster spread, more robust | More traffic and more duplicate messages |
| Shorter interval | News arrives sooner, failures found sooner | More network and CPU use, more false alarms |
| Send full state | Simple and self-healing | Large messages as the data grows |
| Send only digests | Small messages | Extra round trips to fetch the missing parts |
| Gossip instead of a central list | No single point of failure, scales out | Views are slightly stale and only eventually agree |
| Aggressive failure detection | Dead machines are removed quickly | Healthy but slow machines may be wrongly declared dead |