Knowledge Guide
HomeSystem DesignCAP Theorem

Introduction to CAP Theorem

The CAP theorem is a fundamental concept in distributed system architecture that describes an unavoidable trade-off between three core requirements: Consistency, Availability, and Partition Tolerance. In simple terms, it states that a distributed system cannot guarantee all three at the same time. This principle, introduced by computer scientist Eric Brewer, matters because it guides how we design reliable systems. If you’ve ever wondered why a banking app would rather go offline than show incorrect data, or why a social media feed might show slightly stale posts during outages, the CAP theorem provides the answer. It’s a must-know concept for system design interviews and real-world technical decision-making.

Overview of the CAP theorem

The CAP theorem states that it is impossible for a distributed system to simultaneously provide all three properties: consistency, availability, and partition tolerance. In other words, a distributed system can only guarantee two out of these three properties at any given time. The theorem highlights the inherent trade-offs that system designers must consider when building distributed systems.

CAP Theorem
CAP Theorem

CAP theorem tells us that when a network partition occurs, a system must choose between being Consistent or being Available – it cannot be both. If there is no partition, you can have both C and A. But you must design assuming a partition will eventually happen. At that point, you sacrifice either consistency or availability. This is the crux of CAP: in the presence of a partition, you can only guarantee two of the three properties (since partition tolerance is usually non-negotiable, the real choice is between C and A). We’ll explore this trade-off and what it means for real systems in the next sections.

🤖 Don't fully get this? Learn it with Claude

Stuck on Introduction to CAP Theorem? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **Introduction to CAP Theorem** (System Design) and want to truly understand it. Explain Introduction to CAP Theorem from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **Introduction to CAP Theorem** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **Introduction to CAP Theorem** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **Introduction to CAP Theorem** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes