Suspicion is not proof of failure
A fixed timeout asks whether the last heartbeat arrived too long ago. A phi accrual detector instead measures how surprising the current delay is under a model of recently observed heartbeat intervals. The application chooses what action to take when the suspicion score crosses its threshold.
This distinction matters during a network partition: a detector observes silence, not the remote process. It cannot calculate an unconditional probability that a node has died.
The score
Let be the modeled cumulative distribution of heartbeat intervals and the elapsed time since the last heartbeat:
The tail probability describes an interval at least this long under the model. A smaller tail probability produces a larger suspicion score.
| Phi | Modeled tail probability | Meaning |
|---|---|---|
| 1 | 0.1 | Such a long interval is uncommon in the model |
| 2 | 0.01 | More unusual |
| 3 | 0.001 | More suspicious still |
| 8 | 0.00000001 | Extremely unusual under that model |
These are not measured probabilities of a real node crash. A bad distribution fit, correlated network loss, or a process pause can produce a misleadingly large score.
Building the detector
- Record inter-arrival intervals with a monotonic clock. Wall-clock corrections should not change elapsed time.
- Keep a bounded history. Require enough samples before trusting the estimate.
- Fit or approximate an interval distribution. A normal model is one choice, not a requirement of every accrual detector.
- Apply a minimum variance and an acceptable heartbeat-pause allowance so a very stable history does not make a tiny delay appear catastrophic.
- Compute the score and compare it with the configured threshold. Keep the score separate from membership and failover policy.
For example, two peers can have the same expected interval but different jitter. A 200 ms silence can be much more suspicious on a tightly clustered 100 ms heartbeat stream than on one with broad variation. The actual scores depend on the distribution and safeguards; there is no universal mapping from that silence to phi.
What adaptation can and cannot do
Recent interval history can accommodate gradual timing changes. An abrupt network pause may arrive before the history adapts, so a higher threshold trades detection speed against false suspicion. Akka documents a phi detector based on a normal distribution with tunable safeguards; do not assume every product named “phi accrual” uses identical mathematics or defaults.
A failure-injection exercise
Use three separate experiments: kill the sender, delay its heartbeat packets, and pause its process while keeping the host reachable. Record the score and recovery time in each case. The last two should remind you why an unreachable node is not necessarily a dead node.
Before promoting a replacement writer, use a fencing or consensus mechanism that prevents the old writer from continuing to modify shared state. Detection tells you when to investigate or reconfigure; it does not by itself make that reconfiguration safe.
Source and further reading
Akka: Phi Accrual Failure Detector documents the score and tuning parameters. Compare this approach with heartbeat timeouts and leader election.
Keep reading
Cache Eviction Policies
When the cache is full, something has to go. A comprehensive guide to LRU, LFU, ARC, and other replacement algorithms with implementation details.
Geohashing (Location Encoding)
A geocoding system that encodes latitude/longitude coordinates into short alphanumeric strings for efficient proximity searches and spatial indexing.
HyperLogLog (Cardinality Estimation)
A probabilistic algorithm for counting unique items in massive datasets using minimal memory, with tunable statistical error and compact mergeable state.
Leader Election
Comprehensive guide to distributed leader election algorithms including Raft, Paxos, and Bully algorithm, covering consensus, split-brain prevention, and real-world implementations in Kubernetes, ZooKeeper, and etcd.
MapReduce
A programming model for processing massive datasets in parallel across distributed clusters. Understanding Map, Shuffle, Reduce with real-world use cases from Google, Hadoop, and Spark.
Merkle Trees (Data Synchronization)
Hash tree data structure enabling efficient verification of data integrity and synchronization across distributed systems, used in Git, Bitcoin, Cassandra, and IPFS for tamper detection and incremental sync.