Distributed Systems Primer: Partial Failure, Timeouts and the Vocabulary You Need


System Design Phase 3: Distributed Systems Fundamentals
Core Lesson 8 of 86 18 min read Updated Nov 30, 2026

Your checkout service calls the payment service to charge a customer 4,999 rupees. The call has a 3 second timeout. At 3.001 seconds the timeout fires and your code gets an error. Now answer one question: was the customer charged?

You cannot know. The request may never have arrived. It may have arrived, been processed and committed, and the reply was lost on the way back. The payment service may still be processing it right now, stuck behind a 5 second garbage collection pause, and will charge the card in two seconds. All three worlds look identical from where you sit: silence, then a timeout.

On a single machine this question never comes up. A function call either returns or the whole process dies with it. The moment a second machine and a network enter the picture, you get a new kind of failure that single-machine programming never prepared you for: one part of the system fails while the rest keeps running, and nobody can tell for sure which part it was.

That is the whole subject in one paragraph. Everything else in this phase (clocks, consistency models, CAP) and in the later coordination phase (quorums, consensus, leader election) is a set of tools for living with that uncertainty.

What a distributed system is

A distributed system is a set of programs running on separate machines that coordinate only by sending messages over a network, and that together try to look like one coherent service.

Three words carry most of the weight:

  • Node (or process): one running program with its own memory and its own clock. A node can be a VM, a container or a bare metal server. It cannot read another node’s memory.
  • Message: the only way nodes share information. Messages can be delayed, dropped, duplicated or reordered. A message that was sent is not a message that was received.
  • Partial failure: some nodes or links fail while others keep working. This is the defining property. Leslie Lamport’s well known joke captures it: a distributed system is one in which the failure of a computer you did not even know existed can render your own computer unusable.

You build distributed systems for three reasons: to hold more data or serve more traffic than one machine can (horizontal scaling), to survive the loss of a machine (availability), and to be close to users in different places (latency). Each reason buys you partial failure as the price.

How it works: the model you reason with

Engineers who are good at distributed systems carry a mental model with three parts: what the network does, what nodes do when they fail, and what you can assume about timing. Get these three right and most designs become easy to evaluate.

The network: eight fallacies

In the 1990s, L Peter Deutsch and colleagues at Sun Microsystems wrote down the assumptions that engineers new to distributed systems make, all of which turn out to be false. James Gosling later added the eighth. They are still the fastest way to review a design.

Fallacy What actually happens What you design for
The network is reliable Packets drop, links flap, switches reboot Retries, idempotency
Latency is zero A cross-region round trip costs tens of milliseconds Fewer round trips, batching
Bandwidth is infinite A 10 GB snapshot takes 80 s on a 1 Gbps link Compression, incremental sync
The network is secure Traffic inside the VPC can be read or spoofed mTLS, zero trust
Topology does not change Autoscaling and failover change it every hour Service discovery
There is one administrator Other teams, cloud providers and ISPs change things Defensive configs, contracts
Transport cost is zero Cross-AZ and egress traffic are billed per GB Locality-aware routing
The network is homogeneous Mixed hardware, kernels and protocol versions Versioned protocols

The first two do the most damage. “The network is reliable” is the root of the opening scenario. “Latency is zero” is why a design that makes 40 sequential calls to a service 1 ms away is fine and the same design across regions takes 3 seconds.

The nodes: failure models

A failure model is the contract for how a node is allowed to misbehave. Algorithms are proven correct only under a specific model, so you need to know which one your system actually lives in.

flowchart TB
CS["Crash-stop<br/>node halts and never returns"] --> CR["Crash-recovery<br/>node halts, restarts later<br/>with disk state, without memory"]
CR --> OM["Omission<br/>node runs but drops<br/>some messages"]
OM --> GR["Gray failure<br/>node looks healthy to probes<br/>but fails real work"]
GR --> BZ["Byzantine<br/>node can do anything,<br/>including lie"]
style CS fill:#E1F5EE,stroke:#0F6E56,color:#085041
style CR fill:#E1F5EE,stroke:#0F6E56,color:#085041
style OM fill:#FAEEDA,stroke:#854F0B,color:#633806
style GR fill:#FAEEDA,stroke:#854F0B,color:#633806
style BZ fill:#FCEBEB,stroke:#A32D2D,color:#791F1F

Read the diagram top to bottom as “harder to handle”:

  • Crash-stop: the node stops and stays stopped. The simplest model and the one most textbook proofs start with. Rarely the full truth in production.
  • Crash-recovery: the node stops, then comes back with whatever it wrote to disk and nothing it held in memory. This is the realistic model for databases. It is why a write is only durable after fsync, and why a node that rejoins must catch up before it serves reads. Raft and Paxos are designed for this model.
  • Omission: the node keeps running but some messages it sends or receives vanish. A full network buffer, a misconfigured firewall rule or a saturated NIC all look like this.
  • Gray failure: the node is partly broken in a way that the health check does not see. Microsoft researchers named this in a 2017 HotOS paper. Typical examples: a disk that serves health check reads from cache but takes 30 s for real writes, or a node whose control plane heartbeat is fine while its data plane drops 20% of requests. Gray failures are the most common cause of long outages in large fleets because the system keeps routing traffic to the sick node.
  • Byzantine: the node can behave arbitrarily, including sending different answers to different peers. Tolerating f Byzantine nodes needs at least 3f + 1 nodes, compared with 2f + 1 for crash faults. Inside one company’s datacenter you normally assume non-Byzantine nodes and handle corruption with checksums. Byzantine tolerance matters for blockchains and systems spanning mutually distrusting parties.

Timing: synchronous, asynchronous, partially synchronous

The third part of the model is what you assume about time. This is the part that decides which problems are even solvable.

  • Synchronous model: there is a known upper bound on message delay, on how long a step takes and on clock drift. If a reply has not arrived within the bound, the sender is definitely dead. Failure detection is perfect. Real networks are not like this.
  • Asynchronous model: no bounds at all. A message can take any finite time. A node can pause for any finite time. You cannot use time to learn anything. This is the pessimistic model, and the one in which the strongest impossibility results are proven.
  • Partially synchronous model (Dwork, Lynch and Stockmeyer, 1988): the system behaves asynchronously for a while, but eventually there is a period in which bounds hold, and you do not know when that period starts. This matches production well: most of the time packets arrive in under a millisecond, and occasionally a GC pause, a VM migration or a congested switch stretches that to seconds.

Practical algorithms such as Raft are designed for partial synchrony. They are safe under full asynchrony (they never return a wrong answer, however bad the delays) and live only during the well-behaved periods (they make progress when the network calms down).

Timeouts are the only failure detector you have

Put the three parts together and you reach the central fact of the field. A node cannot observe another node’s state. It can only observe messages, or their absence. So the only way to decide that a peer has failed is to wait some amount of time and give up. Every failure detector, from a TCP keepalive to Kubernetes node health to Cassandra’s phi accrual detector, is a timeout with extra steps.

sequenceDiagram
participant C as Caller
participant S as Server
C->>S: request
Note over S: World 1, request lost in network
Note over S: World 2, server crashed after commit
Note over S: World 3, server paused by 5 s GC
Note over C: 3 s timeout fires
C-->>C: error, but which world?

And a timeout cannot tell slow from dead. If you set it short, you declare healthy but slow nodes dead, which triggers needless failovers and can create two leaders at once. If you set it long, real failures take a long time to detect and requests pile up. There is no value that is correct for every situation, only a trade-off you choose on purpose. How to pick that value, and how to retry safely afterwards, is covered in timeouts, retries and backoff. Smarter detectors that gossip suspicion between nodes are covered in gossip and failure detection.

The vocabulary every later article uses

These terms show up in nearly every article from here on. Each gets a one-paragraph intuition here and a full article later.

Replica. A copy of the same data on another node. Replicas exist for availability (lose one, serve from another) and for read capacity. The hard part is keeping them in agreement while writes keep arriving. How replicas receive writes (one leader, many leaders, or no leader) is the subject of replication strategies.

Replication lag. The time between a write landing on one replica and appearing on another. With asynchronous replication it is usually milliseconds and occasionally minutes. Lag is what makes a user’s own post vanish on refresh. Consistency models describe what readers are allowed to see while lag exists.

Partition (two meanings). Be careful, the word is overloaded. A network partition is a failure in which some nodes can talk to each other but not to the rest, so the cluster splits into groups. A data partition (or shard) is a slice of the dataset assigned to some nodes on purpose, covered in sharding and partitioning. CAP is about the first kind.

Quorum. A subset of replicas large enough that any two such subsets overlap. With 5 replicas, any 3 form a majority, and any two majorities share at least one node. That shared node is how information from a write reaches a later read without asking every replica. Quorums let a system keep working when a minority is down. The math of read and write quorums (N, W, R) and why overlap alone does not give you linearizability lives in quorums and sloppy quorums.

Try it at intuition level below: set N to 5, then lower W and R until the read set can miss the latest write.

Quorum explorer: N, W, R

Drop W or R until R + W is no longer greater than N and watch the read set miss the write.

Acked the write (has v2) Answered the read Overlap: read sees v2

R + W vs N
Guaranteed overlap
Writes survive
Reads survive

Overlap is not linearizability. Sloppy quorums with hinted handoff can ack a write on nodes outside the home replicas, two concurrent writes can both reach W and need a conflict rule such as last write wins (which silently drops one), and a read that sees v2 on one node and v1 on another still needs read repair. Overlap only guarantees that some reply carries the latest acknowledged write.

Consensus. Getting a group of nodes to agree on one value (or one ordered log of values) even when some crash. Consensus is how a cluster elects a single leader, commits a configuration change, or agrees on the order of writes. Raft and Paxos are covered in distributed consensus.

Leader and split brain. Many systems route all writes for a piece of data through one node, the leader. If the old leader is merely slow, gets declared dead, and keeps acting as leader after a new one is elected, you have split brain: two nodes accepting conflicting writes. Leases and fencing tokens that prevent this live in leader election.

Idempotency. An operation is idempotent if doing it twice has the same effect as doing it once. Because timeouts make you retry operations that may already have succeeded, idempotency is how you make retries safe. It is the actual answer to the opening scenario: send the payment request with an idempotency key, and retry freely. See idempotency.

FLP: why consensus cannot be guaranteed

In 1985 Fischer, Lynch and Paterson proved a result now called FLP: in the fully asynchronous model, no deterministic algorithm can guarantee that a group of nodes reaches consensus if even one node may crash.

The intuition is the slow versus dead problem again. Any algorithm eventually has to decide whether to wait for a silent node or move on without it. If it waits, the node might be dead, and it waits forever. If it moves on, the node might be alive and about to send the message that would have changed the outcome. In a fully asynchronous system there is always some schedule of delays that keeps the algorithm stuck on that fork.

FLP does not say consensus is impossible in practice. It says you must give something up, and real systems choose what:

  • Assume partial synchrony. Raft and Paxos never decide wrongly, but may stall during bad periods and resume when timeouts start working again.
  • Use randomization. Randomized election timeouts (Raft) or randomized protocols make an infinite stall vanishingly unlikely.
  • Use a failure detector. Accept that it can be wrong, and design the algorithm so a wrong suspicion costs liveness, not safety.

Where it breaks

Treating a timeout as “it failed”. A timeout means “I do not know”. Retrying a non-idempotent operation after a timeout is the most common source of duplicate charges, duplicate emails and double-counted inventory.

Assuming failures are independent. Replicas in the same rack share a switch. Nodes deployed from the same bad config fail together. Three replicas in one availability zone give much less protection than the 3-way arithmetic suggests. Spread replicas across failure domains.

Assuming clocks agree. Two nodes’ clocks can differ by milliseconds or, after a bad NTP sync, by seconds. Ordering events by wall-clock timestamp across machines silently loses writes. The next article, time, clocks and ordering, is entirely about this.

Process pauses. A node can be frozen for seconds by GC, VM migration or swapping, then resume and act on stale beliefs, such as “I am still the leader” or “my lock is still valid”. From the inside, no time seemed to pass.

Asymmetric partitions. Node A can reach B, but B cannot reach A. Or A can reach the coordinator but not its peers. Many failover bugs come from assuming partitions are clean two-sided splits.

Retry storms. When a dependency slows down, every client times out and retries, multiplying load on the thing that was already struggling. Partial failure turns into total failure. This is why backoff, jitter and retry budgets exist.

Real-world systems

Some verifiable behaviours that show the ideas above in practice:

  • etcd and ZooKeeper run consensus among 3 or 5 members and stay writable as long as a majority (2 of 3, 3 of 5) can talk to each other. A minority side of a network partition stops accepting writes. That is the quorum idea applied directly.
  • Kubernetes marks a node NotReady only after its kubelet stops reporting for a grace period, which is a heartbeat timeout. By default, pods on an unreachable node are evicted after a 300 s toleration and Deployment replacements are scheduled elsewhere, while the originals may still be running on the partitioned node. StatefulSets deliberately do not start a replacement until the old pod is confirmed gone, to avoid two pods with the same identity.
  • Cassandra uses a phi accrual failure detector, which outputs a suspicion level based on the observed distribution of heartbeat intervals instead of a fixed timeout. It is still a timeout underneath, just adaptive.
  • Amazon DynamoDB replicates each partition across three availability zones and uses a Multi-Paxos based leader per partition, so a single AZ failure leaves a majority to keep accepting writes.
  • TCP itself only detects a dead peer through retransmission timeouts or keepalives. A half-open connection, where one side vanished without a FIN, can sit idle for hours with default keepalive settings.

How to apply it

When you design or review any component that talks over a network, run this checklist:

  1. For every remote call, what happens on timeout? Is the operation idempotent, or does it carry an idempotency key? Who retries, and with what backoff?
  2. What is the failure model? Crash-recovery for anything with a disk. Assume gray failures exist and detect them from client-side signals, not only health checks.
  3. What timing assumption keeps it safe? If the design is only correct when clocks agree or when messages arrive within 1 s, write that down. Prefer designs that stay safe without timing assumptions and only lose liveness.
  4. What does a minority partition do? Stop accepting writes (consistent), or keep accepting them and reconcile later (available)? This is the CAP choice, and you make it per piece of data.
  5. Are the replicas in different failure domains? Different hosts, racks, zones. Compute quorum survival against correlated failures, not independent ones.
  6. How big is the quorum? Odd sizes are the norm: 3 nodes tolerate 1 failure, 5 tolerate 2. Going from 3 to 4 adds cost without adding tolerance.
Cluster size Majority Crash failures tolerated Byzantine tolerated (needs 3f+1)
3 2 1 0
4 3 1 1
5 3 2 1
7 4 3 2

Interview angle

Interview questions

Q1: Why can’t a node reliably detect that another node has crashed?

Model answer: Because nodes only learn about each other through messages, and in a real network message delay has no fixed upper bound. When a peer stops responding, the cause could be a crash, a network partition, a lost message or a long pause such as GC. All of these look identical from outside: no reply. So every failure detector is a timeout, and a timeout trades detection speed against false positives. A short timeout declares slow nodes dead and triggers needless failovers or split brain. A long one leaves real failures undetected. Systems therefore treat failure detection as a hint for liveness and protect safety separately, for example with quorums and fencing tokens.

Q2: What does FLP say, and why do Raft and Paxos still work?

Model answer: FLP (1985) proves that in a fully asynchronous system, no deterministic protocol can guarantee consensus terminates if even one process can crash, because the protocol can never tell a crashed process from a slow one. Raft and Paxos sidestep it by always guaranteeing safety (never two different decided values) while only guaranteeing liveness under partial synchrony, when message delays are eventually bounded. They also use randomized timeouts to make endless election races unlikely. In bad network periods they may stall, but they never decide wrongly.

Q3: You have a 5-node cluster. Two nodes are in zone A, two in zone B, one in zone C. Zone A loses connectivity to the others. What happens, and how would you change the layout?

Model answer: Zone A’s two nodes are a minority (2 of 5), so they can no longer form a majority and should stop accepting writes. Zones B and C together have 3 of 5, a majority, so they elect or keep a leader and continue. The layout is reasonable: losing any single zone leaves at least 3 nodes. The weak point is zone C holding a single node: if zone B fails while zone C is also degraded, you lose quorum. A 2-2-1 spread across three zones is the standard answer for 5 nodes, and the real improvement would be making sure the zones do not share hidden dependencies such as the same network spine or the same deployment wave.

✅ Key takeaways

  • The defining property of a distributed system is partial failure: some parts break while others run, and nobody knows for sure which.
  • Nodes learn about each other only through messages, so the only failure detector is a timeout, and a timeout cannot tell slow from dead.
  • Know your failure model: crash-recovery for anything with a disk, and assume gray failures exist that health checks will miss.
  • Real systems live in partial synchrony: algorithms stay safe always and make progress only when the network behaves.
  • Quorums work because any two majorities overlap; FLP says you cannot guarantee consensus termination, so practical protocols give up liveness, never safety.
  • A timeout means “I do not know”, so every retried operation needs idempotency.

🧠 Check your understanding

0 / 4
  1. 1A client calls a service with a 2 s timeout and gets a timeout error. What can it conclude?

  2. 2Which failure model best describes a node whose health check returns 200 while 20 percent of its real requests fail?

  3. 3How many nodes do you need to tolerate 2 crash failures with majority quorums?

  4. 4What does the FLP result actually imply for Raft?

Where to go next

Finished this lesson?

Mark it complete to track your progress across the roadmap.