CAP Theorem

The CAP theorem: a distributed data store can provide only two of three guarantees simultaneously.

  • JSON4,239 B
  • YAML3,083 B · −27%
  • TOON2,840 B · −33%

The CAP theorem's three guarantees (consistency, availability and partition tolerance) and what choosing CP or AP implies, extended with the PACELC refinement that describes the latency-versus-consistency trade-off when there is no partition.

Use it when

  • You are explaining distributed-database trade-offs.
  • You need to check that a CAP claim about a product is stated correctly.

Watch out for

  • CAP applies to behavior during a partition. Saying a database 'is CP' or 'is AP' is a simplification that products often do not fit exactly.
  • Consistency in CAP means linearizability, which is stricter than the 'C' in ACID.

The data

GuaranteeDescriptionImplicationTradeoffExamples
ConsistencyEvery read receives the most recent write or an error.All nodes see the same data at the same time.nullnull
AvailabilityEvery request receives a response, without guarantee that it contains the most recent write.Every node remains operational.nullnull
Partition ToleranceThe system continues to operate despite network partitions.Messages between nodes may be lost.nullnull
nullSacrifices availability during partitions.nullCP (Consistency + Partition Tolerance)HBase, MongoDB (in strict mode), Bigtable
nullSacrifices strong consistency during partitions.nullAP (Availability + Partition Tolerance)Cassandra, DynamoDB, CouchDB
PACELC (extension)If there is a Partition, choose Availability or Consistency; Else, choose Latency or Consistency.Captures that replication costs latency even when the network is healthy.nullnull
CA (single node)Consistency and availability without partition tolerance, achievable only when there is no network partition to tolerate.Describes a single-node or tightly coupled system rather than a distributed one.nullnull

Fields

The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.

SectionFieldTypeExample
dataguaranteestringConsistency
datadescriptionstringEvery read receives the most recent write or an…
dataimplicationstringAll nodes see the same data at the same time.
datatradeoffstringCP (Consistency + Partition Tolerance)
dataexamplesstringHBase, MongoDB (in strict mode), Bigtable

Fetch the same bytes

The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.

curl "https://yjtoon.yunusemrevurgun.com/api/dataset/cap-theorem?format=toon"
const res = await fetch(
  "https://yjtoon.yunusemrevurgun.com/static-data/dataset/cap-theorem.toon"
);
const toon = await res.text();

Rate limit: 120 requests per minute per IP, no key and no signup. API reference →

Topics

  • database
  • cap
  • consistency
  • availability
  • partition

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets