Try
↑ ↓ move↵ openesc close
In this lesson · topic 5 of 7
  1. 1. Silence is all you get
  2. 2. Heartbeats, timeouts and suspicion
  3. 3. Slide one detector along its curve
  4. 4. When a 600 ms pause beats the detector
  5. 5. Watching three hundred nodes without three hundred heartbeats each
  6. 6. Adding up a failover, and the storm a false alarm can start
  7. 7. Check the ten-second timeout

Topic 5

Watching three hundred nodes without three hundred heartbeats each

7 min read

The cost of everyone watching everyone

The lab watches one node from one monitor. A real cluster has hundreds of nodes, and the obvious design has each node send a heartbeat to every other node once a second. With n nodes that is n times n-1 messages a second. At 300 nodes it is 89,700 messages a second, just to say “still here”. At 3,000 nodes it is about 9 million.

A central monitor cuts the traffic to n messages a second. But it is one machine that must stay up, and it sees the cluster through one network position. If its link is congested, it suspects everyone.

Probe one random peer per round

The SWIM protocol, by Das, Gupta and Motivala (2002), replaces heartbeats with probes. Each node runs a round every protocol period, say one second. In a round it picks one random peer and sends it a ping. If an ack comes back within a short timeout, the peer is fine and the round ends.

Each node sends one ping and receives one ack per round, whatever the cluster size. Total load grows with n, not with n squared. At 300 nodes that is about 600 messages a second cluster-wide instead of 89,700.

Does random choice still find a dead node quickly? In a round, each of the other n-1 nodes picks a target uniformly, so a given dead node is picked by nobody with probability (1 - 1/n) to the power n-1. That is close to 1/e, about 0.37. So with probability about 0.63 somebody probes it in any round, and the expected time to first detection is 1 / 0.63, about 1.58 periods. This does not depend on n either.

Ask others before accusing

A missed ack can mean the target is down, or that the path from this prober to the target is bad. SWIM adds a second step. If the direct ping gets no ack, the prober asks k other nodes, say three, to ping the target for it. If any of them hears back, the target is alive and the prober was the one with a bad link.

This shrinks false alarms from the prober’s own network trouble. It does not help against a target that is itself paused, since no probe will be answered.

Suspect first, then declare

A node that fails both probes is marked suspect, not dead. The suspicion is gossiped to the rest of the cluster by piggybacking it on the ping and ack messages that are already flying. The suspect has a window, often several protocol periods, to prove otherwise.

To refute, the suspect increases its incarnation number and announces that it is alive. Updates are ordered by incarnation: an alive message with a higher incarnation beats a suspect message with a lower one. Only after the window passes with no refutation is the node declared dead and removed.

This is the same lesson as the rest of the module. The detector is allowed to be wrong, and the protocol gives the accused a way to correct the record.

Predict first

A cluster doubles from 150 to 300 nodes and keeps the same probe period. What happens to the load each node carries for failure detection under SWIM-style probing?

The trade

Probing gives constant load and detection in a couple of periods. The news reaches everyone later, after a gossip spread that takes on the order of log n periods, around ten for 300 nodes. To go faster, shorten the period and every node pays the extra message rate. The curve from the lab is still there. Probing just takes the cost off the square.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms