Database Basics
Which is an appropriate description of the CAP theorem for a distributed database that keeps copies of data on multiple servers?
- AWhen the network between servers is partitioned, consistency (any server returns the latest value) and availability (every request gets a response) cannot both be fully satisfied at the same time
- BWith proper design, consistency, availability and partition tolerance can all be satisfied at the same time, always
- CPartition tolerance means duplicating network links so that the network between servers is never partitioned
Show answer and explanation
Answer: A. When the network between servers is partitioned, consistency (any server returns the latest value) and availability (every request gets a response) cannot both be fully satisfied at the same time
The CAP theorem shows that a distributed database cannot fully satisfy all three of the following at once: consistency (reading from any server returns the result of the latest write), availability (every server that has not failed responds to every request) and partition tolerance (the system keeps working even when communication between servers is cut). Since network partitions cannot be avoided in practice, the key point is that when a partition occurs, the system must choose between prioritizing consistency, stopping responses to some requests, and prioritizing availability, continuing to respond while allowing stale values to be returned. When there is no partition, both consistency and availability can be satisfied. Many NoSQL products prioritize availability and adopt eventual consistency, in which the copies converge over time. Partition tolerance is not about duplicating links; it is the property of continuing to operate even when a partition occurs.
- A. Correct. When a partition occurs, the system must choose whether to prioritize consistency or availability.
- B. The CAP theorem shows that all three cannot be fully satisfied at the same time.
- C. Partition tolerance is the property of continuing to operate when a partition occurs, not a mechanism for preventing partitions.