Tutorials System Design Mastery

The CAP Theorem: Consistency, Availability, or Partition Tolerance?

On this page

The CAP Theorem

In a distributed system, it is mathematically Impossible to simultaneously provide more than two out of the three following guarantees: Consistency, Availability, and Partition Tolerance.

1. The Three Pillars

  • Consistency (C): Every read receives the most recent write or an error. (The system looks like a single node).
  • Availability (A): Every request receives a (non-error) response, without the guarantee that it contains the most recent write.
  • Partition Tolerance (P): The system continues to operate despite an arbitrary number of messages being dropped or delayed by the network between nodes.

2. The Crucial Choice: CP vs AP

In a world where networks fail (P is mandatory), you must choose:

  • CP (Consistency/Partition): If the network fails, stop responding to requests to ensure data stays valid. (e.g., Banking systems).
  • AP (Availability/Partition): Keep responding to requests but allow nodes to have different versions of the data temporarily. (e.g., Facebook Likes or Youtube views).

4. Interview Mastery

Q: "Why is Partition Tolerance mandatory in the real world?"

Architect Answer: "Because the network is the most unreliable part of any system. Routers crash, cables are cut, and latency happens. If you build a system that is 'CA' (No Partition Tolerance), your entire system will crash the moment one network switch fails. Therefore, every modern distributed architecture is a trade-off between Consistency (CP) and Availability (AP) during a network partition."

Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

System Design Mastery
Course syllabus
1. Distributed Systems Fundamentals
2. Database Scalability
3. Caching & CDN Strategies
4. Event-Driven Architecture
5. High Availability & Load Balancing
6. Microservices & API Gateway
7. Monitoring & Disaster Recovery
8. FAANG System Design Interview
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details