Skip to main content

Short note: CAP theorem

Short answer

The CAP theorem limits a distributed data store to two of Consistency, Availability, and Partition Tolerance. Since network partitions are inevitable, systems must trade off: CP (e.g., HBase) preserves consistency, possibly rejecting requests; AP (e.g., Cassandra) remains available but returns potentially stale data (eventual consistency).

Write a short note on CAP theorem.

The CAP theorem (Brewer's theorem) states that a distributed data store can provide at most two of these three guarantees at the same time: Consistency, Availability and Partition tolerance.

  • Consistency: every read returns the latest write, so all nodes show the same data.
  • Availability: every request to a working node gets a response (not an error), even if some nodes fail.
  • Partition tolerance: the system continues to operate when messages between nodes are lost or delayed because of a network split.

In a real distributed system, network partitions will happen, so partition tolerance is a must. The designer must choose, during a partition, between consistency and availability.

   C ---- A        CA: RDBMS (single node)
    \    /         CP: HBase, MongoDB, Redis
      P            AP: Cassandra, CouchDB, Dynamo
TypeGives upBehaviourExamples
CAPWorks only if network is reliableMySQL, Oracle
CPAMay reject requests to keep data correctHBase, MongoDB
APCAlways responds, data may be stale (eventual consistency)Cassandra, DynamoDB

Example: Two replicas of a shopping database lose connection. A CP system stops accepting writes on one side to avoid conflicting values. An AP system accepts writes on both sides and reconciles later.

The theorem explains why NoSQL systems use BASE (Basically Available, Soft state, Eventually consistent) instead of strict ACID.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Big Data Technologies chapter 4 questions →