System Design 101
Free · no account requiredLesson 8 of 9

Consistency, CAP & trade-offs

During a network partition, choose whether consistency or availability matters more.

Visual model

A partition forces a product choice

Read the flow
Choose per feature. Payments may favor correctness while a social feed may favor availability.

The CAP theorem, honestly

CAP describes a network partition. The system must choose consistency or availability until the nodes can communicate again.

Consistency means every read sees the latest write. Availability means every request still gets a response.

Partitions happen. The real choice is CP, which may refuse requests to stay correct, or AP, which stays up and reconciles later.

PACELC adds the healthy case. Even without a partition, stronger consistency usually costs extra coordination and latency.

Strong vs eventual consistency

Strong consistency means every read reflects the latest write. Use it for money, inventory and uniqueness constraints. It costs coordination and latency.

Eventual consistency lets replicas converge over time, so a read may be briefly stale.

It fits feeds, likes and view counts, where low latency matters more than seeing the latest value immediately.

See it

Choose consistency per feature

The same product can use strong consistency for money and eventual consistency for social counts.

Key takeaways

  • Partitions are unavoidable. Decide per feature whether to stay correct (CP) or stay up (AP).
  • Use strong consistency for money and uniqueness. Use eventual consistency for feeds and counts.
  • Even without partitions, stronger consistency costs latency. Do not pay for it when you do not need it.
0 of 9 lessons complete0%
Next: Sharding & partitioning