Try
↑ ↓ move↵ openesc close

Interview prep / Failure detection

Junior · Failure detection · System design interview question

Explain how a heartbeat with a fixed timeout detects failures, and what the timeout trades off.

Sketch your own answer first, then compare it with the one below.

A strong answer

The monitored node sends a small message at a fixed interval. The monitor records when the last one arrived. If the silence since then exceeds the timeout, the monitor marks the node as suspected. A later heartbeat clears the suspicion.

The timeout sets two numbers at once. Detection time for a real crash is a little under the timeout, because part of it had already run down between the last heartbeat and the crash. The false alarm rate is how often a live node goes quiet for longer than the timeout, because of network delay or a pause.

Lengthening the timeout lowers false alarms and raises detection time. Shortening it does the reverse. There is no setting that improves both, so the right value depends on what a false alarm costs compared with a slow detection.

Sources

Learn it by running it

The failure detection lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms