Distributed systems

Hand-drawn five segmented terracotta ribbons that start at scattered heights on the left, one broken by a short gap, and run side by side on the right, over islands of cream, sand, umber and moss cross-hatching separated by thin cream channels.

A distributed system is a set of components on networked computers that coordinate by passing messages (Coulouris et al., n.d.). What it can guarantee depends on how long messages may take and what a failing computer may do, and under weak assumptions some guarantees are impossible. No deterministic protocol can always reach agreement if one process may crash, and a shared read/write object cannot guarantee both consistency and availability when messages can be lost (Dwork et al., 1988; Fischer et al., 1985; Gilbert & Lynch, 2002). In practice, systems also fail in ways the classic models leave out: hardware that runs slowly, and failures that monitors miss while applications suffer (Gunawi et al., 2018; Huang et al., 2017a). The main disputes concern whether Raft is easier to understand than Paxos, how representative failure studies are, and how much operational advice rests on measurement.

System models: timing and failure

Every result in the field holds for a stated model, which fixes two things: timing and how components fail. A synchronous system has known fixed upper bounds on message delay and on the relative speed of processors; an asynchronous system has no such bounds (Dwork et al., 1988).

Partial synchrony sits between the two. In one version the bounds are known but hold only from some unknown time onward; in another a bound always holds but its value is not known in advance (Dwork et al., 1988).

Failure models range from a clean stop to arbitrary behaviour. A fail-stop process runs correctly until it halts for good. Under omission, a faulty process follows its protocol but acts as if it received only some of its messages. A Byzantine process may do anything at all (Dwork et al., 1988).

Studies of production systems add failures that sit outside these categories. Fail-slow hardware keeps working, but at an unexpectedly degraded speed (Gunawi et al., 2018). In a gray failure, the system’s own failure detectors miss a problem that applications experience (Huang et al., 2017a).

Impossibility results and trade-offs

The field’s best-known results say what no protocol can do under a given model,.

Consensus and the FLP result

Consensus means getting several processes to agree on one value even though some may fail. The FLP result, named for Fischer, Lynch and Paterson, concerns asynchronous systems. There, any deterministic consensus protocol has some execution that never decides, even if at most one process can crash and every message eventually arrives (Fischer et al., 1985).

Two routes escape the result. Ben-Or’s protocol uses random choices and reaches agreement with probability one if fewer than half the processes can crash. The original protocols may, however, need exponentially many rounds on average (Ben-Or, 1983). The other route adds timing assumptions, such as bounds that hold after an unknown stabilisation time (Dwork et al., 1988).

A related result concerns coordination itself. The Two Generals problem shows that no protocol can guarantee a coordinated action when the channel can lose any number of messages (Halpern & Moses, 1990).

CAP and PACELC

The CAP theorem has a precise formal statement. Gilbert and Lynch proved that a read/write data object cannot guarantee both atomic consistency and availability in every fair execution, including executions where the network loses arbitrary messages (Gilbert & Lynch, 2002). Atomic consistency, also called linearizability, means all operations appear in a single order that respects real time and returns valid values (Viotti & Vukolić, 2016). Availability here means every request reaching a non-failing node eventually gets a response (Gilbert & Lynch, 2002).

The choice is not one switch for a whole system. Brewer writes that it can vary by subsystem, operation, data or user (Brewer, 2012). Weaker guarantees remain possible. In the highly available transactions model, a client that keeps using the same replicas (sticky availability) can get causal consistency, but not snapshot isolation or serializability (Bailis et al., 2013).

PACELC adds what CAP leaves out. During a partition (P) a system trades availability (A) against consistency (C); else (E), in ordinary operation, it trades latency (L) against consistency (C) (Abadi, 2012).

Time and ordering

Systems order events either by cause and effect, using logical clocks, or by physical clocks with a stated uncertainty (Lamport, 1978; Corbett et al., 2013).

Logical clocks capture cause and effect without physical time. Lamport’s clock gives a cause an earlier timestamp than its effect, but an earlier timestamp does not show that one event caused the other (Lamport, 1978). Vector clocks keep the full causal relationship, so a system can tell events that are ordered from events that are concurrent (Mattern, 1989). Hybrid logical clocks keep Lamport’s one-way guarantee while staying close to physical time (Kulkarni et al., 2014).

Physical clocks can be used safely if the system knows how wrong they might be. Google’s Spanner database reports clock time with an uncertainty, and waits to expose a commit until its timestamp has surely passed (Corbett et al., 2013). That wait cost about 5 ms in a one-replica benchmark, against about 9 ms for the replication protocol itself (Corbett et al., 2012).

How large clock uncertainty is depends on the deployment and on how it is measured. Spanner reports a typical uncertainty of about 1 to 7 ms over each poll interval, sampled just after polls, so drift between polls is left out (Corbett et al., 2013). A study of supercomputers synchronised with NTP found worst-case gaps over 600 ms between some nodes, while the Sundial datacenter system reported about 100 ns under tested failures (Jones et al., 2017a; Li et al., 2020c). When uncertainty grows, Spanner stays correct by waiting longer, at a possible cost in speed (Corbett et al., 2013).

Consensus and replication protocols

Replication keeps copies of data on several machines so that the system survives the loss of some of them. The protocols that keep copies in step differ in who orders the operations and how a failed primary is replaced (Ongaro & Ousterhout, 2014; Oki & Liskov, 1988).

ProtocolHow operations are ordered
PaxosA majority of acceptors chooses a numbered proposal; later chosen proposals must keep its value (Lamport, 2001)
RaftA strong leader; log entries flow only from the leader to other servers (Ongaro & Ousterhout, 2014)
Viewstamped ReplicationA primary copy, with a backup promoted if the primary crashes (Oki & Liskov, 1988)
ZabZooKeeper’s broadcast protocol keeps the primary’s order and allows several transactions in flight (Junqueira et al., 2011)
Chain replicationThe head of a chain orders updates; the tail answers queries (van Renesse & Schneider, 2004)

Practical Byzantine Fault Tolerance (PBFT) tolerates replicas that misbehave arbitrarily, and its authors ran it as a replicated network file service (Castro & Liskov, 1999).

Is Raft easier to understand? Weak evidence: few or small studies support this

The claim that Raft is easier to understand than Paxos rests on one study by Raft’s designers, which others read differently. In it, 33 of 43 participants scored higher on a Raft quiz than on a Paxos quiz (Ongaro & Ousterhout, 2014). Ongaro notes that the result assumes the two lectures were equally good and the two quizzes equally hard (Ongaro, 2014).

Howard and Mortier suggest that Raft’s clarity may owe much to how its paper presents it rather than to the protocol (Howard & Mortier, 2020). Another team independently reimplemented Raft in OCaml to repeat its performance evaluation (Howard et al., 2015).

Consistency models and isolation levels

A consistency model states what readers and writers may observe when data is copied across machines. In tests, a database’s label for a guarantee sometimes did not match what it did.

For single operations, the main models are:

ModelWhat it guarantees
LinearizabilityOne order of operations that respects real time (Viotti & Vukolić, 2016)
Sequential consistencyOne agreed order that preserves each client’s own order (Viotti & Vukolić, 2016)
Causal consistencyReplicas agree on the order of operations that depend on each other (Viotti & Vukolić, 2016)
Eventual consistencyReplicas converge if updates stop (Viotti & Vukolić, 2016)

Isolation levels make the same kind of promise for whole transactions. Serializability, as PostgreSQL defines it, means transactions behave as if they ran one at a time (Kingsbury, 2020). Under the weaker snapshot isolation, each transaction reads a fixed snapshot of committed data (Kingsbury, 2020). Snapshot isolation permits write skew: two transactions read the same state and make changes that together break a rule neither breaks alone (Berenson et al., 1995).

Tests find gaps between labels and behaviour. Oracle’s level named “serializable” behaved as snapshot isolation in the Hermitage tests (Kleppmann, 2014). The Jepsen tests found serializability violations in PostgreSQL 12.3 during normal operation, and version 12.4 fixed a serializable conflict-checking bug (Kingsbury, 2020; PostgreSQL Global Development Group, 2020). Under the same “repeatable read” label, TiDB and MySQL took their snapshots at different points (Cui et al., 2022).

Partitioning and distributed transactions

Partitioning splits data across machines so that each holds only part of it; a transaction that touches several partitions must then coordinate them. The designs differ in when that coordination happens and what it costs (Gray & Lamport, 2006; Thomson et al., 2012).

The classic method, two-phase commit, asks every participant whether it can commit and then tells all of them the outcome. It can block when its single coordinator fails (Gray & Lamport, 2006). Spanner splits its data among replication groups that each run Paxos, and runs two-phase commit between the group leaders (Corbett et al., 2012).

Other designs move or weaken the coordination. Calvin fixes the order of transactions before running them, which removes the distributed commit protocol but requires knowing each transaction’s full set of reads and writes in advance (Thomson et al., 2012). Google’s Percolator offers snapshot isolation across rows and tables, but cleaning up locks left by failed workers can delay a commit by tens of seconds (Peng & Dabek, 2010).

Systems that let clients see divergence

Some large storage systems accept weaker guarantees and leave the client to handle copies that disagree. Amazon’s Dynamo writes to the first healthy nodes on a key’s list when preferred nodes are unreachable, and may return several conflicting versions for the application to reconcile (DeCandia et al., 2007). Conflicts were rare in one measurement: over 24 hours of its shopping-cart service, 99.94% of requests saw exactly one version (DeCandia et al., 2007).

The Google File System keeps three copies of each chunk by default, and a retried append can leave duplicate records or fragments in some copies (Ghemawat et al., 2003). The Domain Name System (DNS) copies each zone to several servers and lets answers be cached. Shorter cache lifetimes shorten inconsistency, while longer ones cut traffic and can hide a server that is briefly down (Mockapetris & Dunlap, 1988).

Avoiding coordination

Some computations need no coordination at all, and theory says which ones. The CALM line of work links monotone queries, whose conclusions never need retracting as more input arrives, to computation without coordination in a formal model (Ameloot et al., 2010).

Invariant confluence carries the idea to databases. An invariant is a rule the data must always satisfy. Suppose that merging any two valid states grown from a common state always satisfies the rule. Then the rule can be kept without coordination, and in the model this condition is also necessary (Bailis et al., 2014). A prototype built this way ran over 12.7 million TPC-C New-Order transactions per second on 200 servers (Bailis et al., 2014).

The guarantee is only as complete as the rules a developer states: the analysis protects against violations of the invariants it was given and no others (Bailis et al., 2014). Data types designed to merge without coordination are covered in Local-first software and Merging concurrent edits.

How production systems fail

Studies of real failures describe recurring patterns: mishandled errors, partial network partitions, half-working components, and overloads that sustain themselves (Yuan et al., 2014; Alquraan et al., 2018; Lou et al., 2020; Huang et al., 2022).

Most catastrophic failures in one study came from mishandling errors the software had already reported. Among 198 user-reported failures in Cassandra, HBase, HDFS, Hadoop MapReduce and Redis, 92% of the catastrophic ones came from incorrect handling of non-fatal errors (Yuan et al., 2014).

Network partitions can do lasting damage, and some cut off only part of the network. In a study of 136 partition failures across 25 systems, 21% left a wrong state that persisted after the network healed. In all, 29% involved partial partitions, where nodes reach some peers but not others (Alquraan et al., 2018). A 2020 study found that partially cutting off a single node could cause failures, including data loss (Alfatafta et al., 2020).

Partial and gray failures often arise only in production. Of 100 partial failures in five mature systems, 71% were triggered by conditions specific to production (Lou et al., 2020). Detectors that watch what callers experience, or that check a component’s internal work, caught most such failures in reproductions. Panorama detected all 15 reproduced gray failures in under 7 seconds, against one within 300 seconds for existing approaches. Generated watchdogs detected 20 of 22 partial failures (Huang et al., 2018a; Lou et al., 2020).

Metastable failures

A metastable failure starts with a trigger and then sustains itself after the trigger is gone (Bronson et al., 2021). A study of 22 such failures across 11 organisations distinguished triggers that add load suddenly from triggers that reduce capacity (Huang et al., 2022). Retry policy sustained more than half of these incidents (Huang et al., 2022).

Recent work models when a system is at risk. Analyses combining models, simulation and emulation predicted the conditions that make an example service vulnerable, and computed recovery times rose quickly as modelled systems neared those conditions (Isaacs et al., 2025; Alvaro et al., 2025).

What the samples can show

These studies describe patterns within selected samples, not how often each failure happens across deployments. Public postmortems vary in detail and sometimes leave unclear whether a failure sustained itself (Huang et al., 2022). A Microsoft Teams study used a systematic incident database but kept only the most severe levels, 2% of tracked incidents. It also required a known cause and a complete postmortem (Ghosh et al., 2022). The fail-slow study counted repeated instances of one root cause at one institution as a single report (Gunawi et al., 2018).

Testing for distributed failures

Fault injection and history checking both find real bugs, and each method misses what it cannot model or observe (Alvaro et al., 2015; Kingsbury & Alvaro, 2020; Zhou et al., 2021). Proving a design correct is a separate approach, covered in Formal verification.

Injecting faults on purpose finds real bugs. Lineage-driven fault injection found seven critical bugs across 14 evaluated fault-tolerant systems (Alvaro et al., 2015). A partition-testing tool found 32 failures in seven systems, including data loss and broken locks, and the FoundationDB team found two ZooKeeper bugs with real-world fault injection (Alquraan et al., 2018; Zhou et al., 2021).

History checking runs a real database under faults, records what clients saw, and searches that record for anomalies. The Elle checker found isolation anomalies in YugabyteDB 1.3.1 when servers lost contact with master nodes (Kingsbury & Alvaro, 2020). Its original design checks individual objects and leaves out predicate queries (queries that select rows by a condition), so it cannot tell repeatable read from serializability (Kingsbury & Alvaro, 2020). Clark and colleagues showed that predicate queries produce anomalies key-value reads and writes cannot, and that Elle missed such anomalies in PostgreSQL histories (Clark et al., 2024).

Every method has a coverage limit. Deterministic simulation runs the whole system in a reproducible simulated world; FoundationDB’s simulator cannot exercise external dependencies or code outside its own framework, and cannot reliably detect performance problems (Zhou et al., 2021). Jepsen states that tests on real executables have limited time resolution and may miss failures specific to particular schedules or platforms (Jepsen, n.d.).

Which operational advice has evidence Weak evidence: few or small studies support this

The evidence behind common advice for keeping distributed systems up comes from incident studies, single benchmarks and vendor guidance. Each measure below comes from one workload or one sample (Huang et al., 2022; Brooker, 2015; Dean & Barroso, 2013). Failure handling in distributed systems covers timeouts, retries, circuit breakers and load shedding in more depth.

Retries can keep an overload going, as in the metastable incidents above (Huang et al., 2022). Adding randomness (jitter) to the wait between retries cut the number of calls by more than half in a simulation of 100 competing clients, published on a vendor blog (Brooker, 2015). Load shedding, refusing some work to protect the rest, was the mitigation used in over half of the same metastable incidents (Huang et al., 2022).

Retries are safe only when repeating a request has no extra effect. Amazon’s design guidance calls such operations idempotent: a client can retry them without additional side effects (Featonby, n.d.). How queues and event brokers handle repeated delivery is covered in Event-driven architecture.

In a Google BigTable benchmark, hedging (sending a second copy of slow requests) cut the 99.9th-percentile time to fetch 1,000 values from 1,800 to 74 ms. It cost 2% more requests (Dean & Barroso, 2013). The 99.9th percentile is the time within which all but one request in a thousand finish. Whether to split a system into many networked services in the first place is discussed in Microservices.

Further reading

  • Gilbert and Lynch (2002): the formal statement and proof of the CAP theorem, short and precise about what “consistent” and “available” mean.
  • Viotti and Vukolić (2016): a survey that defines and compares consistency models for replicated storage.
  • Corbett et al. (2013): how Spanner combines Paxos, two-phase commit and clocks with known uncertainty.
  • Alquraan et al. (2018): a study of how network partitions break real systems, and a tool to test for it.
  • Huang et al. (2022): the study of metastable failures across 11 organisations, and what kept them going.
  • Dean and Barroso (2013): techniques for reducing worst-case latency in large services, with measurements from Google.

Known gaps

What this article cannot tell you yet.

  1. The article does not cover the history of the field.
  2. It does not cover chaos engineering in production.
  3. The Raft comprehension study has no independent replication and has not been tested with working developers.
  4. How idempotent interfaces change incident rates has not been measured.
  5. How often each kind of failure occurs across deployments is unknown: the published failure studies describe selected samples.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 59 references