Course contentsShow
← System Design
Lesson 483 of 1,91914. CAP TheoremFree lesson

The CAP Tradeoff During Partitions

When a partition occurs, systems must choose between consistency and availability for affected operations.

The CAP Tradeoff During Partitions

What you'll learn: When network partitions split your distributed system, you must choose between keeping data consistent or keeping the system available.

Understanding the Forced Choice

You've learned that partitions (network splits) are inevitable in distributed systems. Now comes the hard part: during a partition, you cannot have both consistency and availability for the affected operations. You must pick one.

The Dilemma in Action

Imagine your database is split across two data centers. A network cable gets cut, creating a partition:

  • Choose Consistency (CP): Reject write requests until the partition heals. Your data stays perfectly synchronized, but users get error messages. You're unavailable but consistent.

  • Choose Availability (AP): Accept writes on both sides of the partition. Users can always write, but now you have conflicting data versions. You're available but inconsistent.

Real-World Example

Think of a bank account service during a partition:

CP approach: "Sorry, we can't process your withdrawal right now—our systems are temporarily disconnected." (Safe, but frustrating)

AP approach: "Withdrawal processed!" But if you withdrew money on both sides of the partition, your balance might go negative when systems reconnect. (Always responsive, but risky)

Why This Matters

The CAP theorem doesn't say you can never have all three—under normal conditions, you can! It says during a partition, physics forces you to sacrifice one. Your architecture must decide: which matters more for this specific use case—never showing stale data, or never refusing a request?

Key Takeaway: During network partitions, distributed systems face an unavoidable choice: sacrifice consistency to remain available (AP), or sacrifice availability to remain consistent (CP). Your business requirements determine which tradeoff to make.