liveBook · Manning

CAP theorem

As explained in 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.

The CAP theorem states that a distributed data store cannot simultaneously guarantee consistency, availability, and partition tolerance. Under network partitioning, it must trade off consistency against availability because partition tolerance is non-negotiable for large-scale systems. section 4.4

The three guarantees are:

  • Consistency: every read receives the most recent write or an error. section 4.4
  • Availability: every request receives a response, except during outages affecting all nodes. section 4.4
  • Partition tolerance: the system continues operating despite lost connections between network nodes. section 4.4

Choosing availability

A product catalog can tolerate some stale information, so availability may take priority over strict consistency. The same two-out-of-three framing is compared with trade-offs among unit-test attributes. section 4.4

How Unit Testing Principles, Practices, and Patterns covers it

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.
How it connects
Connects consistency, availability, partition tolerance, unit testing, regression protection, fast feedback, and refactoring resistance.

Also explained in

Compare how 4 books explain CAP theorem →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Unit Testing Principles, Practices, and Patterns. The section links point to the parts of the book it draws on.