Systems & Backend

Heartbeat

A periodic “I am alive” signal between nodes, used to detect failures — miss enough and you are presumed dead.

A heartbeat is a periodic signal a node sends to say it is alive. Peers or a coordinator track heartbeats and, after missing some threshold, presume the node dead and react — failing it over, re-electing a leader, or evicting it from the pool.

Worked example: replicas heartbeat the primary every second; if three in a row are missed, the system triggers failover to a replica. Gotcha: the timeout is a trade-off — too short and a brief hiccup causes a false failover (flapping), too long and real failures take ages to detect — and heartbeats can lie (a node heartbeats but its disk is full and it cannot serve), which is why deeper health checks complement them.