Skip to main content

Module 5: Distributed Systems Fundamentals: Worked Examples

Example 1: Slow or Dead?

Problem. Node A sends a heartbeat to B and receives no reply before its timeout.

Wrong first attempt. Declare B dead. The same observation is compatible with B crashing, a delayed request, a delayed response, packet loss, scheduler pause, or a partition.

Correct reasoning. Treat the timeout as suspicion, not proof. Use leases or terms where appropriate, require quorum before exclusive action, fence stale actors, and make false suspicions recoverable.

Transfer question. Why can increasing the timeout reduce false positives but never make failure detection perfect in an asynchronous model?

Example 2: Lamport Clocks Order Events but Do Not Detect Concurrency

Process A emits a1 at logical time 1 and sends a message. B receives it and advances to 2 before emitting b1 at 3, so a1 -> b1. Separately, C emits c1 at time 1 with no causal path to either event.

Wrong first attempt. Since (1,C) sorts before (3,B), conclude c1 -> b1. Lamport timestamps provide an order consistent with causality, but timestamp order alone does not prove causality.

Correct reasoning. Use vector clocks or explicit dependency metadata when detecting concurrency matters; use Lamport clocks when a causality-respecting total order is sufficient.

Transfer question. Construct two vector timestamps that are incomparable and explain what that means.

Example 3: Raft Commits an Entry

In a five-node cluster, a leader appends an entry in its current term and receives matching acknowledgements from two followers. The entry is stored on three of five nodes, a majority, so the leader can advance commitIndex subject to Raft’s current-term commit rule and notify followers.

Wrong first attempt. Count an old-term entry on a majority and immediately declare it committed by counting replicas alone. Raft commits current-term entries by majority; earlier entries become committed indirectly when a later current-term entry is committed.

Transfer question. Why must a new leader contain every committed entry, and which voting restriction enforces this?

Completion Standard

  • Draw at least three indistinguishable timeout timelines.
  • Distinguish Lamport ordering from vector-clock concurrency detection.
  • Trace election term, log indexes, match indexes, and commit advancement for a five-node Raft scenario.