DEV Community

Tanay Karmarkar
Tanay Karmarkar

Posted on

WTH is CAP Theorem Really?

CAP tells you what happens during a partition. PACELC tells you what happens the other 99.9% of the time: you trade latency for consistency on every single write, partition or not. If you only design for CAP, you have ignored the trade-off that shapes your p99.

  1. CAP, Precisely Stated In the presence of a network partition (P), a system can provide at most one of: Consistency (C — linearizability) or Availability (A — every non-failed node responds). The theorem is narrower than folklore: it says nothing about normal operation, it compares linearizability against total availability, and it assumes the partition is real. Many "CA systems" in slideware are CA only because the slides omit P.

CP: Refuse to answer on the minority side. etcd, Consul, Spanner, CockroachDB (majority required).
AP: Answer from any replica, reconcile later. Cassandra, DynamoDB, CouchDB (tunable, but AP by default).
In production the partition is not hypothetical — it is a rolling kernel upgrade that holds a rack's switch for 11 seconds, an AZ failure, or a noisy neighbor saturating the NIC. Your "rare partition" happens monthly.

  1. #PACELC: The Trade-Off You Pay Every Day Daniel Abadi's PACELC completes the picture....read more here

WTH is CAP and PACELC? — Tanay Karmarkar

WTH is CAP and PACELC? CAP tells you what happens during a partition. PACELC tells you what you pay the other 99.9% of the time.

portfolio.tanaykarmarkar.com

Top comments (0)