Grokking the System Design Interview, Volume II
Vote

0% completed

Gossip Protocol

What is gossip protocol?

External discovery through seed nodes

Every node in a Dynamo cluster needs to know which other nodes are up, and which key ranges they own. This lesson looks at gossip protocol, the mechanism Dynamo uses to spread that information without a central coordinator.

What is gossip protocol?

There is no central node that tracks every member of a Dynamo cluster, so a node has to learn another node's state some other way. The simplest approach is

heartbeats
: every node pings every other node on a timer, and a node that stops responding is marked down.

That works, but it does not scale. With N nodes, a heartbeat round sends O(N^2) messages, and that grows too large for a big cluster to handle.

Dynamo solves this with gossip protocol, a peer-to-peer mechanism where nodes exchange state information instead of checking on everyone at once. Once a second, a node starts a gossip round with one other node, picked at random from the nodes it knows.

It shares what it has learned about itself and about every other node it has heard of. That includes which nodes are reachable and which key ranges they own.

That exchange repeats continuously, with a new random partner each round, so any change reaches the whole cluster before long. Every node ends up holding close to a full copy of the hash ring.

Image

External discovery through seed nodes

Gossip protocol has one gap. Two nodes can join the ring around the same time and never happen to gossip with each other.

Each one believes it is part of the cluster, unaware the other exists. That split is called a logical partition.

Say an administrator adds node A, then separately adds node B. Both consider themselves members of the ring. Neither has heard of the other yet, because gossip only spreads through nodes that have already talked to each other.

Dynamo closes this gap with seed nodes. These are fully functional nodes whose addresses every other node already knows, drawn from a static configuration or a configuration service.

Every node gossips with the seed nodes as part of its normal rounds. So any two nodes that share the same seeds eventually learn about each other too. That makes a logical partition unlikely.

Reading Progress

0%


Vote for new content

On This Page

What is gossip protocol?

External discovery through seed nodes