Recommended resources
The freely available resources this lesson will direct you to.
Welcome back. Last lesson established how replica count and read/write quorum choices shape what an acknowledged operation means. In particular, strict quorum intersection, expressed as
can make a completed read overlap a completed write, but it also raises latency and reduces the number of unavailable replicas an operation can tolerate.
This lesson uses that foundation to analyze a failure rather than merely label a database “CP” or “AP.” You will separate the partition-time choice described by CAP from the normal-operation latency choice described by PACELC, then apply both to a multi-region data scenario.
CAP is a conditional trade-off, not a permanent three-way choice
The popular shorthand “pick two of three” is a useful warning, but it obscures the engineering question. In a distributed system deployed across machines or regions, you do not elect to be “partition tolerant” in the same sense that you elect a consistency policy. Networks can delay or drop communication; a partition is a condition the system must survive.
The meaningful CAP question is:
When some replicas cannot communicate, will the service preserve a single correct view of data, or will it continue responding from every reachable side?
For CAP, the terms have narrow meanings:
- Consistency means an operation appears to take effect at one instant between its invocation and response. This is commonly called linearizability or atomic consistency. If a client receives confirmation that
status = CANCELLEDwas written, a later read must not return the earlier value merely because it reached a different replica. - Availability means every request reaching a non-failed server eventually receives a non-error response. In a production system, an answer that arrives after a client timeout is operationally equivalent to no answer, so availability must be interpreted alongside concrete timeout and SLO requirements.
- Partition tolerance means the system continues operating despite communication links that may delay messages indefinitely or lose them. A partition does not require that machines have crashed: both sides can be healthy, yet unable to exchange messages.
Consistency in CAP does not mean that every disk copy is physically identical at every instant. Replicas may lag internally. The issue is whether the service can hide that lag and still give clients behavior equivalent to one authoritative copy.
Read the formal framing and the short impossibility argument before moving into the incident scenario.
[PDF] Perspectives on the CAP Theorem
In “Perspectives on the CAP Theorem,” Seth Gilbert and Nancy Lynch distinguish CAP’s formal vocabulary from the looser language often used in system design discussions. The proof scenario is especially useful because it shows why waiting cannot solve a true partition.
In the subsection “CAP terminology,” read from the paragraph beginning “Our formulation of CAP focuses on Web services” through the formal scope. Focus on the distinction between an atomic service, eventual response, and faulty communication. Then read the subsection “Proving CAP.” Follow the partition proof: server p2 cannot determine which acknowledged write occurred at isolated server p1, so it must either return a potentially incorrect value or fail to answer.
Two practical corrections follow from this definition:
- CAP activates during a communication failure. When all replicas communicate normally, CAP does not force a choice between consistency and availability.
- A timeout is evidence, not proof, of a partition. A remote replica may be disconnected, overloaded, paused by garbage collection, or simply slow. A system cannot reliably distinguish an indefinitely slow network from a broken one within a finite deadline.
That second point explains why real systems make a policy choice at timeouts. They either stop waiting and preserve a consistency contract, or they respond from the locally available information and accept that the answer might not fit one global history.
A concrete failure: a cross-region inventory reservation
Consider an online retailer with inventory records replicated in two regions:
- Region West serves customers near the western market.
- Region East serves customers near the eastern market.
- The record for
sku-881says how many units remain available. - There is exactly one unit left.
The business operation is not a harmless overwrite. It is conditional:
Reserve one unit only if the remaining quantity is positive.
Suppose the regions normally replicate updates across a wide-area network. A routing failure then separates West and East for several minutes. Each region can still serve local clients, but messages between regions do not arrive.
During the partition, a customer in West and a customer in East both attempt to reserve the final unit.
Why the two sides cannot both make a globally correct decision
West knows its own local state: one unit remains. But it cannot know whether East has already accepted a reservation. East is in the symmetric position.
If both regions independently reply “reservation confirmed,” the system has sold two units while holding one. Later synchronization can identify the conflict, but it cannot retroactively make both customer promises true. A last-write-wins rule may select one record version, yet it silently breaks the other reservation; conflict resolution changes the stored data, not the past business commitment.
This is the CAP dilemma in a form relevant to data engineering: the question is not whether replicas will temporarily diverge, but whether the application is allowed to act on divergent information.
Choice 1: preserve consistency during the partition
A CP-oriented design refuses to confirm a reservation unless it can contact the replicas or leader required to establish a single ordering of operations.
For example, a globally replicated consensus group may require a majority before accepting the reservation. If the partition splits a six-member group into three replicas in each region, neither side has a majority. Both sides reject or time out reservation requests until communication returns. In an uneven split, the majority side can often continue, while the minority side cannot.
The outcome is:
| Property | CP behavior for the reservation |
|---|---|
| West reservation request | May be rejected or time out |
| East reservation request | May be rejected or time out |
| Overselling risk | Avoided by refusing uncoordinated confirmation |
| Customer experience | Some requests are unavailable, but successful reservations are trustworthy |
| Recovery | Resume after quorum or leader communication is restored |
This does not mean the entire retail application must be offline. Product pages, cached images, reviews, and browse-only catalog queries can remain available. It means that this particular globally exclusive decision cannot be safely made wherever connectivity is insufficient.
Choice 2: preserve availability during the partition
An AP-oriented design accepts requests in either reachable region. West can confirm its local reservation without waiting for East; East can do the same.
The immediate outcome is responsive service:
| Property | AP behavior for the reservation |
|---|---|
| West reservation request | Confirmed from West’s local state |
| East reservation request | Confirmed from East’s local state |
| Overselling risk | Possible when both sides act on stale or divergent state |
| Customer experience | Fast responses during the outage |
| Recovery | Reconcile conflicting versions and compensate for the losing business action |
This option can be reasonable for data whose conflicts are naturally mergeable. A shopping-cart item count may be represented as independent additions, then reconciled later. It is much less suitable for a scarce resource, payment capture, or a final shipment authorization, where a later correction imposes a real cost.
The design question is therefore specific:
If a partition occurs, is a delayed or rejected response more acceptable than a plausible but potentially invalid confirmation?
That is a business and application-semantics decision, not a database-brand decision.
Connecting the scenario to last lesson’s quorums
Suppose each region holds three replicas of sku-881.
- With a global strict quorum policy, reads and writes must obtain acknowledgment from enough replicas across the total set to overlap appropriately. If the WAN partition leaves each region with only its local three replicas and the required global quorum cannot be reached, reservations become unavailable. This is the CP-style outcome.
- With local quorum reads and writes, each region can obtain local acknowledgments and remain responsive. But both regions can independently confirm contradictory conditional operations. That is availability across the partition at the cost of global consistency.
- A low acknowledgment policy such as one local replica makes this window wider still. It may be appropriate for telemetry or click events, but does not establish a safe global inventory decision.
Quorum intersection by itself is not a substitute for a transaction or consensus protocol when the operation is “perform this action only if a globally shared predicate is true.” The inventory check must coordinate the decision, not merely replicate the eventual number.
PACELC: the trade-off that still exists when the network is healthy
CAP explains what happens under the partition. But production systems spend most of their time outside a partition, and cross-region replication still has a cost.
PACELC adds the missing branch:
In words:
- If a partition occurs, choose between availability and consistency.
- Else, when communication is functioning, choose between lower latency and stronger consistency.
The “else” clause matters because a system that wants a globally current answer must coordinate across replicas. Coordination takes network round trips, and wide-area round trips add substantial and variable delay.
Watch the concise introduction to PACELC, then use the incident above to keep its labels tied to concrete behavior.
PACELC Theorem | Beyond CAP Theorem | System Design Primer
“PACELC Theorem | Beyond CAP Theorem” from Tech Primers introduces the two decision branches and explains why geographic replication makes normal-operation latency a consistency concern.
Watch the PACELC definition for the distinction between the partition and no-partition cases. Then watch the replication example, focusing on why a cross-region write can either wait for synchronized state or acknowledge locally and allow lag.

Return to the inventory service while West and East are communicating normally.
The normal-operation choice: fast local confirmation or global confirmation
A low-latency design may accept a reservation in West after a local durable write, then replicate it asynchronously to East. A West customer receives a quick response, but an East client may briefly see the old stock count. The service has chosen lower latency over immediate cross-region consistency.
A stronger-consistency design waits until a remote quorum, a consensus leader, or a required set of cross-region replicas acknowledges the operation. Any client authorized to observe the result under that protocol sees a single coordinated outcome, but the request includes wide-area network delay and may be affected by a slow remote participant.
This difference is independent of whether a failure is occurring:
| Normal operating choice | Client-visible behavior | Main cost |
|---|---|---|
| Local acknowledgment with asynchronous replication | Low write latency; remote readers can temporarily observe older state | Replication lag and stale reads |
| Cross-region quorum or consensus acknowledgment | Acknowledged decisions reflect coordinated state | Higher median and tail latency |
| Route every operation to a single authoritative leader | Can preserve a strong order | Requests far from the leader pay routing latency; leader capacity matters |
PACELC labels summarize these two branches:
| Label | During partition | During normal operation |
|---|---|---|
| PA/EL | Continue answering, accepting possible divergence | Prefer low latency, accepting weaker immediate consistency |
| PC/EC | Reduce availability to avoid divergent outcomes | Pay latency to preserve stronger consistency |
| PA/EC | Favor availability during a partition, while normally paying for stronger consistency | More complex and configuration-dependent |
| PC/EL | Preserve the baseline consistency level during partition by reducing availability, but favor low latency in normal reads or updates where possible | Often involves carefully bounded guarantees |
Treat these labels as a reasoning lens, not permanent product stickers. A database may offer per-request consistency settings, separate read and write policies, leader placement, local and global quorums, and transactional features. The same platform can therefore exhibit different PACELC behavior for different tables and operations.
For a deeper primary-source account, read Daniel Abadi’s discussion. It directly addresses the common error of treating CAP as an explanation for ordinary low-consistency, low-latency behavior.
Consistency Tradeoffs in Modern Distributed Database ...
Daniel Abadi’s article introduces PACELC and makes a key distinction: CAP constrains behavior when a partition actually exists, whereas replication creates a consistency-latency trade-off during normal operation.
First, in “CAP IS FOR FAILURES,” read the partition clarification. Notice the claim that CAP itself imposes no baseline restriction when there is no partition. Next, in “CONSISTENCY/LATENCY TRADEOFF,” read from “Unfortunately, there is a fundamental tradeoff between consistency, availability, and latency” through the normal-operation distinction. Continue through the discussion of synchronous, asynchronous, and quorum replication; relate each option to the acknowledgment policies from the previous lesson. Finally, in the “PACELC” section, begin with the sentence immediately after the heading and read the PACELC definition. Focus on why the partition branch and the latency branch are separate decisions.
A repeatable method for analyzing a CAP/PACELC incident
When reading an incident report or reviewing a proposed architecture, avoid beginning with “Is this database CP or AP?” Start with the decision and the failure boundary.
1. Name the operation and its correctness condition
“Inventory” is too broad. These are different operations with different contracts:
| Operation | Is a stale answer tolerable? | Typical preference |
|---|---|---|
| Product description read | Usually yes | Low latency and availability |
| Search index update | Usually yes, within a freshness bound | Eventual convergence |
| Add item to cart | Often yes, if conflicts can merge | Availability-oriented design |
| Reserve the final unit | Usually no | Coordinated consistency |
| Capture payment or finalize shipment | Usually no | Strong transaction or consensus semantics |
The key distinction is whether the operation changes an irreversible real-world outcome.
2. Specify the exact partition
State who cannot talk to whom. “The database was down” loses the useful detail.
For the example, the failure is:
- West replicas can communicate with West replicas.
- East replicas can communicate with East replicas.
- West and East cannot exchange replication or consensus messages.
- Both regions continue receiving local client traffic.
This is different from one failed process, a single unavailable availability zone, a slow leader, or an entire region loss. The quorum and failure-domain analysis from the previous lesson tells you whether the required acknowledgment set remains reachable.
3. State the policy on both sides of the partition
For each reachable side, ask:
- Can it acknowledge a write?
- Can it serve a read?
- Can it perform a conditional update?
- If it responds, can the response be based on stale state?
- If it accepts concurrent writes, how will the system reconcile them?
A strong answer is operationally explicit:
During loss of cross-region connectivity, the order service rejects new global inventory reservations unless a global consensus quorum is reachable. Catalog browsing and cached product information continue from the local region. The reservation client receives a retryable
temporarily unavailableoutcome rather than a confirmation based on possibly stale stock.
An availability-oriented version is equally explicit, but carries a compensation plan:
During loss of cross-region connectivity, each region accepts cart updates and provisional reservations locally. After connectivity returns, the system reconciles duplicate reservations by a deterministic ordering rule and sends compensating notifications to affected customers.
The latter is not automatically wrong. It simply moves complexity from the database’s request path into application-level reconciliation and customer handling.
4. Analyze the “else” branch separately
Once connectivity is restored, ask what a normal request waits for:
- a local replica;
- a local quorum;
- a remote replica;
- a global quorum;
- a leader;
- a consensus commit.
That waiting set determines typical and tail latency. It also determines what “durable” and “current” mean at the moment the client receives success.
For example, a system can be CP during a WAN partition yet still choose local, lower-latency reads in normal operation under a carefully limited read-your-writes or bounded-staleness contract. Conversely, a system can be AP under partition but normally pay for synchronous cross-region writes. The pair of policies matters more than the label.
5. Include recovery, not only steady state
After a partition heals, measure and verify:
- replication backlog and catch-up time;
- conflicting versions or duplicated business actions;
- repair and anti-entropy workload;
- the age of data served from each region;
- client retry volume and whether retries were idempotent;
- the latency spike while a leader is re-elected or replicas rejoin.
For an AP workflow, recovery is part of correctness. “We reconcile later” is incomplete until the architecture specifies how, which outcome wins, and who absorbs the cost of compensation.
Key takeaways
- CAP concerns behavior during an actual network partition. Partition tolerance is not a third feature to casually switch off in a distributed deployment.
- CAP consistency is a client-visible correctness property, commonly linearizability, not merely the fact that replicas eventually contain similar bytes.
- In the inventory scenario, a CP design rejects or delays uncoordinated reservations to prevent overselling; an AP design remains responsive but may require conflict resolution and business compensation.
- The quorum choices from the previous lesson become concrete under failure: a global quorum may be unreachable during a regional split, while independent local quorums can permit conflicting decisions.
- PACELC adds the normal-operation question: when there is no partition, does the system wait for coordination and pay latency, or acknowledge locally and accept a window of weaker consistency?
- Evaluate guarantees per operation and dataset. Product browsing, cart updates, payment capture, and globally scarce inventory do not need the same behavior.
Next, we will follow messages through retries and failures to distinguish at-most-once, at-least-once, and effectively-once processing. The same discipline will apply: first identify what was durably acknowledged, then determine what a retry can safely repeat.