← Lessons

quiz vs the machine

Silver1100

System Design

Consistency vs Availability

The choice a distributed system must make the moment the network splits in two.

4 min read · intro · beat Silver to climb

The forced choice

The CAP theorem says that when a network partition cuts a distributed system into isolated groups, you can keep consistency or availability, but not both. A partition is not optional, so this is a real choice every distributed system faces.

  • Consistency here means every read sees the latest committed write.
  • Availability means every request gets a non error response.

What each choice looks like

  • A CP system refuses to answer on the minority side during a partition rather than risk returning stale data. A bank ledger often picks this.
  • An AP system keeps answering on both sides and reconciles later. A shopping cart or social feed often picks this.

It is not all or nothing

When there is no partition, a system can offer both strong consistency and high availability. The trade only bites during the partition window, which is why the duration and frequency of partitions matter so much.

The right answer depends on what is worse for your users, a wrong answer or no answer.

Key idea

During a network partition a system must choose to stay consistent and reject some requests or stay available and risk stale data.

Check yourself

Answer to earn rating on the learn ladder.

1. When does the CAP trade actually force a choice?

2. What does a CP system do during a partition?