Skip to content

CAP theorem and PACELC

The CAP theorem is the most quoted and most misquoted result in distributed systems. Stated precisely, it is narrow: when the network partitions, a replicated system must either refuse some requests or risk returning stale or conflicting data. PACELC adds the trade-off that matters the rest of the time: even with a healthy network, stronger consistency costs latency.

Eric Brewer stated CAP as a conjecture in 2000; Seth Gilbert and Nancy Lynch proved a formal version in 2002. The definitions are stricter than the everyday words:

  • Consistency (C) means linearizability: the system behaves as if there were one copy of the data. Every read returns the latest completed write, or something newer. It is not the C in ACID.
  • Availability (A) means every request to a non-failing node gets a non-error response, eventually. “Most requests succeed” is not enough.
  • Partition tolerance (P) means the system keeps its guarantees even if the network drops or delays messages between groups of nodes for any length of time.

The theorem: in a network that can lose messages, no system can provide both C and A for all requests. The proof is short. Put two replicas on opposite sides of a partition and send a write to one and a read to the other. The second replica must either answer, possibly with stale data (giving up C), or wait or fail until the partition heals (giving up A).

So the trade-off is forced only while a partition is happening. When the network is healthy, a system can be both consistent and available.

flowchart TB
  subgraph sideA["Majority side (2 of 3 replicas)"]
    direction LR
    c1["Client 1"] --> r1["Replica 1"]
    r1 --- r2["Replica 2"]
  end
  subgraph sideB["Minority side (1 of 3 replicas)"]
    direction LR
    c2["Client 2"] --> r3["Replica 3"]
  end
  sideA -.-|"network partition"| sideB

What the minority side does with Client 2’s request is the CP/AP choice:

CP behaviourAP behaviour
Write on minority sideRejected or times out (no quorum)Accepted locally, replicated after healing
Read on minority sideError, or redirect to the majorityAnswered from local data, possibly stale
After the partition healsNothing to reconcileConflicting writes must be merged: last-writer-wins, application merge, or CRDTs
Good fitLocks, leader election, configuration, money movement, uniqueness checksShopping carts, likes and counters, session data, caches, DNS
  • etcd runs Raft and serves linearizable reads and writes by default. Only a side holding a majority can commit. A client cut off with a minority gets errors, unless it explicitly asks for a serializable (possibly stale) read. This is why Kubernetes keeps its cluster state in etcd.
  • ZooKeeper needs a quorum for every write. Reads, though, are served by whichever server the client is connected to and can be stale. A client calls sync() first to catch up with the leader, and even that is not strictly linearizable, because sync is not a quorum operation. So ZooKeeper is consistent for writes but not linearizable for reads by default. This is a good example of why the CP label is too coarse.
  • CockroachDB describes itself as CP. Writes need a majority of replicas, reads are served by a leaseholder, and a range that loses its majority becomes unavailable rather than inconsistent.
  • Google Spanner is CP: a Paxos group that cannot form a quorum stops accepting writes. Brewer argues it is “effectively CA”: Google’s private network makes partitions rare, and he reports better than five nines of availability internally.
  • Apache Cassandra (and the original Dynamo design it borrows from) lets each request choose a consistency level. With ONE, any reachable replica can serve a read or write, so the system stays available and may return stale data. With QUORUM on both reads and writes, a majority of replicas must answer, so a minority partition cannot serve that request.
  • Amazon DynamoDB within one Region replicates each partition to three Availability Zones. A leader elected with Multi-Paxos handles writes and strongly consistent reads, and a write needs two of three replicas. Default reads are eventually consistent and can come from any replica. Global tables offer two modes. Multi-Region eventual consistency (the default) accepts writes in every Region and resolves conflicts with last-writer-wins — AP across Regions. Multi-Region strong consistency (generally available since June 2025) replicates each write synchronously to another Region before acknowledging it. It runs in exactly three Regions: three replicas, or two plus a DynamoDB-managed witness. That makes it CP across Regions.
  • “Pick two of three.” You cannot pick “CA” for a system that spans a network, because you cannot choose to have no partitions. A system that is “CA” simply breaks in undefined ways when a partition happens. Only a single-node system is truly CA.
  • “Our database is CP” (or AP). Most systems make different choices per operation, per table or per consistency setting. Many fit neither label exactly, like ZooKeeper’s reads above. Describe the behaviour of the specific operation instead.
  • “AP means it is always up.” CAP availability is about partitions, not about crashes, bugs, overload or bad deploys. A CP system with a quorum on the majority side is still highly available in practice: only clients stuck on the minority side see errors.
  • “Consistency” means ACID consistency. In CAP it means linearizability of single operations. It says nothing about transactions, invariants or isolation levels.
  • “Partitions are rare, so CAP is irrelevant.” Partitions include switch failures, misconfigured firewalls, long GC pauses and overloaded links. They happen often enough at scale. More important, the latency cost of coordination is paid on every request, not only during partitions. That is what PACELC captures.

PACELC: the trade-off when nothing is broken

Section titled “PACELC: the trade-off when nothing is broken”

Daniel Abadi’s PACELC extends CAP: if there is a Partition, choose Availability or Consistency; Else, choose Latency or Consistency. Keeping replicas strictly in sync means waiting for a quorum or a remote Region on each write, and sometimes on each read. Serving from the nearest replica without waiting is faster but may be stale.

System (default configuration)If partitionedElseNotes
Cassandra, Riak, original DynamoPAELCassandra defaults to ONE/LOCAL_ONE; Riak and Dynamo use sloppy quorums. Strict quorums move toward C
DynamoDB, single RegionPCELWrites need the leader and a quorum; default reads are eventually consistent. Strongly consistent reads → EC
DynamoDB global tables, multi-Region eventualPAELEvery Region accepts writes; last-writer-wins
DynamoDB global tables, multi-Region strongPCECWrites wait for a second Region
Google SpannerPCECExternally consistent by default; stale reads are an opt-in EL path
CockroachDBPCECSerializable by default; follower reads are an opt-in EL path
etcdPCECLinearizable by default; serializable reads are an opt-in EL path
HBase, Bigtable (one cluster)PCECEach key range is served by one server at a time. Bigtable replication across clusters is eventually consistent by default

The pattern in modern databases is consistent by default, latency on request. You get strong guarantees unless you explicitly ask for a stale read from a nearby replica (Spanner stale reads, CockroachDB follower reads, DynamoDB eventually consistent reads).

With N replicas, a write waits for W acknowledgements and a read queries R replicas. If R + W > N, every read set overlaps every write set in at least one replica, so a read can see the latest acknowledged write.

NWROverlap?Behaviour
322YesClassic majority quorum; tolerates one slow or failed replica
331YesFast reads; any replica failure blocks writes
311NoFastest and most available; reads may be stale
533YesTolerates two failed replicas

Overlap alone is not full linearizability. Concurrent writes, partially failed writes and “sloppy” quorums (writing to substitute nodes during failures) can still produce anomalies. Systems add synchronous read repair, consensus (Raft, Paxos) or compare-and-set operations when they need the strict guarantee. The mechanics are covered in replication.

Favour consistency (CP / EC)Favour availability and latency (AP / EL)
During a partitionMinority side returns errorsAll sides keep serving
Normal-case latencyQuorum or cross-Region round trips on writes (often reads too)Local replica answers immediately
Application complexitySimple: behaves like one copyMust handle stale reads and merge conflicts
Typical useLedgers, inventory reservation, locks, metadata, uniquenessFeeds, carts, counters, telemetry, caches
  • Consistency patterns — the models between “eventual” and “linearizable”.
  • Replication — leader-based, multi-leader and leaderless replication, and how quorums are implemented.
  • Availability patterns — failover and redundancy, which CAP says nothing about.
  • NoSQL — the stores that made tunable consistency mainstream.
  • SQL or NoSQL — choosing a datastore with these trade-offs in mind.
  • Consensus and coordination — how CP systems actually agree: majority quorums, Raft and what a partition costs the minority side.

Based on The System Design Primer by Donne Martin (CC BY 4.0). Restructured, rewritten and updated; site content is licensed under CC BY 4.0.