Skip to content
StackDecode
System Design
6. Distributed Systems FundamentalsAnimated

Gossip Protocol

Nodes spread information to random peers.

The idea

Each round a node tells a few random neighbours, and the news reaches everyone in logarithmic time.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

Node ANode BNode Cstate digest
  • current message
  • earlier
  • failure or attack

Every second each node picks a random peer and shares what it knows.

step:
1/5
from:
Node A
to:
Node B
1/5

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1A node learns something
  2. 2It tells a few random peers
  3. 3They tell others
  4. 4Everyone converges quickly

Where it is used

Membership in Cassandra and Consul.

Watch out for

Eventually consistent and generates steady background traffic.

Related