Course contentsShow
← Software Engineering
Lesson 1408 of 1,93341. Scalability and Distributed SystemsFree lesson

CP Systems: Choosing Consistency Over Availability

How CP systems prioritize consistency during partitions, sacrificing availability, and when this trade-off makes sense.

CP Systems: Choosing Consistency Over Availability

You'll learn when and why systems sacrifice availability to maintain data consistency during network partitions.

What CP Systems Choose

When a network partition occurs, CP systems (from the CAP theorem) prioritize consistency over availability. This means they'll refuse to serve requests that might violate consistency guarantees, even if parts of the system are still operational.

How CP Systems Behave

During a partition, a CP system will:

  • Reject writes to nodes that can't reach the leader or coordinator
  • Refuse reads that might return stale data
  • Block operations until the partition heals or consensus is restored
  • Return errors rather than potentially incorrect data

Think of it like a bank vault: if the verification system can't confirm your identity with the main database, the vault stays locked—even if you're probably the right person. Better safe than sorry with money.

When CP Makes Sense

Choose CP systems when:

  • Data correctness is critical: financial transactions, inventory counts, user account balances
  • Inconsistent data causes real harm: double-booking resources, overselling products
  • You can tolerate downtime: scheduled maintenance windows are acceptable
  • Strong guarantees matter more than speed: regulatory compliance, audit trails

Examples: Traditional relational databases in strict serializable mode, systems using consensus protocols like Raft or Paxos, distributed coordination services like ZooKeeper.

The Trade-off in Action

If your e-commerce inventory system is CP and a partition occurs, it might refuse to sell items rather than risk overselling. Users see "service temporarily unavailable," but you never accidentally sell the same item twice.

Key Takeaway: CP systems choose to be unavailable during partitions rather than risk serving incorrect data—essential when consistency violations have real-world consequences that outweigh temporary downtime.