Try
↑ ↓ move↵ openesc close

Interview prep / Failure detection

Senior · Failure detection · System design interview question

You are tuning the failure detector for a replicated database. Walk through how you would choose between fast detection and few false alarms, and what measurements you would want first.

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

A strong answer

Start from costs, not from the detector. Ask what one false alarm costs: a failover with a few seconds of unavailability, a cache flush, a leader election that aborts in-flight writes. Then ask what one second of undetected failure costs: requests timing out, replication lag, a stale primary serving reads.

Measure the inputs. Collect heartbeat interval distributions per link over days, including the tail, and record every pause event with its length. The 99.9th percentile of silence from a live node is the floor for a fixed timeout, and anything below it will fire routinely.

Then pick a point on the curve and make it explicit. If false alarms are expensive, use a long timeout or a high phi threshold and accept slow detection, and move the fast path elsewhere, for example clients retrying against another replica. If detection must be fast, invest in making the reactions cheap and reversible. In the review, state the number of expected false alarms per day and the expected detection time, and have the simulator or production data back them.

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