In asynchronous networks, distinguishing between a node that has crashed and a node that is merely experiencing a slow network link is theoretically impossible (the core of the FLP Impossibility Result). The Heartbeat Pattern provides a pragmatic, empirical heuristic for failure detection.
A heartbeat is a periodic signal sent by a component to indicate its liveness.
The Push model is generally preferred as it scales better and requires less state management on the monitor side.
The critical engineering challenge is tuning the timeout threshold (T_{fail}):
Hard-coded timeouts fail in cloud environments where network latency is highly variable. Modern systems (like Cassandra and Akka) use the \Phi (Phi) Accrual Failure Detector.
Instead of a binary "Up/Down" state, the Phi Accrual detector provides a continuous scale of "suspicion."
This adaptive mathematical model allows the system to automatically adjust its failure detection threshold based on the current network conditions, drastically reducing false positives.
Heartbeats are structurally coupled with the Lease Pattern. A heartbeat is effectively the mechanism used to "renew" a lease. If the heartbeat fails, the lease expires, and the cluster safely transitions ownership of the resource.
See Also: