Skip to content
SWIM Protocol
step 1/5

Reading — step 1 of 5

Read

~1 min readMembership Tracking

SWIM Protocol

SWIM (Scalable Weakly-consistent Infection-style process group Membership) — Das et al. 2002. The basis for Serf, memberlist, Cassandra's gossip.

Two key innovations:

1. Indirect ping for false-positive avoidance:

Node A wants to check Node B.
A pings B directly. If B doesn't respond:
A asks K random peers to ping B on its behalf.
If ANY of them succeed, B is alive (just A's connection was bad).
If ALL fail, B is suspected.

This reduces false positives in NAT/firewall scenarios.

2. Failure detection time independent of cluster size:

Each node pings ONE random peer per protocol period. With period T, expected detection time is bounded by T regardless of N.

For 100 nodes: detect failure within seconds. For 10000 nodes: detect failure within seconds.

Membership info piggybacks on ping/ack messages — no separate gossip channel needed.

Suspected nodes: state = suspect. Period of grace; if no heartbeat or contradicting info arrives, transition to dead.

This is the protocol in Hashicorp's memberlist library, used by Consul, Nomad, Boundary.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…