CAP Theorem
Communication failures force a choice between availability and strong consistency.
- PartitionPartition: Communication break between nodes.
- ConsistencyConsistency: Linearizable view of successful operations.
- AvailabilityAvailability: Every request to a non-failing node receives a response.
Context
Why this is important
Reason about response choices during a partition.
Reason about response choices during a partition.
CAP Theorem: inspect the decision
The shop example uses the existing shared database and seven modules. Any added service or deployment model is a hypothetical extension. The shop replicates stock availability across two sites. A partition separates them while customers request reservations. The team decides that a site rejects reservations without coordination to avoid double allocation; the product catalogue may temporarily show older availability. This different response follows the business risk of each operation. A CAP diagram does not replace a precise consistency guarantee and failure model.
This is how you read the picture
- Partition Partition
- Consistency Consistency
- Availability Availability
| Concept | Meaning | Review question |
|---|---|---|
| Partition | Communication break between nodes. | How does the shop respond during the replication partition? |
| Consistency | Linearizable view of successful operations. | Which guarantee is prioritized for reservations? |
| Availability | Every request to a non-failing node receives a response. | Which case does CAP address? |
Benefits & limitations
Helps if:
- Reason about response choices during a partition.
- Specify consistency guarantees and response behavior for each operation.
Boundaries
- CAP concerns partitions and precisely defined guarantees.
- The choice depends on the operation and partition; CAP does not explain blanket availability during normal operation.
In practice
- Separate the expected responses for catalogue display and authoritative stock reservation during a network partition; state availability and consistency for each operation.
- Describe what response the shop can return from a disconnected replica and whether a successful reservation requires a linearizable confirmation.
- Test the chosen policy for both operations during partition and recovery, and document how divergent stock counts are reconciled.
Read the detailed explanation
CAP describes a constraint on distributed data: during a network partition, a service cannot guarantee both linearizable consistency and availability for every request. Partition tolerance is an operating assumption for distributed systems, not a freely optional property.
The choice concerns responses during communication failure: some operations wait or fail to preserve consistency; others continue to answer and accept possible divergence. CAP is not a general three-way choice for systems without partitions and says nothing about scalability.
The shop example uses the existing shared database and seven modules. Any added service or deployment model is a hypothetical extension. The shop replicates stock availability across two sites. A partition separates them while customers request reservations. The team decides that a site rejects reservations without coordination to avoid double allocation; the product catalogue may temporarily show older availability. This different response follows the business risk of each operation. A CAP diagram does not replace a precise consistency guarantee and failure model. cap and pacelc help compare this decision with adjacent concerns.
Check your understanding
Test yourself in three stages
ReadingCheck in the picture
How does the shop respond during the replication partition?
View the solution with justification
Reservations are rejected while the catalogue remains readable.
ApplyingTransferred to a new situation
Which guarantee is prioritized for reservations?
View the solution with justification
Consistency for valid reservations over availability of every write.
EvaluateWeighing an alternative
Which case does CAP address?
View the solution with justification
Behavior during a network partition and precisely defined guarantees.
Explore further
These building blocks continue the thoughts of this page.
References
- Brewer’s conjecture and the feasibility of consistent, available, partition-tolerant web services (opens in new tab)Formal primary proof by Gilbert and Lynch.
- Perspectives on the CAP Theorem (opens in new tab)Technical discussion of the theorem's definitions and scope.
- Consistency Tradeoffs in Modern Distributed Database System Design (opens in new tab)Abadi distinguishes CAP failure cases from the trade-off during normal operation.