Problem
Teams often cite the CAP theorem as a database label rather than a design constraint. Without explicit choices, partition behavior is accidental, and users see surprising errors or stale and conflicting data.
Apply the CAP theorem to make deliberate, per-operation choices between consistency and availability during network partitions.
Teams often cite the CAP theorem as a database label rather than a design constraint. Without explicit choices, partition behavior is accidental, and users see surprising errors or stale and conflicting data.
The CAP theorem says a distributed system cannot guarantee both linearizable consistency and availability when the network partitions. Its practical value lies in forcing the question of what each operation should do when replicas cannot talk to each other.
When a partition separates replicas, a consistency-first operation refuses to answer or write unless it can confirm agreement with a quorum. An availability-first operation answers from local state and accepts that replicas may diverge, to be merged afterward. Real systems mix both: a bank may reject transfers on the minority side while still showing balances marked as possibly stale. Even without partitions, the same trade appears as latency, because stronger consistency needs more coordination round trips.
# Per-operation consistency declaration
operations:
transfer_funds:
stance: consistency
quorum: majority
onPartition: reject
view_feed:
stance: availability
read: local
onPartition: serve_stale
add_to_cart:
stance: reconcilable
merge: set_union
Teams adopt this approach when designing a system that spans multiple zones or regions; selecting or configuring a distributed datastore. It is a poor fit when the system runs on a single node with no network partitions to consider, or when requirements are dominated by latency rather than partition behavior. The central tensions are consistency vs availability during partitions; latency vs consistency in normal operation; simplicity vs per-operation tuning. The main benefits are that it delivers: makes failure behavior an explicit design decision; aligns technical trade-offs with business risk; improves communication between product and engineering; guides datastore and replication choices. The main costs to budget for are: the binary framing hides latency and consistency spectrums; per-operation choices add design and testing effort; reasoning about partitions is hard to validate; mixed models complicate client logic. Governance typically looks like this: architecture review records the consistency stance for each data domain. Expect adoption cost to be low: mostly design discipline and testing, and a best fit for any team building distributed data systems. Critics point out that real systems sit on a spectrum, and the three-way choice oversimplifies them, and that PACELC better captures latency trade-offs that CAP ignores. Treat these concerns as design inputs, and revisit the decision as traffic, team size, and failure history change.