Gossip protocols
How Cassandra and Serf propagate cluster state at O(log N) — like disease spread.
Gossip protocols propagate information through a cluster like disease spreads through a population. Each node periodically shares state with a small random subset of peers. In O(log N) rounds, everyone knows. It's how Cassandra tracks membership, how Serf handles service discovery, how Hedvig replicates writes.
Interactive spread
The gossip algorithm
- Push-pull: both sides learn from each other in one round
- Fanout: pick 2-3 peers per round for faster spread + more resilience
- Anti-entropy: periodically sync full state to prevent drift
The math — why O(log N)
Each round, the number of nodes that know DOUBLES (each knower tells 1 unknown). Starting from 1 knower: 1 → 2 → 4 → 8 → 16 → ... → N. That's log₂(N) rounds. 1000 nodes = 10 rounds = 5 seconds at 500ms/round. 1M nodes = 20 rounds = 10 seconds. Cassandra tuned to be even faster.
Real deployments
Practice what you just read
Every foundation concept has a companion quiz to close the loop.