Back to the map

Module 13 · Distributed fundamentals · Lesson 6 of 18

Consistency models

What a replicated system promises about the order and visibility of writes: linearizability, sequential, causal, read-your-writes, monotonic reads and eventual consistency. What each costs in latency and availability.

CoreMust-knowMid 13 minVideoPro Updated Nov 2026

The video walkthrough is part of Pro.

See what Pro includes
Video walkthrough · 2:43 · narrated, with captions

Why it matters

"Consistent" means something different to a database engineer (ACID's C), a distributed-systems engineer (ordering of operations across replicas) and a product manager (users do not see weird things). This lesson is about the second meaning: when there are several copies of data, what can a reader observe about writes that happened elsewhere? Picking the right model per feature is the difference between a system that is fast and correct where it matters and one that is slow everywhere or wrong somewhere.

The idea

A consistency model is the contract between a replicated store and its clients about which values a read may return given the writes that have occurred. Stronger models give fewer surprises and cost more coordination; weaker models give availability and latency and push reasoning onto the application.

ModelPromiseAnomaly it rules outCost
Linearizable (strong)Every operation appears to happen instantaneously at one point between its start and end, in one global order consistent with real timeAny stale read; two clients disagreeing about the current valueCoordination on every operation: a leader or quorum round trip; unavailable on the minority side of a partition
SequentialAll clients see the same order of operations, but that order need not match real timeClients seeing different ordersNearly as expensive as linearizable in practice
CausalIf write B depended on (read) write A, every reader sees A before B; concurrent writes may be seen in any orderSeeing a reply before the message it answersVersion vectors or dependency tracking; available under partition
Read-your-writesA client always sees its own writesPosting a comment and not seeing itRoute the client to the primary or wait for replication of its own writes
Monotonic readsA client never sees time go backwardsRefreshing and seeing an older statePin the client to one replica
EventualIf writes stop, all replicas converge to the same valueNone of the above; anything may be observed temporarilyCheapest; always available; conflicts must be resolved
linearizablewrite x=2read x → 2read x → 2eventualwrite x=2read x → 2read x → 1replica 2 has not received the write yet
Under linearizability, once a write is acknowledged every subsequent read anywhere returns it. Under eventual consistency, a later read on another replica may still return the old value.

The session guarantees

Read-your-writes, monotonic reads, monotonic writes and writes-follow-reads are session guarantees: promises to a single client rather than globally. They are cheap to provide (route a session to one replica, or track the version a client has seen and wait for replicas to reach it) and they remove most of the anomalies users actually notice. A system can be eventually consistent globally and still give every user a coherent personal view. This is the pragmatic middle that most consumer products live in.

Causal consistency

Causal consistency is the strongest model that remains available under partition. It preserves cause and effect: if you read a question and then write an answer, nobody sees the answer without the question. Concurrent, unrelated writes may be observed in different orders on different replicas, which is harmless. Implementing it needs dependency tracking (vector clocks or explicit version dependencies), covered in the Time and Ordering lessons; systems like MongoDB (causal sessions) and research systems such as COPS provide it.

What products offer

Single-leader databases with synchronous replication are linearizable for reads from the leader; reads from asynchronous replicas are eventually consistent with lag, which is why read-your-writes routing exists. Spanner and CockroachDB offer linearizable (externally consistent) transactions across regions using synchronized clocks and consensus. Dynamo-style stores and Cassandra are tunable: per operation you choose how many replicas must agree, so QUORUM reads after QUORUM writes give strong consistency for a key and ONE gives eventual. ZooKeeper and etcd are linearizable for writes and offer linearizable reads on request. Object stores are now read-after-write consistent.

PACELC and choosing per feature

CAP describes behaviour under partition; PACELC adds the normal case: Else, trade Latency against Consistency. Even with no partition, linearizable operations wait for coordination, so choosing strong consistency costs latency every day. The decision is per feature: balances, inventory counts, unique usernames and leader state want linearizability; feeds, likes, view counts and presence want eventual with session guarantees; collaborative documents want causal plus convergence (CRDTs or OT).

Consistency models · Backplane