interviewpath
  • 0day streak
  • 10total XP
  • Level 1
0/6

Unit 5 · Distributed & cloud · Lesson 1 of 14

Failure models, partial failure and timeouts

Distributed systems fail partially: one node crashes, a link drops messages, a process pauses, and the caller often cannot tell which happened. The standard fault models and the ambiguity of timeouts underpin every later topic, from retries to consensus, and every failure discussion in a design interview.
About 4 hFocus mode

Step 1: Learn the ideas

  • Partial failure versus whole-machine failure
  • Crash-stop, crash-recovery and omission faults
  • Byzantine faults (awareness) and why typical datacenter systems exclude them
  • Synchronous, partially synchronous and asynchronous timing models
  • Network partitions, including asymmetric and partial ones
  • Timeouts, failure detectors and false suspicion
  • Ambiguous outcomes: did the write happen?
  • Process pauses (garbage collection, VM migration) as failures
  • Gray failure and fail-slow components
  • Safety versus liveness under each model

Why it matters

On one machine, a component usually either works or the whole program dies. In a distributed system, parts fail independently: one replica crashes, a switch drops a fraction of packets, a process freezes for seconds during garbage collection, a disk becomes slow without dying. The caller observes only silence or delay, and silence is ambiguous. Nearly every hard question in this domain (is it safe to retry, who is the leader, do I still hold this lock) reduces to that ambiguity, which is why failure reasoning is where memorized architectures and defensible designs part ways.

Core ideas

Fault models say what a failed component may do:

  • Crash-stop: the node halts and never returns. Easiest to reason about, rarely the whole truth.
  • Crash-recovery: the node halts and restarts later with only what it had made durable. Protocols must therefore state what is persisted before acknowledging; a vote or log entry kept only in memory can be forgotten and then contradicted.
  • Omission: messages are lost while the node keeps running. Retransmission hides this at the cost of duplicates and reordering.
  • Byzantine: a node may behave arbitrarily, including sending conflicting messages. Classic protocols need 3f+1 replicas to tolerate f such nodes. Typical datacenter systems assume non-Byzantine nodes and handle corruption with checksums, authentication and validation instead; awareness is enough here.

Timing models matter as much. In an asynchronous model nothing bounds message delay or processing time, so a slow node cannot be told apart from a crashed one, and the FLP result shows that no deterministic consensus protocol can guarantee termination if even one process may crash. Practical systems assume partial synchrony: bounds hold most of the time, so they keep safety unconditional and make progress only while the network behaves.

A timeout is a guess. When a request times out, it may have been lost, it may have executed with the reply lost, or it may still be running and take effect later:

Failure pointServer state afterwardsWhat the client sees
Request lostunchangedtimeout
Server crashes before applyingunchanged, or partly applied if not atomictimeout or reset
Applied, reply lostchangedtimeout
Server slow or queuedchanges latertimeout, then a late effect

These rows look identical to the caller, so a retry is safe only for idempotent or deduplicated operations, and the honest result of an API call is sometimes "unknown".

Partitions split nodes into groups that cannot communicate, possibly asymmetrically (A hears B, B does not hear A). Each side may conclude the other is dead. If both sides keep acting as leader or lock holder you get split brain; requiring a majority keeps one side safe and makes the other unavailable.

Detection is a tradeoff. Short timeouts detect crashes quickly but suspect healthy nodes during load spikes, triggering failovers that add more load. Long timeouts avoid false suspicion but leave requests stuck. Derive timeouts from measured latency (a high percentile plus margin), and make every action taken on suspicion safe even if the suspicion is wrong.

Gray failure is the common middle ground: a node passes health checks but fails or crawls on some requests. Fail-slow components often hurt more than crashed ones because nothing removes them automatically.

Common misconceptions

  • "A timeout means the operation failed." It means the caller stopped waiting. The operation may have completed; treat the outcome as unknown until confirmed.
  • "TCP makes the network reliable." TCP retransmits and orders bytes within one connection. It cannot tell you whether the remote application processed a request before the connection broke, and it does not survive process crashes.
  • "Crash-recovery is just crash-stop plus a restart." A restarted node that forgot an in-memory promise (a vote, a lease, an acknowledged write) can violate safety. What is flushed to disk before replying is part of the protocol.
  • "Partitions are rare, so handle them later." Partial connectivity, overloaded links and long pauses produce the same symptoms routinely; the design must say what each side does while it cannot reach the others.
  • "We can detect failures accurately." In an asynchronous network no detector is both always accurate and always complete. Detectors are tuned, and protocols must stay correct under false suspicion.

How to approach it

Start with DDIA's chapter on the trouble with distributed systems, then make it concrete: for one request path you know (a payment, a booking, sending an outreach message) write the failure-mode table and decide what the client must do for each row. Graduates are expected to recognize partial failure and the ambiguity of timeouts. Mid-level candidates should raise failure handling unprompted and propose idempotency or fencing where needed. Senior candidates should name the assumptions (fault model, timing, clocks) under which a design is safe and say what happens when each is violated. In code, the MapReduce lab trains recovery by re-execution and the key/value lab makes you return "maybe" for a retransmitted write.

Suggested order

  1. 1Read DDIA Ch. 8 (The Trouble with Distributed Systems), sections "Faults and Partial Failures", "Unreliable Networks" and "Knowledge, Truth, and Lies", listing every assumption the author names.
  2. 2Read the Builders' Library article "Challenges with distributed systems" and list the request-reply failure points it identifies.
  3. 3Skim OSTEP Ch. 48 (Distributed Systems) for timeout, retry and duplicate detection, then the 6.5840 LEC 2 notes on RPC failures and at-most-once semantics.
  4. 4Write a failure-mode table for a payment or message-send API: failure point, server state, client observation and the safe client action.
  5. 5Do 6.5840 Lab 2 (key/value server) through the unreliable-network tests, noting exactly when a retransmitted Put must report an unknown outcome.
  6. 6Optionally do 6.5840 Lab 1 (MapReduce) or the first Gossip Glomers challenges to practice re-execution and partition tolerance in code.

Step 2: Check off what you can do

Tap each one you can genuinely do or explain. Each earns 10 XP.

Step 3: Go deeper

  • Designing Data-Intensive ApplicationsStart here

    O'Reilly Media (author's book site)

    Section: Ch. 8: The Trouble with Distributed Systems

    Primary explanation of partial failure, unreliable networks, timeouts, process pauses and system models.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Challenges with distributed systemsStart here

    Amazon Builders' Library

    Step-by-step breakdown of how one request-reply can fail, including the unknown outcome; a template for failure-mode tables.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Operating Systems: Three Easy Pieces

    University of Wisconsin–Madison (free online book)

    Section: Ch. 48: Distributed Systems

    Short refresher on unreliable communication: timeout and retry, duplicate detection with sequence counters, and choosing timeout values.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • MIT 6.5840 Distributed Systems

    MIT PDOS

    Section: LEC 2: RPC and Threads (lecture notes)

    How an RPC layer handles failures and what at-most-once semantics require from the server.

    Open(opens in a new tab)Link responded, 5 Oct 2026

Step 4: Practice

Start with the key/value lab: its unreliable-network tests force you to decide what a retried write may report. Then do MapReduce for crash recovery by re-execution, or the first Gossip Glomers challenges if you prefer another language. As a non-coding drill, write failure-mode tables for two APIs (capturing a payment and sending an email): each failure point, the resulting server state, what the client observes and the safe client action. Check your tables against DDIA Ch. 8.

Record attempts on each problem’s page (+15 XP, +10 more when solved on your own).

Step 5: Test yourself

Answer each one out loud or on paper before you finish the lesson.

  1. Question 1What are the possible server states when a client times out on a write, and how should the client proceed in each?
  2. Question 2Why can a crash-recovery node violate a protocol that is safe under crash-stop?
  3. Question 3What does a long garbage-collection pause look like to the rest of the cluster?
  4. Question 4How would you set a timeout for a dependency whose p99 is 80 ms but which occasionally stalls for 2 s?
  5. Question 5What is an asymmetric partition and what can it do to leader election?
  6. Question 6Why do typical datacenter systems not tolerate Byzantine faults, and what do they do about corruption instead?

You’re done when you can

  • Write a complete failure-mode table for a request that crosses one network hop in under 10 minutes, including the unknown-outcome case.
  • Explain without notes why no timeout value can distinguish a crashed node from a slow one in an asynchronous network.
  • State the fault and timing model assumed by one system you have studied and give a concrete event that would violate it.
  • Pass the unreliable-network tests of the 6.5840 key/value lab or complete an equivalent exercise.

Finish the lesson

How confident do you feel?

Lesson complete!

+50 XP

Reviews will come up on the Practice tab so it sticks.

Unlocks next: Consistency models and isolation guarantees, Clocks, ordering, leases and fencing, Partitioning, hot keys and caching, Delivery semantics, deduplication and the outbox pattern, Retries, deadlines, overload and graceful degradation

Your notes and study time

Log study time