Part 2 · Blueprint 08
Consistency Models: CAP, PACELC & Linearizability
15 min reading · Sources · Editorial review pending
A network partition prevents disconnected participants from manufacturing agreement.
Page details
Published date · Last edited:
Draft edition. Editorial review and supplementary reading recommendations are still being completed.
Format: Architecture walkthrough. Prerequisites: the beginner bootcamp. Chapter prerequisites: SQL vs. NoSQL vs. NewSQL Storage Engines.
Sixty-second mental model
Problem: A network partition prevents disconnected participants from manufacturing agreement.
Use: State acceptable observations for each operation.
Design boundary: Choose consistency per observable operation. Linearizability orders operations as if each took effect between invocation and response. Eventual convergence does not imply a bound on staleness or a safe inventory allocator.
Layer 1 · Intuition
Hypothetical scenario: Northwind is designing consistency models. Maya represents product requirements, Dev implementation and Priya reliability. The team must agree what one operation means and which component owns the read observation contract.
Think of branch offices reading copies of a ledger. Separate the requester from read observation contract, then identify the retained evidence needed after failure.
- Authority
- The entitled state owner.
- Invariant
- A rule preserved across concurrency and failures.
- CAP
- A result limiting simultaneous linearizable consistency and availability during partitions under its formal model. Analogy: A disconnected office cannot both answer every request and always share one instant record.
- Causal consistency
- An observation model preserving causal dependencies among operations. Analogy: Replies cannot appear before the messages they depend on.
- Eventual consistency
- A convergence property under stated conditions after updates cease and communication proceeds. Analogy: Copies eventually matching once changes stop and updates arrive.
- Isolation
- Rules governing interference and observations among concurrent transactions. Analogy: Separate work areas with explicit rules for sharing unfinished work.
- Linearizability
- A consistency condition making operations appear atomic between invocation and response while respecting real-time order. Analogy: Each desk action appears to occur at one shared instant.
Architecture and worked reasoning
Design boundary: Choose consistency per observable operation. Linearizability orders operations as if each took effect between invocation and response. Eventual convergence does not imply a bound on staleness or a safe inventory allocator.
Responsibilities on the request path
Workload and limiting resource
In a hypothetical three-copy store, a write quorum of two and read quorum of two overlap because 2 + 2 > 3. This set intersection alone does not prove linearizability: concurrent writes, membership changes, version selection and read repair still need a correct protocol. During a partition, a minority without the required authority must not independently confirm a conflicting allocation.
Keep the units attached to each intermediate result. The assumptions above describe a hypothetical exercise, not observed vendor capacity. A real capacity decision also needs a measured service curve, skew, recovery traffic and an explicit admission policy for overload.
Mutation or publication path
- Select the write authority and acknowledgement rule.
- Replicate under the documented protocol.
- Expose completed writes according to the promised observation model.
Observation and recovery path
- Choose a read path that meets the operation contract.
- Carry a session/version requirement where needed.
- Refuse or weaken the response explicitly when evidence is unavailable.
Failure that changes the decision
Hypothetical scenario: A failover serves a lagging replica as current and loses an acknowledged update. State the durability and election requirements before calling the service strongly consistent.
Attempt this decision before reading the explanation
Does a majority read always return the latest value?
Not by arithmetic alone. The protocol must identify the valid latest committed version, handle concurrent writes and membership, and prevent an obsolete authority from acknowledging new writes.
Supporting mechanism analysis
Hypothetical scenario: Northwind. Maya represents product, Dev implementation and Priya reliability. The following workflow develops the underlying mechanism.
Hypothetical scenario. At Northwind, Priya reads an old address from a lagging support replica.
In short. Specify which reads require the latest confirmed write. Separate stale display reads from critical account changes.
Hypothetical scenario. A seller withdraws a catalogue item and receives confirmation. A buyer subsequently opens the item through another region and still sees it as available. The reader's question is not whether the database has a fashionable consistency label. It is whether this observation is allowed by the service's contract.
A system can offer different contracts for different operations. A reservation decision may need authoritative coordination, while an item description can permit a bounded or disclosed delay. A relational data model does not by itself make every replica read current, and a document model does not prohibit stronger coordination.
Likewise, “eventual” is not a freshness deadline. It needs assumptions about communication, successful propagation and conflict handling. If the business needs a particular visibility bound or read-your-writes behavior, state and implement it instead of substituting a general label.
A linearizable operation behaves as though it took effect at a point between invocation and response, preserving the order of non-overlapping operations. For a register-like value, a read beginning after a completed write cannot simply return an older value unless another permitted operation explains the result.
Session guarantees answer narrower questions, such as whether a client observes its own accepted write. Transactions introduce further constraints across operations and records. Do not treat a useful session guarantee as equivalent to a globally linearizable multi-record transaction.
The practical specification should name the operation, its state and observers, and the failure conditions under which it may wait, reject or return a weaker result. An explicit unavailable response can be more truthful than a result that silently violates the promised invariant.
Priya's support screen and the checkout service can disagree about a recently changed address because they observe different copies at different points in replication. The customer-facing question is not whether the storage product is described as consistent. It is whether a completed change must be visible to this later read, and what the application does when the required observation cannot currently be obtained.
In a hypothetical history, a customer changes address A to B and receives success. A later support read begins after that success. Returning A violates a linearizable single-address contract even if the replica converges to B later. If the contract instead permits a bounded or explicitly signaled stale view, the interface must expose that choice honestly. A label such as eventual consistency does not define the permitted duration, the read-your-writes behavior or conflict handling by itself.
A quorum calculation is a useful starting point, not a complete storage protocol. With three members, a read set of two and a write set of two must overlap because 2 + 2 > 3. The overlapping member still needs enough version information and a defined read algorithm. Concurrent writes, membership changes and partial acknowledgements all affect what can be concluded from a response. Adding the set sizes is not a proof of linearizability.
Keep time and ordering separate. A timestamp can help identify a version under a particular model, but a larger wall-clock value does not make an unauthorized overwrite valid. CAP addresses the choices available during a communication partition; PACELC draws attention to latency and consistency choices outside that condition as well. Explain the chosen observation behavior for each operation rather than promising one universal setting for the whole application.
Hypothetical scenario. Start with a stored quantity of seven. A write changes it to nine and completes at a chosen timeline position of 20 ms. A read starts at 30 ms and returns seven at 40 ms, with no intervening write. Because the write completed before the read began, that result violates a linearizable single-value contract. The times specify this illustrative history; production clocks do not automatically provide such a shared timeline.
For a separate quorum example, choose three fixed replicas, require two acknowledgements for a write and read from two replicas. Any two-member write set and two-member read set within the same three members intersect because 2 + 2 > 3. The minimum intersection size is 2 + 2 − 3 = 1.
That set arithmetic does not, by itself, prove linearizability. The design must also establish accepted versions, how a reader chooses or repairs values, ordering of concurrent writes, membership changes and what an acknowledgement means. An intersecting reader can contact a replica without automatically recognizing the correct result.
If one of the fixed three replicas becomes unreachable, two can still form the chosen quorum; if only one remains reachable, they cannot. These are membership counts under the stated model, not a complete availability or data-loss prediction.
A history makes the difference between linearizability and sequential consistency visible. Both constrain possible observations. Linearizability additionally preserves the real-time order of nonoverlapping operations. Sequential consistency preserves each client's program order while allowing a global order that differs from real-time precedence between clients.
With an initial value of available and no other operations, linearizability rejects that result: the completed withdrawal must precede B's read. Sequential consistency alone can place B's read before A's write because neither client's own program order is reversed. This example uses distinct clients. If A writes and then reads in its own program order, sequential consistency must respect that order too.
Eventual consistency describes convergence under suitable conditions when updates stop; by itself it does not bound how soon a particular reader sees a write. During a partition, a read requiring a current authoritative status may have to wait or report unavailable. A separately declared descriptive view can permit stale data. Name the operation and guarantee rather than assigning one adjective to the entire application.
Apply this to the payment case : a session seeing its own “payment submitted” value is not evidence that a provider confirmed capture. In the chat case , a remembered cursor does not authorize reading history after membership revocation. Observation order, external evidence and access control are related design concerns with separate requirements.
Layer 3 · Internals
Trade-offs and limits
| Approach | Provides | Requires |
|---|---|---|
| Strong read observation | Simplifies a caller that must see a recent committed result. | May require coordination or refusal during a partition. |
| Permitted stale observation | Can keep eligible copies useful under delay. | The product must explicitly tolerate the resulting observations. |
Recovery decision
Hypothetical scenario: A failover serves a lagging replica as current and loses an acknowledged update. State the durability and election requirements before calling the service strongly consistent.
Not by arithmetic alone. The protocol must identify the valid latest committed version, handle concurrent writes and membership, and prevent an obsolete authority from acknowledging new writes.
Write your design before revealing the review
Does a majority read always return the latest value?
Drafts and self-review are stored only in this browser. They are separate from reading completion.
Compare your decision
Not by arithmetic alone. The protocol must identify the valid latest committed version, handle concurrent writes and membership, and prevent an obsolete authority from acknowledging new writes.
A failover serves a lagging replica as current and loses an acknowledged update. State the durability and election requirements before calling the service strongly consistent.
Check your understanding
Does a majority read always return the latest value?
Not by arithmetic alone. The protocol must identify the valid latest committed version, handle concurrent writes and membership, and prevent an obsolete authority from acknowledging new writes.
How would you recover from this failure: A failover serves a lagging replica as current and loses an acknowledged update. State the durability and election requirements before calling the service strongly consistent.
Start with the exact boundary that failed. Select the write authority and acknowledgement rule. Replicate under the documented protocol. Expose completed writes according to the promised observation model. Then recover evidence through the observation path: Choose a read path that meets the operation contract. Carry a session/version requirement where needed. Refuse or weaken the response explicitly when evidence is unavailable. Preserve the distinction between a confirmed state change and an unavailable response.
Which assumption in the worked calculation would a burst or concentrated tenant invalidate first?
In a hypothetical three-copy store, a write quorum of two and read quorum of two overlap because 2 + 2 > 3. This set intersection alone does not prove linearizability: concurrent writes, membership changes, version selection and read repair still need a correct protocol. During a partition, a minority without the required authority must not independently confirm a conflicting allocation. Recompute the affected resource rather than multiplying unrelated storage and network budgets by the same factor. Choose consistency per observable operation. Linearizability orders operations as if each took effect between invocation and response. Eventual convergence does not imply a bound on staleness or a safe inventory allocator.
Which component in this topology could be removed from a smaller first deployment?
Writer, Replica leader, Replica copy, Reader name responsibilities, not a requirement for separate processes. Co-locate responsibilities when their transaction, trust and capacity boundaries permit it. Select the write authority and acknowledgement rule.
What evidence must a caller have before relying on the observation path?
Choose a read path that meets the operation contract. Carry a session/version requirement where needed. Refuse or weaken the response explicitly when evidence is unavailable. Not by arithmetic alone. The protocol must identify the valid latest committed version, handle concurrent writes and membership, and prevent an obsolete authority from acknowledging new writes.
45-minute interview rubric
- 00–05: scope operation and read observation contract.
- 05–12: identify the limiting resource and derive the domain workload above, retaining units and assumptions.
- 12–28: draw read observation contract, numbered writes and reads.
- 28–40: challenge recovery: State acceptable observations for each operation.
- 40–45: defend key placement, observations and remaining assumptions.
Go deeper
- Linearizability · Primary document · jepsen.io. State acceptable observations for each operation. Verified 2026-10-26.
- Perspectives on the CAP Theorem · Primary document · groups.csail.mit.edu. State acceptable observations for each operation. Verified 2026-10-26.
- Sequential Consistency · Primary document · jepsen.io. State acceptable observations for each operation. Verified 2026-10-26.
Decision log
State acceptable observations for each operation.
Preserve operation identity and read observation contract ownership.
Revisit changed workload, observations or recovery objectives.