CAP theorem
The CAP theorem is a distributed-systems impossibility result stating that consistency, availability, and partition tolerance cannot all be guaranteed during a network partition.
Grokking Software Architecture
The CAP theorem states that a distributed system cannot simultaneously guarantee consistency, availability, and partition tolerance under network partition conditions.
- How it is used
- Frames consistency and availability as business-facing priorities to weigh when distributed systems encounter network partitions.
- How deep it goes
- Defines the guarantees and explains tradeoffs with scenarios, while stopping short of expecting readers to design distributed databases.
- Examples
- Uses a cross-region ticket sale, bank transfers, social feeds, and Friendster’s slow page loads to illustrate tradeoffs.
- What you can do after
- Evaluate tradeoffs by asking whether a use case can tolerate stale data in exchange for better availability.
Read how Grokking Software Architecture explains CAP theorem →
Unit Testing Principles, Practices, and Patterns
The CAP theorem states that a distributed data store cannot simultaneously guarantee consistency, availability, and partition tolerance under network partitioning.
- How it is used
- Frames trade-offs among unit-test attributes by analogy with distributed data-store guarantees.
- How deep it goes
- Defines all three guarantees and explains the two-out-of-three trade-off, but does not develop distributed-system implementation details.
- Examples
- Uses large-scale websites and product catalogs to illustrate why partition tolerance is required and availability can outweigh consistency.
- What you can do after
- Evaluate consistency-versus-availability choices in systems that must tolerate network partitions.
Read how Unit Testing Principles, Practices, and Patterns explains CAP theorem →
PostgreSQL Mistakes and How to Avoid Them
The CAP theorem states that a distributed data system cannot simultaneously guarantee strong consistency, availability, and partition tolerance under network partition.
- How it is used
- Frames multi-master replication as a tradeoff problem before treating bidirectional logical replication as a production architecture.
- How deep it goes
- Defines all three CAP guarantees, extends them with PACELC, and illustrates failures through replication conflicts rather than formal proof.
- Examples
- Uses two-way PostgreSQL logical replication with identity-key collisions and a renamed replicated column that stops a replication worker.
- What you can do after
- Evaluate/understand why multi-master designs require explicit tradeoffs and established conflict-aware solutions.
Read how PostgreSQL Mistakes and How to Avoid Them explains CAP theorem →
The Coder Cafe
The CAP theorem states that a distributed system cannot simultaneously guarantee strong consistency, availability, and partition tolerance when a network partition occurs.
- How it is used
- Frames distributed database design and selection as a choice among consistency, availability, and partition tolerance.
- How deep it goes
- Defines all three properties and contrasts CP, AP, and CA, without developing implementation algorithms or operational procedures.
- Examples
- Uses dropped or delayed node communication to contrast stale responses with failed requests during a partition.
- What you can do after
- Evaluate database designs and vendor choices by identifying their consistency, availability, and partition-tolerance trade-offs.
ScyllaDB in Action
The CAP theorem states that a distributed data system cannot simultaneously guarantee consistency, availability, and partition tolerance under network partition conditions.
- How it is used
- Guides distributed-database choices by exposing the availability and consistency consequences of network partitions.
- How deep it goes
- Defines the three properties, explains partition trade-offs, and connects them to replica consistency levels and database behavior.
- Examples
- Uses ScyllaDB and MongoDB classifications plus ALL, QUORUM, and ONE in a three-replica cluster.
- What you can do after
- Evaluate database behavior during partitions and select consistency levels according to correctness, availability, and failure-tolerance needs.
Think Distributed Systems
The CAP theorem is a formal impossibility result stating that, under its specified asynchronous system model, a distributed system cannot guarantee consistency and availability during a network partition.
- How it is used
- Frames replicated distributed-system design as a consistency-versus-availability decision during network partitions.
- How deep it goes
- Defines safety, liveness, and partitions, then demonstrates impossibility with an asynchronous three-node proof-by-contradiction model.
- Examples
- Uses a permanent N1–N2 partition, a write of v1, and a stale read of v0 to expose the contradiction.
- What you can do after
- Evaluate distributed-system guarantees and identify the consistency or availability compromise required during partitions.
Acing the Frontend Interview
The CAP theorem states that a distributed system cannot simultaneously guarantee consistency, availability, and partition tolerance under network partition conditions.
- How it is used
- Frames distributed-system failures and architectural trade-offs as interview evaluation topics.
- How deep it goes
- Defines all three properties, contrasts CP and AP systems, and introduces consistency trade-offs without detailing implementation internals.
- Examples
- Uses HBase as a CP example, DynamoDB as an AP example, and network partitions as the central failure scenario.
- What you can do after
- Evaluate architectural choices under network partitions and justify consistency or availability trade-offs in interviews.
Read how Acing the Frontend Interview explains CAP theorem →
Also covered in
What to know first
- distributed systemA distributed system is a computing system whose components run across multiple networked processes or machines and coordinate through communication.
- network partitionA network partition is a failure condition in which disrupted connectivity prevents groups of otherwise operating components in a distributed system from communicating reliably.
- availabilityAvailability is the degree or proportion of time that a system or service is operational and accessible when required.
- scalabilityScalability is the ability of a system or process to accommodate growth in workload, size, or demand while maintaining acceptable operation.
Related concepts
- availabilityuses · Availability is the degree or proportion of time that a system or service is operational and accessible when required.
- partition toleranceuses · Partition tolerance is the ability of a distributed system to continue operating despite communication failures between parts of the system.
- consistencyhas part · Consistency is the degree to which related data, behavior, or results agree with one another and conform to applicable rules or expectations.
- distributed systemuses · A distributed system is a computing system whose components run across multiple networked processes or machines and coordinate through communication.
- PACELC theoremcontrasts with · The PACELC theorem describes distributed-system tradeoffs: consistency versus availability during a network partition, and consistency versus latency when no partition occurs.
- AP systemconfigures · An AP system is a distributed system that preserves availability and partition tolerance during network partitions, potentially allowing temporarily inconsistent or stale results.
Questions about CAP theorem
What is CAP theorem?
The CAP theorem is a distributed-systems impossibility result stating that consistency, availability, and partition tolerance cannot all be guaranteed during a network partition.
Which Manning books explain CAP theorem?
Grokking Software Architecture, Unit Testing Principles, Practices, and Patterns, PostgreSQL Mistakes and How to Avoid Them, The Coder Cafe, ScyllaDB in Action, Think Distributed Systems and Acing the Frontend Interview.
What should I know before learning CAP theorem?
Manning books that teach CAP theorem usually introduce distributed system, network partition, availability and scalability first.
What is the difference between CAP theorem and PACELC theorem?
The CAP theorem is a distributed-systems impossibility result stating that consistency, availability, and partition tolerance cannot all be guaranteed during a network partition. The PACELC theorem describes distributed-system tradeoffs: consistency versus availability during a network partition, and consistency versus latency when no partition occurs.
What are the parts of CAP theorem?
CAP theorem includes consistency.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.






