Unit 5 · Distributed & cloud · Lesson 2 of 14
Consistency models and isolation guarantees
Step 1: Learn the ideas
- Histories, real-time order and linearizability
- Sequential consistency versus linearizability
- Serializability and strict serializability
- Snapshot isolation and write skew (link to transaction isolation)
- Eventual consistency and convergence rules
- Causal consistency
- Session guarantees: read-your-writes, monotonic reads, consistent prefix
- CAP: what it formally states
- PACELC and the latency cost of coordination
- Choosing guarantees per operation
Why it matters
When data has several copies, or several clients act at once, "what will this read return?" has more than one defensible answer. Consistency models make the answer precise. Interviewers use them to check whether you can name the guarantee a feature needs (a user must see their own profile edit; two concurrent withdrawals must not overdraw an account) and what it costs. Vague phrases like "strongly consistent" are where many designs quietly break.
Core ideas
A model is a rule about which histories (invocations and responses as clients observe them) are allowed.
Linearizability (single objects): every operation appears to take effect atomically at an instant between its invocation and its response, and those instants respect real time. Once a write completes, every later read from any client sees it or something newer: the behavior of a single copy. It composes per object and is what leader election, locks and uniqueness checks need.
Sequential consistency keeps one total order consistent with each client's program order, but that order need not respect real time across clients. Causal consistency only requires that causally related operations (a reply and the post it answers) are seen in order by everyone; concurrent operations may appear in different orders. Causal consistency can stay available during a partition if clients keep talking to the same replica; linearizability cannot.
Session guarantees are cheap per-client promises that are often enough:
- Read-your-writes: a client sees its own completed writes. Route its reads to the leader for a while, or remember the log position of its last write and read only from replicas that have reached it.
- Monotonic reads: a client never sees time go backwards, for example by sticking to one replica.
- Consistent prefix: readers see writes in an order that respects causality, so an answer never appears before its question.
Eventual consistency only promises convergence once writes stop. It says nothing about what a read returns meanwhile, so it needs a convergence rule (last-writer-wins, merge functions, CRDTs) and usually some session guarantees.
Transactions are a different axis. Serializability: concurrent transactions produce the result of some serial order, with no real-time constraint, so a transaction that starts after another commits may still be ordered before it. Strict serializability adds real-time order; think of it as serializability plus linearizability. Snapshot isolation gives each transaction a consistent snapshot but permits write skew. Keep the "C" of ACID (application invariants) separate from all of these.
CAP, stated carefully. The proved result concerns a replicated read/write register: if the network can lose messages between nodes, you cannot guarantee both linearizability and that every request to a non-failed node eventually receives a response. It says nothing about latency, about systems that were never linearizable, or about normal operation. Most real databases are neither "C" nor "A" in these strict senses, so labeling a product CP or AP misleads. PACELC adds the everyday tradeoff: under a Partition choose Availability or Consistency; Else choose Latency or Consistency, because coordination costs round trips even on a healthy network.
Common misconceptions
- "Serializable means I always read the latest data." Serializability allows any serial order, including one that places a read-only transaction before a write that already committed. Real-time guarantees need strict serializability.
- "CAP means pick two of three." Partitions are not optional, and the theorem constrains behavior only during one. The real choice is per operation: wait or fail, versus answer with possibly stale data.
- "Eventual consistency means data is usually fresh." It bounds nothing; staleness can grow without limit under load or partition. Measure replication lag and add session guarantees where users would notice.
- "Quorum reads and writes give linearizability." Overlapping quorums are necessary, not sufficient; sloppy quorums, concurrent writes and partially failed writes still produce non-linearizable histories.
- "Linearizability and serializability are the same." One is about single-object operations in real time, the other about multi-object transactions in some serial order.
How to approach it
Learn the definitions from DDIA Ch. 9 and the Jepsen map, then practice on histories: draw two or three clients on a timeline and decide which read results each model allows. Map each model to a mechanism (single leader, synchronous replication, consensus, client-side tokens). Graduates should define linearizability and explain a stale-read anomaly. Mid-level candidates should choose guarantees per feature and implement read-your-writes. Senior candidates should argue the latency and availability cost of each choice and recognize when a weaker model plus compensation is the better product decision.
Suggested order
- 1Read DDIA Ch. 5, section "Problems with Replication Lag", for read-your-writes, monotonic reads and consistent prefix reads.
- 2Read DDIA Ch. 9 (Consistency and Consensus), sections "Consistency Guarantees" and "Linearizability", including its discussion of CAP and the cost of linearizability.
- 3Read the 6.5840 LEC 8 notes on linearizability and check their example histories by hand.
- 4On the Jepsen map, read the pages for linearizability, serializability, strong serializability, causal consistency and the session models; redraw the hierarchy from memory.
- 5Read Kleppmann's "Please stop calling databases CP or AP" and Abadi's PACELC article, then write a three-sentence statement of what CAP proves.
- 6Classify the anomalies in one Jepsen analysis, or do the Gossip Glomers counter and transaction challenges and note which guarantee each checker enforces.
Step 2: Check off what you can do
Tap each one you can genuinely do or explain. Each earns 10 XP.
Step 3: Go deeper
Consistency Models (Jepsen)Start here
JepsenMap of models ordered by strength with concise definitions and availability properties; use it to build the hierarchy.
Open(opens in a new tab)Link responded, 5 Oct 2026Designing Data-Intensive ApplicationsStart here
O'Reilly Media (author's book site)Section: Ch. 9: Consistency and Consensus (with Ch. 5, "Problems with Replication Lag")
Main explanation of linearizability, ordering, the CAP discussion and session guarantees under replication lag.
Open(opens in a new tab)Link responded, 5 Oct 2026MIT 6.5840 Distributed Systems
MIT PDOSSection: LEC 8: Consistency and Linearizability (lecture notes)
Worked histories for checking linearizability by hand.
Open(opens in a new tab)Link responded, 5 Oct 2026Please stop calling databases CP or AP
Martin Kleppmann's blogWhat CAP formally assumes and why CP/AP labels mislead.
Open(opens in a new tab)Link responded, 5 Oct 2026Consistency Tradeoffs in Modern Distributed Database System Design
University of Maryland (author copy)The latency versus consistency tradeoff that applies even without partitions.
Open(opens in a new tab)Link responded, 5 Oct 2026
Step 4: Practice
Draw at least five small histories (two or three clients, a few reads and writes) and label each as linearizable, sequentially consistent only, or neither; check them against the lecture notes. Then classify the anomalies in one Jepsen analysis. In the Gossip Glomers counter and transaction challenges, write down which guarantee the checker enforces before designing. The 6.5840 key/value and Raft labs later require you to deliver linearizability yourself.
- Classify the anomalies in one Jepsen analysisOpen(opens in a new tab)Not attemptedJepsen
- Gossip Glomers distributed-systems challenges (Maelstrom)Open(opens in a new tab)Not attemptedFly.io with Jepsen Maelstrom
- MIT 6.5840 labs: key/value server, Raft, fault-tolerant and sharded key/valueOpen(opens in a new tab)Not attemptedMIT 6.5840
Record attempts on each problem’s page (+15 XP, +10 more when solved on your own).
Step 5: Test yourself
Answer each one out loud or on paper before you finish the lesson.
- Question 1Why is linearizability composable per object while serializability concerns groups of operations?
- Question 2Which models can remain available during a partition, and why can linearizability not?
- Question 3A user updates their avatar and sees the old one after refreshing. Which guarantee is missing, and how would you add it?
- Question 4Give a write-skew example that snapshot isolation allows.
- Question 5What does PACELC add to CAP, and where does it show up in a single-region system?
- Question 6Is a leader-follower database with asynchronous followers linearizable for reads served by followers?
You’re done when you can
- Decide correctly whether five unseen small histories are linearizable, with a justification for each.
- Explain the difference between serializability and strict serializability with a concrete two-transaction example.
- State CAP precisely in under one minute, including its definitions of consistency and availability.
- Design read-your-writes for a leader-follower database and name the cost of your approach.
Finish the lesson
Unlocks next: Replication, quorums and consensus (Raft)


