Question presented to candidate:
"In a cluster of servers, say a database, a cache or a set of workers, how does the system decide that one node has died? What makes that hard, and how do real systems like Cassandra, etcd or Consul do it?"
What a strong answer should cover:
The core difficulty: over a network a crashed node and a slow or unreachable node look the same; detectors can only suspect, so every detector trades detection speed against false positives
Heartbeats and timeouts: how the timeout is chosen (several heartbeat intervals), and what GC pauses, network jitter and overload do to it
Phi accrual detectors (Cassandra, Akka): output a suspicion level computed from the observed heartbeat history, compared with a threshold, so the timeout adapts to the network
Gossip / SWIM: random probing, indirect pings through other members, a suspect state that the node can refute with an incarnation number, and dissemination that scales to thousands of nodes
What happens after detection: leader election, re-replication, and fencing tokens / leases so a node wrongly declared dead cannot keep writing
Real numbers: etcd defaults (100 ms heartbeat, 1,000 ms election timeout), Cassandra phi_convict_threshold of 8
Code / implementation expected: Optional โ the reasoning matters most; the example compares fixed timeouts, a phi accrual detector and SWIM-style indirect probing on the same simulated heartbeats.
heartbeat
failure-detection
2
Try it yourself
Sketch your approach before you read the solution. That is what the interview tests.
Stuck? Get a hint.
A short nudge toward the approach. It will not give the answer away.
3
Solution
Target Audience: Beginners who know a cluster is several servers working together and want to understand how the cluster notices when one of them stops, and why it sometimes gets it wrong.
Difficulty: Medium
Verified with: Node 22.22 and Python 3.12 (both print identical output). The FLP result is from Fischer, Lynch and Paterson (JACM, 1985); Kubernetes lease behaviour from the Kubernetes node-status documentation; memberlist and Lifeguard from HashiCorp's "Making Gossip More Robust with Lifeguard". etcd defaults are cited from the etcd tuning documentation; Cassandra's phi threshold from the DataStax Cassandra documentation; the phi accrual detector from Hayashibara et al. (2004) as implemented in Akka; SWIM from Das, Gupta and Motivala (DSN 2002).
How to read this doc: Every idea is explained in plain language first, then tagged with ๐ Interview term: so you also
The solution is hidden so you can try first
15 min read ยท 12 sections
4
Read the code
Failure detectors: fixed timeouts vs a phi accrual detector, and SWIM indirect probes with suspicion and incarnation numbers