Unit 6 of 12 · about 4 hours · explain, derive
Heartbeats, observation windows, detector completeness and accuracy, and suspicion thresholds
Every membership and failover decision starts as a suspicion. This vocabulary decides whether a pause looks like death, before any threshold is tuned.
You'll be able to
- Explain what a heartbeat proves and what silence cannot prove, using the observation-window idea.
- State detector completeness against accuracy, and distinguish detection delay from eventual detection.
- Compare fixed thresholds with adaptive ones, and name the workload change that breaks each.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Fault detection and timeoutsDDIA 2e - Chapter 9 The Trouble with Distributed Systems
Chapter 9, Fault Detection (p. 351): explicit crash signals versus timeout guessing; Timeouts and Unbounded Delays (pp. 352-353): the false-positive against detection-delay balance, the 2d+r bound and congestion causes
- Direct and indirect probingSWIM: Scalable Weakly-consistent Infection-style Process Group Membership (Das et al., 2002)
Section 3.1, SWIM failure detector: one random ping per protocol period, k indirect ping-reqs when the ack misses, and the end-of-period check
- Heartbeat and timeout sizingHLD Handbook - Clocks, Failure Detection and Consistent Hashing
Theory, Heartbeats and timeouts: p99 plus jitter sizing with a 2x to 4x margin, and the reported etcd, Kubernetes, TCP keepalive and Redis Cluster numbers
Use as review after DDIA and SWIM. Its deployment numbers are reported figures from their sources, not values to copy into your detector.
- Election timeouts affect progress, majority affects safetyMIT 6.5840 - Failure and Paper Discussion Lens
MIT 6.5840 Spring 2026 Lecture 6 notes: when a peer starts an election, the at-most-one-leader vote rules, and how to choose the election timeout
Read for the timing lens only: needless elections are slow but safe, and an old leader may still think it leads. Do not start the Raft lab.
Focus on
- A received heartbeat proves the sender was alive at send time, nothing more. Silence inside one window proves nothing: delay, pause, overload and death look identical until the window closes.
- Completeness concerns eventual suspicion of crashed processes; accuracy concerns avoiding suspicion of correct ones, with strong and eventual variants. Shorter timeouts reduce delay, not improve the eventuality guarantee. Explicit crash notifications can help, but connection refusal proves only that an endpoint rejected the connection, not that the machine died.
- SWIM uses indirect probes after a direct miss to reduce false suspicion from one bad path. Failure of every probe still cannot distinguish an isolated live target from a crashed one.
- Raft shows the split this section keeps: timeouts and heartbeats drive progress (elections, suppression), while majority votes carry safety when the old leader is still talking.
Common mistakes · 3
- Treating a missed heartbeat as death. The detector output is suspicion with a threshold, and acting on it needs fencing or a quorum, as later units show.
- Tuning the timeout down to detect faster without costing anything. Faster detection spends accuracy, and false convictions add failover load exactly when the system is slowest.
- Copying a vendor timeout into a different network. A 10x ratio that fits one RTT and jitter budget misfires under another; size from your own p99 plus margin.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.A node misses two heartbeat windows, then answers. Was it dead during the silence?Answer
Unknowable from heartbeats alone. Delay, pause, overload or a short crash with recovery all fit; the detector can only report suspicion, not the cause.
2.What do completeness and accuracy each promise, and which one breaks first when load spikes?Answer
Completeness promises crashed nodes are eventually suspected; accuracy promises live ones are not. Load spikes break accuracy first, through false suspicion.
3.Why does SWIM probe indirectly before suspecting, instead of suspecting on the first missed ack?Answer
A direct miss may be a faulty path rather than a faulty target. If any of k others reaches the target, the initiator learns liveness without a false report.
4.Raft holds an unnecessary election. What breaks: safety or progress?Answer
Progress only, for a while. Majority voting still permits at most one leader per term, so the cost is delay, which the notes call slow but safe.
You're done when
You derive with its two missing bounds from memory, and explain why delay, pause, overload and death remain indistinguishable from silence alone.
Only when you can do this without notes.
Leads to
Notes
Resources · 4 for this unit, 10 more in the section
- DDIA 2e - Chapter 9 The Trouble with Distributed SystemsMartin Kleppmann and Chris Riccomini · primary
Read clocks, pauses, unreliable networks, partial failures and knowledge limits. For each failure, record what a node observes, what is true globally and what action is safe under that uncertainty.
- SWIM: Scalable Weakly-consistent Infection-style Process Group Membership (Das et al., 2002)Cornell University · support
Read the direct and indirect probing detector, infection-style dissemination, the suspicion mechanism and incarnation numbers. Suspicion timeouts depend on the workload.
- HLD Handbook - Clocks, Failure Detection and Consistent HashingHLD Handbook · required
Read Part 3 clocks and ordering, failure detection and consistent hashing. Use its exercises to compare assumptions, then verify claims against your own histories.
- MIT 6.5840 - Failure and Paper Discussion LensMIT PDOS · support
Use the RPC, GFS, Raft and consistency lectures to identify which timing assumptions affect progress and which invariants must not depend on time. Do not start the Raft lab yet.
Also in this section
- Time, Clocks, and the Ordering of Events in a Distributed System (Lamport, 1978)Leslie Lamport · required
Read the partial ordering and logical clocks sections: happens-before, the Clock Condition, rules IR1 and IR2, and the total order. Its ties are broken arbitrarily, so the total order is not causality.
- Logical Physical Clocks and Consistent Snapshots (Kulkarni et al., 2014)University at Buffalo · support
Read the hybrid logical clock algorithm and its bounds; the paper reports the logical counter staying well below its proved bound in practice, so measure your own.
- The phi Accrual Failure Detector (Hayashibara et al., 2004)JAIST · support
Read how phi is computed from the heartbeat inter-arrival history and how a threshold trades detection time for false suspicion. Its normal approximation misleads under bursty delay, so test with pause traces too.
- How to Do Distributed Locking (Kleppmann, 2016)Martin Kleppmann · required
Read the process-pause, network-delay and fencing-token sections with DDIA 2e Chapter 9 "Distributed Locks and Leases". Treat the Redlock critique as dated to 2016; the lasting lesson is that the storage service must reject a write that carries an older token.
- Cambridge Concurrent and Distributed Systems Notes (Kleppmann) - Time, Clocks and OrderingUniversity of Cambridge (Martin Kleppmann) · support
Use Chapter 3 (physical clocks, NTP and monotonic clocks, happens-before) and Section 4.1 (Lamport and vector clocks with worked examples) as the derivation workbook: work Exercises 7 to 13. Each section marks where its public lecture video starts.
- Building Distributed Systems - The TimekeeperBuild Distributed Systems · optional
Only the first three tasks are free (clock reads and backward jumps, a monotonic wrapper, a split-brain lease). Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.
- Building Distributed Systems - The GossiperBuild Distributed Systems · optional
Only the first three tasks are free (basic broadcast, tree topology, random gossip). Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.
- Gossip Glomers - Unique IDs and BroadcastFly.io and Jepsen · required
Each challenge runs locally under Maelstrom (v0.2.4; the pages were tested on 0.2.3) with its checker and, where the page says so, the partition nemesis; keep the run directory as the history. Do challenge 2 (unique IDs under partition with total availability) and 3a to 3c (broadcast, then with partitions). A pass shows uniqueness or convergence in that run, not ordering or recency.
- Replicated Log and Stream Processor - Time and Membership SliceRoadmap-Final · support
Add incarnation IDs, logical timestamps, gossip membership, suspicion metrics and fenced ownership. Retain seeds and minimized traces for every false-failure or stale-actor case.
- AlgoMaster System Design practice - clock, gossip and lease drillsAlgoMaster · support
Use only the named problems: Advance a Lamport Logical Clock, Compare Two Vector Clocks, Update a Vector Clock on Receive, Advance a Hybrid Logical Clock, Simulate Gossip Rumor Spread and Implement a Lease Lock with Fencing Tokens. Each states its function signature and checks small deterministic cases.