CAP Theorem Explained for Beginners

What should disconnected copies be allowed to promise?

A broken link separates data copies

Location AClient can reach authorised writer
Location BClient can reach an isolated older copy
A ↔ B communication fails. Client reachability does not mean copies can coordinate.
Two locations can each be reachable by a client while unable to communicate with each other. The relevant request behaviour must be explicit.

Two locations hold copies of a value. A network problem prevents them from communicating. A customer reaches one location while another customer updates the value at the other. The locations cannot simply assume they both know the latest result.

CAP describes a limit for distributed shared data under network partitions: you cannot guarantee both its strong consistency property and its availability property for all requests in that situation. It is more precise than a general slogan to “pick any two” in normal operation.

What you’ll learn

  • Explain a partition as lost communication between data owners.
  • Compare refusing an isolated operation with answering from an older local copy.
  • Distinguish CAP availability and consistency from everyday uptime and database validity.

Use the theorem’s meanings carefully

In this discussion, consistency means linearizability: operations behave as if applied to one current copy in an order respecting completed operations. It is not merely valid data types or the “C” in ACID transactions.

Availability in CAP requires requests to non-failing nodes to eventually receive a result rather than being refused because another node is unreachable. This formal property is different from a monthly availability percentage or a response-time objective.

A partition is a loss or delay of communication between parts of the system. If the system relies on that communication, it needs defined behaviour for the affected operations. Normal operation still involves latency, cost and consistency choices outside the theorem’s narrow impossibility result.

Read from the isolated location after a committed write

Choose the isolated read policy

A · authorised writerValue 1
B · read copyValue 1

Both copies hold 1. Disconnect the link, commit 2 at A, then read at B.

A is the only writer here. Reconnection immediately copies A to B in this model; real reconciliation requires a protocol.

Break the replication link, update the authorised writer and read at B. Both values and the read result remain visible.

Location A starts with value 1, and B has a copy of 1. Disconnect the link, then commit value 2 at A. In this deliberately asymmetric model, A is the authorised writer. B either refuses the isolated read or answers from its local older value, depending on the selected policy.

Refusing B’s read sacrifices availability for that read; returning 1 after A’s write completed does not provide the strong single-copy behaviour described here. Reconnecting immediately copies A to B in this toy model. Real systems need protocols for quorum, recovery and conflicts; this demonstration is not a database implementation.

Make the decision per operation

A product catalogue display may tolerate an older description for a while. Allocating the last available item or reserving a unique booking slot may need a different rule, such as refusing an isolated write or requiring an authoritative participant.

If disconnected sides both accept competing writes, reconnecting needs conflict rules. Last-writer-wins can discard an update; timestamps can be difficult to compare across machines. The acceptable behaviour depends on what the value means.

Do not treat a database brand as one permanent CAP label. Settings, operations, topology and failure conditions affect guarantees. Read the selected product’s actual consistency, read and write contracts.

Read the result and test the contract

The Gilbert and Lynch paper formalises the partition scenario and guarantees. The lab illustrates one consequence; it does not reproduce the proof. Source checked 6 October 2026.

When evaluating a service, ask what completes during a partition, which reads can be stale and what happens after communication returns. Test the configured operation with an explicit failure and observation boundary.

Compare latency and operating cost too. Blocking an operation may preserve an important rule while making the user wait or retry. Returning quickly is useful only if the result’s semantics are acceptable.

Check your design decision

A committed update at A is unavailable to isolated B. B immediately returns its older value. What guarantee does that read fail to provide?
Choose one answer. You can try again.

Answer and explanation

The strong single-copy behaviour described in this scenario.

The read began after the update completed but returned the older copy.

Check your design decision

Is “this database is always CP or AP” enough to specify your application’s behaviour?
Choose one answer. You can try again.

Answer and explanation

No. Check the operation, configuration, topology and failure contract.

A broad label does not state every actual read/write guarantee.

State the promise during lost communication

CAP concerns specific guarantees during partitions. Define the affected operation and decide what an isolated location may promise.

Use precise meanings, inspect actual product contracts and plan reconciliation. An uptime percentage and a CAP availability property answer different questions.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: What is Caching? →