← Lessons

quiz vs the machine

Gold1450

System Design

The CAP Theorem

Why a distributed store cannot promise both perfect consistency and full availability during a network split.

4 min read · core · beat Gold to climb

Three properties

The CAP theorem describes a distributed data store using three properties:

  • Consistency means every read sees the most recent write.
  • Availability means every request gets a non error response.
  • Partition tolerance means the system keeps working even when the network drops messages between nodes.

The real choice

Networks fail, so partition tolerance is not optional for a real distributed system. The theorem says that during a partition you must choose between consistency and availability.

  • A CP system refuses or blocks requests it cannot serve correctly, sacrificing availability to avoid stale or conflicting data.
  • An AP system keeps answering on both sides of the split, sacrificing consistency and reconciling later.

Beyond the partition

When the network is healthy a system can offer both. The trade also has a latency dimension: even without a partition, stronger consistency usually costs more coordination and therefore more delay. Many real systems tune consistency per operation rather than picking one global mode.

Key idea

When the network splits you must choose between answering every request and never returning stale data.

Check yourself

Answer to earn rating on the learn ladder.

1. According to CAP, what must you trade off during a network partition?

2. Why is partition tolerance treated as non optional in practice?