CAP Theorem and Trade-offs

Understanding fundamental distributed systems constraints:

CAP Theorem Components:

  • Consistency: All nodes see the same data at the same time
  • Availability: Every request receives a response
  • Partition tolerance: System continues to operate despite network partitions

CAP Trade-offs:

  • CA: Consistent and available, but not partition tolerant
  • CP: Consistent and partition tolerant, but not always available
  • AP: Available and partition tolerant, but not always consistent

Example CAP Choices:

  • CP Systems: Traditional RDBMS, ZooKeeper, etcd
  • AP Systems: DynamoDB, Cassandra, CouchDB
  • CA Systems: Single-node databases (not truly distributed)

PACELC Extension:

  • During Partition (P), choose between Availability (A) and Consistency (C)
  • Else (E), choose between Latency (L) and Consistency (C)

Consistency Models:

  • Strong consistency
  • Sequential consistency
  • Causal consistency
  • Eventual consistency
  • Read-your-writes consistency
  • Monotonic read consistency
  • Monotonic write consistency

Resilience Patterns and Strategies