Heartbeat
Definition
A heartbeat is a message sent at a fixed interval by a node, client or connection so that the receiver can detect failure when heartbeats stop arriving within a timeout.
In practice
Heartbeats drive failure detection everywhere: Raft followers start an election when the leader's heartbeats stop, instances renew their registration in a service registry, and WebSocket or SSE connections send pings so idle proxies do not close them and dead peers are noticed.
The interval and timeout set a trade-off: short timeouts detect failure quickly but declare slow nodes dead during GC pauses or network blips, causing needless failovers. A common rule is a timeout of several missed intervals. Heartbeats only prove the process can send heartbeats, not that it does useful work, which is how gray failures slip through.
Example
A Raft leader sends heartbeats every 100 ms; followers use election timeouts randomised between 300 and 500 ms, so a dead leader is replaced in under a second.