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

Consistency vs Availability in Practice

Real-world scenarios where CP or AP choices significantly impact user experience and system behavior.

Consistency vs Availability in Practice

What you'll learn: How choosing consistency or availability affects real user experiences in production systems.

When network partitions happen (and they will), your system must choose between consistency and availability. This isn't just theoretical—it shapes how users interact with your application every day.

CP Systems in Action

Consider a banking application. When you transfer $100 between accounts, the system must ensure both the debit and credit happen atomically. If a network partition occurs, a CP system will reject transactions rather than risk inconsistent account balances. The user sees an error message: "Service temporarily unavailable." This is frustrating, but better than incorrect balances that could lose customer trust or violate regulations.

Example: MongoDB (in replica set mode) stops accepting writes during partition until it can ensure consistency across the majority of nodes.

AP Systems in Action

Now imagine a social media feed. When you "like" a post, it's acceptable if different users see slightly different like counts for a few seconds. An AP system keeps accepting likes even during partitions, letting temporary inconsistencies exist. Users experience no downtime—they can always interact with the app—even if the data takes time to converge.

Example: Cassandra allows writes and reads to continue during partitions, eventually reconciling conflicts once the partition heals.

The User Experience Gap

CP systems sacrifice availability for correctness: users get errors but never see wrong data.

AP systems sacrifice immediate consistency for uptime: users always get responses, but might see stale or conflicting data temporarily.

Your choice depends on your domain: financial transactions demand CP; social features tolerate AP.

Key Takeaway: In practice, CP systems prioritize correctness over uptime (better for financial/medical data), while AP systems prioritize responsiveness over immediate consistency (better for feeds, caches, and collaborative tools). Choose based on what failure mode your users can tolerate.