Problem
In a distributed system a crashed node does not announce its death, and a slow network looks identical to a dead peer. Peers need a timely, tunable way to decide a node is gone so work can be reassigned.
Also known as: keep-alive-signal, liveness-lease
Detect failed nodes by having them periodically announce they are alive, and treating silence as failure.
In a distributed system a crashed node does not announce its death, and a slow network looks identical to a dead peer. Peers need a timely, tunable way to decide a node is gone so work can be reassigned.
A heartbeat is a periodic proof of life. Because a crashed process sends nothing, absence of the signal is the only available evidence of failure, and the design question is how long to wait before believing it.
Each worker sends a heartbeat to a coordinator, which records the last-seen time.
worker: every 1s -> send(id, seq)
coordinator: if now - lastSeen(id) > 5s
mark SUSPECT, reassign tasks
A common rule is a timeout of three to five intervals so that one or two lost packets do not trigger action. Gossip-based systems such as Cassandra spread heartbeats peer to peer and use phi accrual detection, which outputs a continuous suspicion value that adapts to network jitter.
Low, small periodic messages
Medium, tune intervals per environment
Medium, failure detection subtleties
Long GC pause triggers false failure and duplicate work
Monitor itself fails or is partitioned and declares everyone dead
Clock skew corrupts timeout calculation