Skip to content
About
Main content
Distribution & Failure

Fault Tolerance & Delivery Semantics

What is the cheapest thing that can be safely done twice?

Who this mechanism is for: a developer who writes services, calls APIs, uses a database and a message queue, and has seen a request time out in production, but has never studied how distributed systems recover from failure. You do not need any background in consensus, transactions or storage internals. Every technical term is explained the first time it appears, and again in the glossary at the end.

The story we will follow

Wanjiru is a backend engineer at Mediflow, a company of about 60 engineers. Mediflow runs a platform for a network of clinics. A clinic sends a blood sample to a laboratory. The laboratory sends the result back. The platform stores the result, charges the patient's card, and sends the patient a text message (SMS): "Your results are ready." The service that does this is called results-intake. It reads lab results from a message log (a durable, ordered queue), and for each result it writes a row to the patient database, calls an external payment provider, and calls an external SMS provider. Dmitri, the site-reliability engineer (SRE) who also looks after the databases, owns the , the and the failover. Priya leads customer support and brings Wanjiru the complaints.

During one busy quarter, Wanjiru meets four problems, one at the start of each article below. Each problem looks like a bug. Each one is actually a consequence of a basic fact: when a message or a machine disappears, you cannot know what happened. At the end of each article we go back and solve her problem with the mechanisms of that part.

This is the main idea of this whole mechanism:

How this mechanism is organized

After that: a summary, hands-on labs, interview questions and a glossary.

The thing you recover from (the durable log, the replica, the backup) is Persistence & Durability's subject, and it bounds how much work you can lose. Recovery mechanisms is the act of redoing (it bounds how long you are down). Making a repeat harmless is the guarantee that redoing is safe (it bounds how many times an effect may land). Availability: masking a lost node is how a system keeps answering while a node is gone, without redoing anything.

What do I do, and what does each option cost?

Can I see it myself?

Can I reason about it under questioning?

Trade-offs

The tensions this mechanism takes a position on. Each recurs across mechanisms.

Show all 7 trade-offs
Recurring principles

Ideas this mechanism meets that keep coming back, mechanism after mechanism.

Show all 16 principles