DistributedExpert

What does CAP mean for a system you actually run?

“Explain CAP without the "pick two" slogan. For a multi-region user-profile store, what happens during a partition under each choice, and how do quorums fit in?”

What this tests

  • Partition tolerance as a given; the real choice is behaviour during a partition
  • Concrete consequences: refuse writes vs accept divergent writes and reconcile
  • Quorums (W + R > N) and what they do and do not guarantee
  • PACELC: the latency-vs-consistency tradeoff when there is no partition

Answers by level

Read the beginner answer first and notice what is missing.

Partitions are not optional in a system that uses a network; timeouts are partitions from the caller's view. So the question is only: when the two regions cannot talk, does a region refuse operations it cannot confirm with the other (consistency: some users get errors), or accept them locally (availability: both sides keep serving, their data diverges, and someone must reconcile when the link returns)? Neither is free — one gives users errors, the other gives them stale or conflicting state.

Quorums make this tunable per operation: with N replicas, write to W and read from R; if W + R > N, a read overlaps the latest write, so you get read-your-latest-write without waiting for all replicas. N = 3, W = 2, R = 2 tolerates one replica down. But during a partition where a region only reaches one replica, W = 2 cannot be met, and the system must either fail the write (CP) or lower W to 1 for that region (AP with divergence) — see CAP and Distributed Systems and Distributed Consistency: CAP, Quorums, Consensus.

Green flags · Red flags

Strong green flag · Explains why the minority side of a partition must lose writes in a CP design and gives the consensus mechanism that enforces it.
Green flags
  • States that partitions (and timeouts) are a given and reframes the choice as partition behaviour
  • Describes concrete effects: errors vs divergence and reconciliation
  • W + R > N with a worked N/W/R example and its limits
  • Brings in PACELC and cross-region latency numbers
  • Decides per operation (uniqueness CP, display name AP)
Red flags
  • "Pick two: we chose AP because availability matters more."
  • Believes quorum reads give linearizability automatically
  • Claims a system is "CA"
  • Cannot say what happens to a write on the minority side

Follow-up questions

F1
N = 3, W = 1, R = 1. What do you get and what do you lose?
F2
Two regions both accepted a username change during a partition. How do you reconcile?
F3
What does linearizable mean, in one sentence?

Scenario

A user-profile service runs in Frankfurt and Virginia with synchronous replication; a 9-minute inter-region link failure made both regions return 503 for every profile update, though 95% of updates were avatar and bio changes. The team now wants to switch to fully asynchronous replication with last-writer-wins. Evaluate both extremes and propose a per-operation design, including how username uniqueness is handled.

Learn this topic