Consistency Models & Distributed Coordination: What 'Consistent' Actually Means
Consistency is not a boolean. Linearizability, causal consistency, read-your-writes, and eventual consistency are distinct contractual guarantees — each with a different implementation cost. This article maps the full spectrum to the read-path decisions you make in your ORM, replica config, and cache layer.
Advanced Database & State Management
Consistency Models & Distributed Coordination: What "Consistent" Actually Means
A database is not a dumb storage box — it is a contract between your write path, your read path, and your consistency guarantees. Every design decision you defer becomes a production incident you eventually own. The most deferred decision in distributed systems is treating "consistent" as a single word. Engineers say "we need consistency" without specifying which consistency: linearizability, sequential consistency, causal consistency, read-your-writes, or eventual. Each is a different contract. Each has a different cost. And your replica configuration, your ORM, and your cache layer are already making this choice for you — whether you know it or not.
This is Part 2b of the Advanced Database & State Management series. It builds on the isolation level foundation from Part 2a — Isolation & Concurrency Control. The concepts here — consistency models across replicas — are the distributed-system extension of the single-node anomaly taxonomy covered there.
Cross-series context: The Database Decision Framework article in the Modern Database Paradigms series covers consistency as a workload classification criterion ("choose strong consistency deliberately, not by default"). This article teaches the mechanical meaning of each guarantee so you can operationalize that advice.
1. The Consistency Model Spectrum
Consistency is not a binary — it is a spectrum of named, contractual guarantees. From strongest to weakest:
Each level is strictly weaker than the one above it: a system providing linearizability also provides all weaker guarantees. A system providing eventual consistency provides none of the stronger ones unless explicitly configured.
1.1 Linearizability (Strongest)
Every read reflects the most recent write globally, and all operations appear to execute instantaneously in a single, total order — as if there were only one copy of the data.
Implementation cost: Synchronous replication. Every write must be acknowledged by all replicas before the client receives a response. Latency = max(replica write latency). Under network partition, a linearizable system must refuse writes (CP in CAP terms).
Where you see it: Postgres with synchronous_commit = remote_apply + synchronous standby. ZooKeeper. etcd (Raft consensus).
1.2 Sequential Consistency
All operations appear to execute in some total order that is consistent with the order seen by each individual process — but the global order does not have to match real-time wall clock order.
Where you see it: CPU memory models (not databases in practice). Rarely used as a database guarantee.
1.3 Causal Consistency
Operations that are causally related (writes that depend on prior reads) are seen in causal order by all nodes. Concurrent operations (no causal link) may be seen in different orders by different nodes.
Where you see it: MongoDB causal sessions. CockroachDB follower reads with AS OF SYSTEM TIME. Collaborative editing systems (Google Docs uses a form of causal consistency with Operational Transformation).
1.4 Read-Your-Writes
A user always sees their own writes in subsequent reads — even when reading from a replica.
Implementation: Sticky sessions (same replica), primary routing for reads after writes, or synchronous standby with synchronous_commit.
1.5 Monotonic Reads
Once a user has seen a value X, they will never subsequently see an older value than X (from any replica).
1.6 Eventual Consistency (Weakest)
Given no new writes, all replicas will eventually converge to the same value. No guarantee on when. No guarantee on what intermediate reads return.
Eventual consistency does not mean "consistent eventually." It means "eventually identical" — with no bound on time and no guarantees about intermediate states.

2. CAP Theorem: What It Actually Forces
The CAP theorem states: a distributed system can provide at most two of three guarantees simultaneously:
- Consistency (linearizability)
- Availability (every request gets a response)
- Partition tolerance (the system continues operating despite network partitions)
Since partition tolerance is not optional in any real distributed system (networks fail), the real choice is:
| Under partition | Behavior | Designation |
|---|---|---|
| Refuse writes to preserve consistency | Returns error / timeout | CP |
| Accept writes to remain available | May return stale data | AP |
CAP only describes behavior during a network partition. Most of the time, there is no partition — the system operates normally. CAP does not describe the everyday tradeoff. PACELC does.
3. PACELC: The Everyday Tradeoff CAP Misses
PACELC extends CAP to include latency as a first-class dimension:
Every database makes this choice on every write, even without a partition:
| Database | Under Partition | Normal Operation | PACELC Class |
|---|---|---|---|
| DynamoDB (default) | AP — stays available | EL — optimizes latency | PA/EL |
| Cassandra (ONE) | AP | EL | PA/EL |
| Postgres (sync standby) | CP — refuses writes if standby down | EC — pays replication latency | PC/EC |
| CockroachDB | CP | EC | PC/EC |
| MongoDB (majority write) | CP | EC | PC/EC |
| Cassandra (QUORUM) | PA | EC | PA/EC |

CAP is a failure-mode lens. PACELC is an operational lens. When your architect says "we need high availability," ask: "High availability under partition, or low latency under normal operation?" These are different requirements with different database configurations.
4. Eventual Consistency at the Code Level
"Eventual consistency" is not an abstraction you configure once and forget. It produces concrete, user-visible behaviors that your read path must be designed to handle.
4.1 The Read-Your-Writes Violation
4.2 Monotonic Reads Violation
4.3 CRDTs: Eventual Consistency Without Conflict
For collaborative features where multiple users write concurrently and conflicts must merge automatically, Conflict-Free Replicated Data Types (CRDTs) are the production primitive.
Last-Write-Wins (LWW) is the default conflict resolution in Cassandra, DynamoDB (conditional writes aside), and many event-streaming systems. LWW silently discards concurrent writes — the losing write is gone with no error. For financial data, user-generated content, or any field where concurrent writes are meaningful, use CRDTs or application-level conflict resolution instead.
5. Distributed Coordination: Why 2PC Fails and What Replaces It
When a write must span multiple services or databases, you need a coordination protocol.
5.1 Two-Phase Commit (2PC) and the Blocked-Participant Problem
The failure mode: If the coordinator crashes after Phase 1 but before Phase 2, all participants are in "prepared" state — resources locked, waiting indefinitely for a commit or abort signal that never comes.
2PC is not used as a general application-level distributed transaction mechanism in modern distributed systems precisely because of this failure mode. CockroachDB and Spanner use it internally with Raft-based recovery guarantees — but you do not implement 2PC in your application code.
Cross-series reference: The Cloud-Native & Distributed SQL: CockroachDB article in the Modern Database Paradigms series covers how CockroachDB handles distributed transactions internally using Raft consensus — the production alternative to application-level 2PC.
5.2 Saga Pattern: The Application-Level Alternative
A Saga decomposes a distributed transaction into a sequence of local transactions, each of which publishes an event or message. If any step fails, compensating transactions undo the preceding steps.
Summary
| Concept | Rule |
|---|---|
| Linearizability | Every read reflects the most recent global write — requires synchronous replication; most production systems do not need it |
| Eventual consistency | Replicas converge eventually — has no time bound and no intermediate-state guarantees |
| Read-your-writes | Always route post-write reads to the primary, or return the written value directly |
| Monotonic reads | Pin users to a single replica (sticky sessions) or route all reads through primary |
| CAP under partition | CP systems refuse writes to stay consistent; AP systems accept writes and return stale data |
| PACELC everyday | Every write trades latency for consistency even without a partition — PACELC describes this, CAP does not |
| LWW conflict resolution | Silently discards concurrent writes — never use for financial data or user-generated content |
| CRDTs | The correct primitive for collaborative features with concurrent writes — merge automatically without conflict |
| 2PC | Blocked-participant failure mode makes it unsuitable for application-level distributed transactions |
| Saga pattern | Decomposes distributed writes into local transactions with compensating rollbacks — no coordinator, no blocking |
What's Next
In Part 3, the consistency guarantees established here become the framework for evaluating scaling strategies — partitioning, sharding, and replication topologies each make different consistency commitments, and the quorum formula
W + R > Nis the mathematical expression of the read-your-writes guarantee in a leaderless system. → Scaling Data: Partitioning, Sharding & Replication
This article was developed with AI-assisted deep search, specification cross-referencing, and technical research synthesis.