cloudpatterns.appClassroomKatasWhiteboardBlog
Consistency & CoordinationChapter 13 · Agree to disagree

CAP & PACELC

CAP & PACELC

CAP says that when the network splits replicas apart, a store must choose — refuse some requests to stay consistent, or keep answering and risk old or conflicting data. It's often told as "pick two of three", but splits happen whether you pick them or not, so the real choice is only what to do during one. PACELC adds the everyday half — even with no split, a consistent answer across regions means waiting for a far copy (slower), and a fast one means a nearby copy that may be behind. Most stores let you make that choice per request.

Use when
Deciding what each operation does when a region or a replica can't be reached — wait, refuse or answer stale · Reading a database's marketing label ("CP", "AP", "CA") and asking what it really promises · Weighing the latency of consistent cross-region writes against stale reads in normal running
Avoid when
Labelling a whole system CP or AP instead of naming its consistency model per operation (core/consistency-models) · Treating CAP as the only trade — latency, crashes and transactions matter more on most days
Trade-offs
Choosing consistency in a partition means some users get errors or timeouts until it heals · Choosing availability means divergent copies that must be merged or compensated afterwards · With no partition, consistent writes pay round trips to far replicas; fast ones risk stale reads
Requires
Consistency models: strong to eventual
3 objectives · 5 misconceptions
  • explain Explain what CAP forces during a partition — refuse requests to keep consistency, or answer and risk stale or conflicting data — and why "pick two of three" misstates it.
  • predict Predict what PACELC's else branch costs with no partition — the extra wait of a consistent write or read against the staleness of a fast one.
  • choose Choose, per Ledger operation, which side to take in a partition and in normal running, and place a store — Cassandra, DynamoDB, Spanner, Cosmos DB — on PA/EL, PC/EC or in between.
  • Not true: You can pick any two of consistency, availability and partition tolerance — CA is a real option for a distributed store.
  • Not true: An AP system is inconsistent all the time, and a CP system is unavailable all the time.
  • Not true: The C in CAP is the same as the C in ACID.
  • Not true: Consistency costs something only when the network fails.
  • Not true: A whole database is either CP or AP, and that label tells you how it behaves.

Contrast with

No close look-alikes.

Progress is saved on this device