Back to Blog
System Design

The CAP Theorem: The Unavoidable Trade-Off in Distributed Systems

By Rakibul H. RabbiMay 21, 20252 min read
Featured
CAP TheoremDistributed SystemsDatabase AdministrationSQLBackend Development

In the world of distributed systems, compromise isn't failure — it's design.

What Is the CAP Theorem?

Proposed by Eric Brewer in 2000 and later proven formally, the CAP theorem outlines a trilemma faced when building distributed systems:

You cannot simultaneously guarantee Consistency (C), Availability (A), and Partition Tolerance (P).

You must pick any two, but not all three — especially during network partitions.

The 3 Pillars of CAP

  • Consistency (C): Every read reflects the most recent write.
  • Availability (A): Every request gets a response — though it may not be the latest data.
  • Partition Tolerance (P): The system continues to function despite network failures.

The CAP Trade-Off

In real-world distributed systems, network partitions are inevitable. So, we must choose:

CP — Consistency + Partition Tolerance

  • Sacrifices availability during failures.
  • Used in financial systems like banks and ATMs.
  • Prioritizes accuracy over uptime.

AP — Availability + Partition Tolerance

  • Sacrifices strong consistency.
  • Used in NoSQL systems like DynamoDB, Cassandra.
  • Prioritizes responsiveness over strict accuracy.

CA — Consistency + Availability

  • Only achievable in systems with no partitions (e.g., single-node systems).
  • Impractical for modern distributed systems.

Real-World Design Strategies

  • Eventual Consistency: Used in DNS, CDNs. Accepts temporary inconsistency for high availability.
  • Strong Consistency: Used in ledgers, inventory systems.
  • Tunable Consistency: Offered by Cassandra. Choose consistency per operation.
  • Quorum-Based Models: Paxos, Raft — decisions need a majority vote.

Beyond CAP: PACELC

CAP doesn't address tradeoffs when there is no partition.

PACELC says:

  • If Partition, trade Availability vs Consistency.
  • Else, trade Latency vs Consistency.

This framework reveals the subtleties CAP omits, making it a more practical tool for modern architects.

Final Thoughts

The CAP theorem is not a warning; it's a wisdom key for system designers.

Rather than chasing the impossible, embrace the trade-offs — and build systems that serve your application's deepest needs.

"Design is not about perfection — it's about choosing which imperfections you can live with."

Share this article

Published on

May 21, 2025