- 2073 Bhadra · 5 marks
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
| Type | Gives up | Behaviour | Examples |
|---|---|---|---|
| CA | P | Works only if network is reliable | MySQL, Oracle |
| CP | A | May reject requests to keep data correct | HBase, MongoDB |
| AP | C | Always 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)
Related questions
- NoSQL term and CAP theorem · Big Data Technologies, chapter 4