Quick revision
The short answer
In a gossip protocol, every node regularly picks one or a few random peers and exchanges versioned state with them by push, pull or both, keeping whichever version of each entry is newer. Because the number of informed nodes roughly doubles each round, news reaches all N nodes in about O(log N) rounds, so a 1,000-node cluster converges in seconds while each node sends only a constant number of messages per round. Gossip has no central bottleneck or single point of failure, but it is only eventually consistent, its traffic grows with cluster and state size, and wrong information spreads just as quickly as right information.
What to remember
In this answer, we saw that gossip spreads cluster state by having every node regularly exchange versioned entries with a few random peers, keeping the newer version of each. The number of informed nodes roughly doubles per round, so information reaches all N nodes in about O(log N) rounds, seconds for 1,000 nodes, at a constant cost per node. Compared with a central registry, gossip has no single point of failure or bottleneck, but it is only eventually consistent, its traffic grows with state size, and wrong information spreads as quickly as correct information.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
In a gossip protocol, every node regularly picks one or a few random peers and exchanges versioned state with them by push, pull or both, keeping whichever version of each entry is newer. Because the number of informed nodes roughly doubles each round, news reaches all N nodes in about O(log N) rounds, so a 1,000-node cluster converges in seconds while each node sends only a constant number of messages per round. Gossip has no central bottleneck or single point of failure, but it is only eventually consistent, its traffic grows with cluster and state size, and wrong information spreads just as quickly as right information.
Why this question is asked
Cassandra, Consul and Redis Cluster all need every node to know which other nodes exist, whether they are alive and what they own, without a central server that could fail or become a bottleneck. Gossip is how they do it. Interviewers ask about it because it is a neat example of trading strong consistency for scalability and resilience, and because its failure modes show up in real incidents. In this answer, we will see how a gossip round works, work out how fast information spreads, look at what gets gossiped, and compare gossip with a central registry.
1How a Gossip Round Works
Each node keeps a table describing the cluster: one entry per node, holding things like its address, its status and its load. Every entry carries a version, typically a heartbeat counter that the owning node increments every second, sometimes together with a generation number that changes when the node restarts. Only the owner of an entry ever increases its version.
Once per interval, say every second, each node picks one or a few peers at random and exchanges its table with them. In push mode it sends its table; in pull mode it asks for theirs; in push-pull it does both, which spreads information fastest. For every entry, each side keeps whichever version is higher. Notice that no node ever needs to talk to all others: the information hops from node to node like a rumour.
The generation matters because a restarted node starts its heartbeat counter from zero again. Comparing the generation first ensures that the fresh state of the restarted node wins over the large, stale counter from its previous life.
2How Fast Does Information Spread?
Suppose one node learns something new. In the first round it tells one random peer, so two nodes know. In the next round both of them tell someone, so about four know, then eight, sixteen, and so on. The number of informed nodes roughly doubles every round until most nodes know, and then the last few are reached quickly too, especially with push-pull, because uninformed nodes are now asking informed ones. The number of rounds needed grows with the logarithm of N, written O(log N).
| Cluster size N | log2 N | Typical rounds | At 1 round per second |
|---|---|---|---|
| 10 | 3.3 | 5 to 6 | about 6 s |
| 100 | 6.6 | 8 to 10 | about 10 s |
| 1,000 | 10 | 12 to 15 | about 15 s |
| 10,000 | 13.3 | 16 to 19 | under 20 s |
Two properties make this scale. Growing the cluster tenfold only adds a few rounds. And each node sends a constant number of messages per round, one or a few, whatever the cluster size, so no node becomes busier as the cluster grows. With a fan-out of three peers per round, as some systems use, convergence is faster still.
3What Gets Gossiped
Typical contents are membership and liveness (which nodes exist and their latest heartbeat), node load or capacity, schema or configuration versions, and ownership: which tokens a node owns in Cassandra's ring, or which hash slots a node serves in Redis Cluster. Cassandra, for example, gossips once a second with up to three nodes, and also uses heartbeat timing to feed its failure detector. Consul gossips membership using a SWIM-based library, while keeping its catalog in a Raft-replicated server cluster. Notice the pattern: gossip carries small, frequently refreshed facts, not the data itself.
4Strengths and Weaknesses Compared With a Central Registry
A central registry, such as a ZooKeeper ensemble or a service registry cluster, holds the authoritative membership list, and every node reports to it and reads from it. It gives one consistent answer at any moment. Its costs are that it is a dependency every node needs, its load grows with the cluster, and if it is unreachable, nodes lose their view of the cluster.
Gossip removes the centre. There is no single point of failure and no bottleneck, it tolerates lost messages and dead nodes naturally, because the next round simply tries other peers, and adding nodes is easy. The price is that convergence is probabilistic and eventual: for a few seconds after a change, nodes disagree. Traffic grows with cluster size and with the size of the state each node carries, so large tables need digests, exchanging versions first and full entries only when they differ. And wrong information spreads as efficiently as right information. A stale address or a ghost node, one that was removed but keeps being reintroduced by a node that still remembers it, can circulate for a long time and may need manual cleanup.
| Aspect | Gossip | Central registry |
|---|---|---|
| Single point of failure | none | the registry cluster |
| Consistency | eventual, brief disagreement | one authoritative answer |
| Load per node | constant per round | registry load grows with N |
| Bad information | spreads fast, hard to remove | fixed in one place |
| Typical users | Cassandra, Consul members, Redis Cluster | ZooKeeper, etcd, Eureka |
5Follow-up questions
Why do systems that use gossip still have seed nodes?
A new node needs somewhere to start. Seed nodes are a few well-known addresses that a joining node gossips with first to learn about the rest of the cluster. After joining, the seeds are not special for normal operation, though some systems gossip with them a little more often to help partitions heal.
How do nodes know a member is dead if gossip is only eventual?
Each node watches the heartbeat versions it receives for each member. If a member's heartbeat stops increasing for long enough, the node's failure detector suspects it. Different nodes may reach that conclusion at slightly different times, which is the eventual nature of gossip in action.
Can gossip carry large data?
It can, but it should not. Gossip is designed for small, frequently refreshed state. Large data increases traffic on every round for every node; it is better to gossip a version number and let nodes fetch the data directly when the version changes.
6Conclusion
In this answer, we saw that gossip spreads cluster state by having every node regularly exchange versioned entries with a few random peers, keeping the newer version of each. The number of informed nodes roughly doubles per round, so information reaches all N nodes in about O(log N) rounds, seconds for 1,000 nodes, at a constant cost per node. Compared with a central registry, gossip has no single point of failure or bottleneck, but it is only eventually consistent, its traffic grows with state size, and wrong information spreads as quickly as correct information.
Open with
In a gossip protocol every node keeps a table of cluster state, one entry per node, each with a version, usually a heartbeat counter that only the owner increments, often with a generation number for restarts.
Then, if they want more
Every interval, say once a second, a node picks one or a few random peers and exchanges its table by push, pull or push-pull, and for each entry both sides keep the higher version.
Information spreads like a rumour: one node tells one, then two tell two more, so the informed set roughly doubles each round, and everyone knows in about log N rounds. For a thousand nodes that is around ten to fifteen rounds, so seconds, and each node still only sends a constant number of messages per round.
Typical contents are membership and liveness, load, schema or config versions, and ownership like Cassandra's tokens or Redis Cluster's slots. The strengths are no single point of failure, no central bottleneck, tolerance of lost messages and dead nodes, and easy scaling.
The weaknesses are that it's eventually consistent, so nodes briefly disagree; traffic grows with cluster and state size; and bad information spreads just as fast, like a ghost node that keeps being reintroduced. A central registry like ZooKeeper gives one authoritative answer, but it's a dependency and a potential bottleneck.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "How does a gossip protocol work, how fast does information reach every node, and what...": https://scrivio-interview-library.netlify.app/architecture/distributed-systems/b64f99b740/