Faults and Partial Failures
Why a distributed system can be half broken, why a missing reply tells you almost nothing, and the tools that keep it correct anyway: timeouts, retries with idempotency keys, circuit breakers and fencing tokens.
Overview
A program on one computer either works or it stops. A distributed system can do something worse: part of it can fail while the rest keeps running. This is a partial failure, and it is the reason distributed systems are hard.
One machine against many
On a single machine, a hardware fault usually stops the whole machine, so a bug shows up as a crash you can see. In a distributed system, one node can be down, slow or cut off while others are healthy. Worse, the working nodes often cannot tell which of these happened.
The contrast runs through everything. When something breaks on one machine, usually the whole program stops, and you can see the failure as a crash or an error. Across many machines on a network, one part fails while the rest keeps going, and often you cannot see the failure at all: you just hear nothing. One machine gives the same result for the same input nearly always; a distributed system does not, because timing and lost messages change the outcome. So on one machine you design by assuming it works and handling crashes, and on many machines you assume anything can fail at any moment.
Key concepts
- Partial failure
- Asynchronous network
- Timeout
- Idempotency key
- Exponential backoff with jitter
- Circuit breaker
- Fencing token
- Byzantine fault
Interview questions
- A call to a payment service times out. What do you do?
- How would you choose a timeout for calls to a dependency?
- Why can a garbage collection pause break a distributed lock, and how do you fix it?
- What is a circuit breaker, and when does it help?
- Why do most systems ignore Byzantine faults?
Sign up free to read the full topic
More DDIA topics
- Declarative vs Imperative Query Languages
- Encoding Formats: JSON, Protobuf, Avro, Thrift
- End-to-End Correctness and the Exactly-Once Myth
- Event Streams and Message Brokers
- Fan-Out and the Twitter Timeline Problem
- Fault Tolerance in Stream Processing
- Graph Data Models
- Implementing Serializability
- Isolation Levels
- Joins in Batch Processing
- Joins in Stream Processing
- Lambda and Kappa Architectures
Start free on Cariara · Coding problems · System design studio