Skip to content
uencoder

CAP Theorem

The CAP theorem states that under network partition a distributed system can satisfy only one of consistency (C) or availability (A); all three cannot hold at once.

Purpose

To reveal the fundamental trade-off of distributed systems and guide data store selection.

Mechanism

Consistency (all nodes see the same view), availability (every request gets a response), partition tolerance (operation continues despite partitions). Since partitions are unavoidable, the practical choice is between CP (strong consistency) and AP (high availability). CP: ZooKeeper, Spanner; AP: Cassandra, DynamoDB.

Use cases

  • Distributed storage selection
  • Microservice data architecture
  • Multi-region deployment strategy
  • Consistency vs availability trade-offs

Examples

  • Input
    During a network partition
    Output
    Choose C (reject inconsistency) or A (allow it)

    CP vs AP

Common errors

Believing all three of CAP can be satisfied simultaneously
Partitions are unavoidable; choose between CP and AP

Related terms

References