Skip to content

What is CAP

Published: at 03:57 PM

Table of contents

Open Table of contents

Why CAP Exists

A single-node database does not usually force this conversation. A distributed system does, because messages can be delayed, dropped, duplicated, or split across network boundaries.

Once you replicate data across nodes, you have a new failure mode:

Now the system must decide what to do.

Loading graph...

The Three Terms

Consistency

In CAP, consistency means linearizability.

If a write completes successfully, every later read must return that value or a newer one. Clients should observe one coherent, up-to-date view of the data.

This is different from ACID consistency.

Confusing those two is a common source of bad architecture discussions.

Loading graph...

Availability

Availability means every request to a non-failing node receives a response.

The important part is not “a successful response.” The important part is that the system responds instead of blocking forever waiting for coordination that may never arrive.

That response could be:

What CAP cares about is whether the node remains responsive.

Partition Tolerance

Partition tolerance means the system continues operating despite communication failures between nodes.

In real distributed systems, partitions are not optional. Networks fail. Cross-zone and cross-region links degrade. Timeouts happen. Packets disappear.

That is why serious distributed systems are always designed with partitions in mind.

The Actual Tradeoff

When there is no partition, many systems can provide both strong consistency and high availability.

The hard case is when a partition occurs.

At that moment, a replicated system must choose:

This is why “CA system” is mostly a classroom label in distributed settings. Once a partition exists, a distributed system cannot ignore it. It either handles it by sacrificing availability or by sacrificing strong consistency.

Loading graph...

Loading graph...

A Concrete Example

Assume you run a service with two replicas:

Both store user profile data.

Now the network link between the zones fails.

If you choose consistency

You may reject writes on one side, or reject reads that cannot be proven fresh.

That keeps all successful operations linearizable, but some clients now see failures or timeouts.

This is a CP choice.

If you choose availability

You let both sides continue accepting traffic.

Clients keep getting responses, but some reads may return stale data and conflicting writes may need reconciliation later.

This is an AP choice.

That is the real meaning of CAP: during a partition, you do not get both.

Loading graph...

What CAP Does Not Say

CAP is useful, but it is narrow.

It does not tell you:

Two systems can both be “AP” and still behave very differently in practice.

How Engineers Actually Use CAP

Staff-level system design should use CAP as a failure-model lens, not as a branding label.

The right question is not:

The right questions are:

Those questions are operationally meaningful. “Pick two” is not.

Real-World Intuition

Different product domains make different choices.

Prefer consistency

Systems often lean toward consistency when the cost of stale or conflicting data is high:

If two nodes disagree about a bank balance or whether a lock is held, the damage can be serious.

Prefer availability

Systems often lean toward availability when serving something is better than failing:

If one user sees a slightly stale follower count for a few seconds, that may be acceptable.

CAP and Modern Databases

Modern systems often expose this tradeoff as configuration rather than a fixed identity.

Examples include:

That is why reducing a database to a single CAP label is often misleading. The practical answer depends on topology, read path, write path, quorum policy, and failure scenario.

CAP Versus ACID

ACID and CAP answer different questions.

ACID asks:

CAP asks:

A system can care about both at the same time. For example, a database may provide ACID transactions on each node while still making CAP tradeoffs across replicas during partitions.

Closing View

CAP is not a slogan about choosing any two properties you like.

It is a precise statement about the cost of replication under network failure: when partitions happen, you must choose whether to preserve strong consistency or remain fully available.

That framing is what makes CAP useful in real architecture work.