• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

When a network partition occurs, the system must decide whether to return potentially stale data or refuse to respond. Applications like banking and inventory management cannot tolerate stale reads.

Core Idea

CP systems choose consistency over availability during network partitions. When nodes cannot verify they have the latest data, the system returns errors or times out rather than serving stale data. Consistency is guaranteed at all times, but availability is sacrificed during partitions.

How It Works

  1. Pre-partition: All nodes agree on the latest write. Reads go to any node and return the same value. Writes must be acknowledged by a majority/quorum before the client receives confirmation.
  2. Partition occurs: A subset of nodes becomes unreachable. The reachable nodes cannot confirm whether the isolated nodes have accepted a newer write.
  3. Reject to be safe: The reachable nodes refuse reads (return error or timeout) because they cannot guarantee the returned value is the most recent write.
  4. Partition heals: Nodes re-establish communication. Reconciliation replays any writes that were accepted by the isolated minority. The system resumes full operation.

Visual Explanation

G cluster_normal Normal Operation cluster_partition During Partition client Client Write w/ Quorum Ack n1 Node 1 (Primary) client->n1 n1->client success n2 Node 2 (Replica) n1->n2 sync write n3 Node 3 (Replica) n1->n3 sync write n2->n1 ack n3->n1 ack c2 Client Read n1p Node 1 (reachable) c2->n1p n1p->c2 ERROR: cannot guarantee consistency n_isolated Node 2 & 3 (unreachable) n1p->n_isolated consensus check label_cp CP: Consistency guaranteed, Availability sacrificed

Key Properties

  • Atomic consistent reads: Every read returns the latest write or an error — never stale data
  • May return errors during partition: Availability drops to zero for the affected data
  • Business-critical use cases: Banking, inventory, booking systems where stale data causes real harm
  • Synchronous replication: Writes are synchronously replicated to a quorum before acknowledgment

Connections

Edge Cases & Gotchas

  • Quorum failure: If a majority of nodes are lost during partition, the system becomes read-only or entirely unavailable until the partition resolves.
  • Tail latency in normal operation: The synchronous replication quorum means the slowest node in the quorum determines write latency.
  • Not all CP is equal: Some CP systems (e.g., ZooKeeper) prioritize partition recovery speed, while others (e.g., traditional RDBMS with sync replication) may remain unavailable for longer.