Why Distributed Systems Are Hard
What makes distribution fundamentally different — partial failure, unreliable networks, unreliable clocks, no shared memory — the fallacies of distributed computing, failure models, and the two generals problem.
A distributed system is a set of computers that communicate over a network and coordinate to appear as one system: a database cluster, a microservice architecture, a CDN, a blockchain. We distribute for scale (more than one machine can handle), fault tolerance (survive machine failures), and latency (be close to users). The price is a set of problems that don't exist on a single machine.
The core difficulty: partial failure
On one computer, things usually work or crash entirely. In a distributed system, some parts fail while others keep running — and you often can't tell which.
You send a request and get no response. Did:
- the request get lost in the network?
- the remote node crash before processing it?
- the node process it, then crash before replying?
- the node process it, and the response got lost?
- the node just be slow (GC pause, overload) — and the response is still coming?
From the sender's side, all five look identical: silence. The only tool is a timeout, and a timeout can't distinguish "dead" from "slow". Retrying may duplicate work (case 3, 4, 5), not retrying may lose it (case 1, 2). This is why idempotency matters so much.
Three unreliable things
| Problem | Consequence | |
|---|---|---|
| Network | Messages can be lost, delayed (arbitrarily), duplicated, reordered; links can partition | No way to know if a message arrived without an acknowledgement — which can itself be lost |
| Clocks | Each machine's clock drifts; NTP corrections make clocks jump; VM pauses freeze time | Timestamps from different machines can't reliably order events (Clocks & ordering) |
| Processes | Nodes crash, restart, or pause (GC, VM migration, swapping) for seconds | A node may believe it's still the leader after being declared dead |
The fallacies of distributed computing
Peter Deutsch and colleagues at Sun listed assumptions newcomers make that are false:
- The network is reliable.
- Latency is zero.
- Bandwidth is infinite.
- The network is secure.
- Topology doesn't change.
- There is one administrator.
- Transport cost is zero.
- The network is homogeneous.
Every one of these leads to real outages when designs quietly assume it.
Failure models
How badly can a node misbehave? Algorithms are designed for a specific model:
| Model | Nodes may… | Example algorithms |
|---|---|---|
| Crash-stop | Stop and never come back | Basic textbook algorithms |
| Crash-recovery | Crash and restart, losing in-memory state (durable storage survives) | Raft, Paxos — the practical default |
| Omission | Fail to send or receive some messages | |
| Byzantine | Behave arbitrarily: lie, send conflicting messages, act maliciously | PBFT, blockchain consensus |
Most data-centre systems assume crash-recovery and non-Byzantine nodes (you trust your own servers). Byzantine fault tolerance needs at least 3f + 1 nodes to tolerate f traitors, and is used where participants don't trust each other.
Timing models
- Synchronous: known bounds on message delay and processing time. Easy to reason about, unrealistic.
- Asynchronous: no timing bounds at all. Realistic but limiting: the FLP impossibility result proves no deterministic consensus algorithm can guarantee termination if even one process may crash.
- Partially synchronous: the system behaves asynchronously sometimes but is eventually well-behaved. Real algorithms (Raft, Paxos) are safe always and live (make progress) when the network behaves.
The two generals problem
Two armies on opposite hills must attack at the same time to win. They communicate by messengers who may be captured. General A sends "attack at dawn". Did B receive it? B sends an acknowledgement — but did A receive that? A acknowledges the acknowledgement… No finite number of messages gives both certainty.
It proves that agreement over an unreliable channel can't be guaranteed with certainty. Practical systems accept probabilistic guarantees and design around uncertainty (TCP's handshake is "good enough", not perfect).
What we build on top
The rest of this track covers the tools that tame these problems:
- Replication for fault tolerance, and the consistency models that describe what readers see (Consistency models).
- The CAP/PACELC trade-offs (CAP & PACELC).
- Logical clocks for ordering (Clocks & ordering).
- Consensus for agreeing despite failures (Consensus & Raft).
- Distributed transactions and CRDTs for coordinating data.
- Distribution brings scale, fault tolerance and locality — at the price of partial failure.
- A timeout can't distinguish a dead node from a slow one or a lost reply; design for idempotent retries.
- Networks, clocks and processes are all unreliable; process pauses require fencing tokens.
- Know the eight fallacies; most outages come from violating one.
- Crash-recovery is the usual failure model; Byzantine tolerance needs 3f + 1 nodes.
- FLP and two generals show perfect agreement is impossible; real systems stay safe and are live when the network cooperates.