Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save miguel-vila/9f562901457d7022dc38 to your computer and use it in GitHub Desktop.
Save miguel-vila/9f562901457d7022dc38 to your computer and use it in GitHub Desktop.

CAP Twelve Years Later: How the "Rules" Have Changed

  • CAP prohibits only a tiny part of the design space: perfect availability and consistency in the presence of partitions, which are rare.
  • The modern CAP goal should be to maximize combinations of consistency and availability that make sense for the specific application.

ACID, BASE and CAP

  • In ACID, the C means that a transaction preserves all the database rules, such as unique keys. In contrast, the C in CAP refers only to single‐copy consistency, a strict subset of ACID consistency. ACID consistency also cannot be maintained across partitions—partition recovery will need to restore ACID consistency.
  • Isolation (I). Isolation is at the core of the CAP theorem: if the system requires ACID isolation, it can operate on at most one side during a partition. Serializability requires communication in general and thus fails across partitions. Weaker definitions of correctness are viable across partitions via compensation during partition recovery.

Why "2 of 3" is missleading

  • The easiest way to understand CAP is to think of two nodes on opposite sides of a partition. Allowing at least one node to update state will cause the nodes to become inconsistent, thus forfeiting C. Likewise, if the choice is to preserve consistency, one side of the partition must act as if it is unavailable, thus forfeiting A. Only when nodes communicate is it possible to preserve both consistency and availability, thereby forfeiting P.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment