Try
↑ ↓ move↵ openesc close

Interview prep / Failure detection

Mid · Failure detection · System design interview question

What is a phi accrual failure detector, and how does it differ from a fixed timeout?

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

A strong answer

Instead of a yes or no, it outputs a suspicion level. It keeps a window of recent heartbeat arrival intervals, fits a distribution to them, and reports how unlikely the current silence is, on a logarithmic scale. A phi of 1 means a silence this long happens about one time in ten, phi 2 one in a hundred, and so on.

The application picks a threshold. The useful difference is that the threshold is relative to the network the detector has seen. On a quiet network the same threshold fires after a short silence, on a jittery one after a longer silence. A fixed timeout would need retuning for each.

It is still a guess from silence. A pause longer than anything in the window still looks like a crash, and the first few samples after startup are a poor fit. Phi moves along the same accuracy against speed curve as a fixed timeout. It just picks the point automatically.

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