SysDesignAtlas

CAP, PACELC & the Real Tradeoff

Why "pick two of three" is wrong, what a partition actually forces you to choose, and the tradeoff that matters far more in practice — the one you make when nothing is broken.

CoreMedium11 min readcapconsistencyavailability
Confidence

#The theorem, stated correctly

CAP is the most-cited and most-misquoted idea in system design. The pop version — "pick two of Consistency, Availability, Partition tolerance" — is wrong in a way that leads to real design errors.

A network partition is the situation this whole theorem is about: two groups of your machines are each alive and working, but can't reach each other. Not "a server crashed" — both halves are running, and each one cannot tell whether the other is dead or merely unreachable.

The actual statement:

In the presence of a network partition, a distributed system must choose between consistency and availability.

The terms, precisely:

  • C (Consistency) — here meaning linearizability: every read sees the most recent completed write, so the whole system behaves as though there were only ever one copy of the data, no matter how many machines actually hold it. Note this is not the C in ACID (the database transaction guarantees), which is about database rules staying satisfied. Same letter, different concept, and conflating them produces genuinely wrong designs.
  • A (Availability) — every request to a non-failed node receives a non-error response. Note: it says nothing about latency. A response after 90 seconds is "available" by this definition, which is one reason CAP is less practically useful than it appears.
  • P (Partition tolerance) — the system continues operating when the network drops or delays messages between nodes.

#Why "pick two" is nonsense

You do not choose P. Partitions are a property of networks, not a design option. Cables get cut, switches fail, routes flap, a datacenter loses connectivity. If your system spans more than one machine, partitions will happen.

So "CA" is not an available choice for a distributed system. Claiming CA means claiming your network never fails — and when it does, you get neither C nor A.

The real decision is binary and only applies during the partition:

              Partition happens: nodes A and B can't talk

    ┌──────────────────────────┬──────────────────────────┐
    │  CP: choose consistency  │  AP: choose availability │
    ├──────────────────────────┼──────────────────────────┤
    │  Minority side REFUSES   │  BOTH sides ACCEPT       │
    │  reads/writes            │  reads/writes            │
    │                          │                          │
    │  ✓ never returns stale   │  ✓ always answers        │
    │  ✗ some users see errors │  ✗ replicas diverge;     │
    │                          │    must reconcile later  │
    └──────────────────────────┴──────────────────────────┘

There's no third door. Either you refuse to answer without confirmation you're current, or you answer and risk being wrong.

#CP in practice

The minority side stops serving. Concretely: a system using majority quorums — a write counts only once more than half the nodes have agreed to it — (Raft, Paxos, ZooKeeper, etcd, Spanner, HBase, and MongoDB in its default configuration) elects a leader on the majority side. The minority — say 2 of 5 nodes — can't reach quorum, so it rejects writes and (for linearizable reads) rejects reads too.

Consequence: if your cluster splits 3/2, roughly 40% of your capacity goes dark rather than serve possibly-stale data.

Right for: financial ledgers, inventory with hard limits (last concert ticket), unique username assignment, distributed locks, configuration and service discovery, anything where two answers can't both be right.

#AP in practice

Every node keeps serving from whatever it has. Writes are accepted on both sides, so replicas diverge and must be reconciled when the partition heals.

Reconciliation strategies, weakest to strongest:

  • Last-write-wins by timestamp. Simple, but the losing write is silently thrown away. It also trusts each machine's clock, and clocks on different machines drift apart — so the "latest" timestamp may not belong to the write that actually happened last. Fine for caches, dangerous for user data.
  • Vector clocks / version vectors — detect when two writes happened without either one having seen the other, and hand both versions (siblings) to your code to merge. Correct, but pushes the merge decision onto you.
  • CRDTs — data structures designed so that replicas always end up identical, whatever order the updates arrive in. Example: a like counter where each replica counts only its own likes, and the total is the sum of all of them. The best option when your data fits one (counters, sets, text).
  • Application-level merge — a shopping cart union, a "you have conflicting edits" prompt.

Right for: social feeds, view/like counters, product catalogs, shopping carts, DNS, session stores, anything where availability beats momentary precision. Dynamo, Cassandra, Riak, and CouchDB sit here.

#PACELC — the more useful model

CAP only says anything about partitions, which are rare. PACELC (Abadi, 2010) extends it to the 99.9% of the time when the network is fine:

If Partition → choose Availability or Consistency. Else → choose Latency or Consistency.

The ELC half is the one that shapes your architecture day to day. Even with a perfect network, keeping copies in agreement means the machines have to talk to each other before answering — and every one of those conversations is a round trip you pay for in latency. A strongly consistent write across three copies in three availability zones (AZs — separate buildings in the same region, so they don't fail together) costs at least one trip between buildings. Across regions, it costs tens to hundreds of milliseconds — irreducibly.

So the everyday tradeoff is: do you pay latency on every single operation to guarantee freshness?

SystemPartitionElseReading
SpannerPCECConsistency always; pays latency (TrueTime commit-wait: each commit waits out clock uncertainty)
DynamoDB (default)PAELFast and available; eventually consistent reads
DynamoDB (strong reads)PCECOpt into consistency per request, pay for it
Cassandra (default)PAELTunable, but defaults to speed
MongoDB (default)PCECMajority writes to primary
Redis (async replica)PAELReplication is async; failover can lose writes
PostgreSQL (sync replica)PCECCommit waits for standby ack

#Consistency is per-operation, not per-system

The strongest correction to the whole CAP framing: real systems don't pick one point on the spectrum. They pick one per operation, because different data has different costs of being wrong.

In a single e-commerce system:

OperationChoiceWhy
Add to cartAPNever block a purchase; merge carts on conflict
Product reviewsAPStale by 30s is invisible
Inventory displayAP"In stock" can be approximate
Checkout / decrement stockCPOverselling is a real cost
Payment captureCPNon-negotiable
Order historyAP (read replica)Slightly stale is fine
RecommendationsAPPrecomputed, staleness expected

Notice how little of the system needs strong consistency — typically only the transactional core. Recognizing that lets you keep the fast, cheap, available path for most traffic and pay for coordination only where it's genuinely required. That is what mature architectures actually look like, and saying so is a strong signal.

#What CAP doesn't tell you

Be ready for this pushback, because it's the follow-up a strong interviewer asks:

  • It ignores latency. A system that responds in 30 seconds is "available." Users disagree. In practice, a slow response and an error are the same thing.
  • It's binary. Real partitions are partial and asymmetric — one node reachable from some peers but not others, high packet loss rather than a clean break, or gray failures, where a node still passes health checks but is too slow or broken to do real work.
  • Its "C" is only linearizability. There's a whole spectrum of useful weaker guarantees — causal consistency, read-your-writes, monotonic reads — that CAP flattens into "not C". See Consistency Models; those middle options are where most good designs actually live.
  • It says nothing about durability — whether a write you were told succeeded survives a crash — which is often the property people actually cared about.

#Check yourself

State CAP correctly.Show answer
When a network partition happens, a distributed system must choose between consistency (linearizability) and availability. It is not "pick any two".
Why is "CA" not an option for a distributed system?Show answer
Partitions are a property of networks, not a design choice — cables get cut and switches fail. Claiming CA means claiming the network never fails; when it does, you get neither.
In a CP system that splits 3/2, what does the minority side do, and what does it cost?Show answer
It can't reach a quorum, so it refuses writes and linearizable reads. Roughly 40% of capacity goes dark rather than serve possibly stale data.
Name three ways an AP system reconciles diverged replicas, weakest first.Show answer
Last-write-wins by timestamp, which silently loses data; version vectors, which surface conflicts to the application; CRDTs, which converge mathematically; or an application-level merge such as a cart union.
What does PACELC add to CAP?Show answer
Else — when there is no partition — choose latency or consistency. Keeping copies in agreement costs round trips on every operation even on a healthy network, and that everyday trade shapes architecture more than partitions do.
Cassandra is "AP". When can it give strong-ish consistency?Show answer
It is tunable per query. QUORUM reads and QUORUM writes with three replicas give R + W > N, so reads see the latest write — at the cost of availability when a quorum can't be reached.
In an e-commerce system, which operations need CP and which can be AP?Show answer
CP: checkout stock decrements and payment capture, where overselling or double-charging costs real money. AP: cart, reviews, catalogue, recommendations, order history, where brief staleness is invisible.
Name two things CAP doesn't tell you.Show answer
It ignores latency (a 30-second answer counts as "available"), treats partitions as clean and binary, flattens the whole spectrum of weaker guarantees into "not C", and says nothing about durability.

#What to carry forward

  • CAP only applies during a partition: refuse to answer to stay correct (CP), or answer and reconcile later (AP).
  • Partition tolerance is not optional, so "CA" is not a real choice for a distributed system.
  • PACELC's "else" half — latency versus consistency on a healthy network — is the trade you make every day.
  • Choose per operation, not per system: usually only the transactional core needs strong consistency.
  • Know CAP's blind spots: latency, partial partitions, the middle of the consistency spectrum, durability.
00:00
/ 11m