This content originally appeared on DEV Community and was authored by Sajidur Rahman Shajib
Distributed systems are everywhere — from your favorite social media platforms to online banking. But making them work reliably isn’t easy. One foundational concept every backend engineer or system designer needs to understand is the CAP Theorem.
📚 What is the CAP Theorem?
CAP stands for Consistency, Availability, and Partition Tolerance. Proposed by Eric Brewer in 2000, the CAP Theorem states that:
In any distributed data system, you can only guarantee two out of the following three properties at the same time:
- Consistency (C): Every node sees the same data at the same time.
- Availability (A): Every request gets a response — success or failure.
- Partition Tolerance (P): The system continues to function even if network issues split it into disconnected parts.
When a network partition occurs (and it will, eventually), you’re forced to choose between Consistency and Availability.
đź§µ Alice and the CAP Dilemma: A Distributed Tale
Meet Alice, a backend engineer working at a startup called BDGrocer, which delivers groceries in real-time using microservices.
One day, Alice was tasked with designing a distributed order system that would sync between the Dhaka and CTG servers. Simple? Not quite.
đź”§ Round 1: The Ideal World
Alice dreams of a perfect system where:
- All users always see the most recent order status (Consistency).
- Every request is responded to immediately (Availability).
- And of course, the system survives any network failure (Partition Tolerance).
But then her senior smiles and says:
“Alice, welcome to CAP. You can only pick two.”
⚖️ Option 1: Consistency + Partition Tolerance (CP)
Alice thinks, “Let’s make sure data is always accurate, even if servers get partitioned.”
- If Dhaka and CTG servers can't talk due to a network glitch, she decides to block requests to avoid stale data.
- Customers might wait a bit longer, but they'll get the right info.
📉 Trade-off: The system isn't always available. Some users might get errors or timeouts.
Use case: Financial systems like banks — better to fail than show wrong balance.
⚡ Option 2: Availability + Partition Tolerance (AP)
Now Alice thinks, “Speed is key. Let’s answer all requests, even if the servers are split.”
- If there's a partition, both servers still serve requests.
- But data might temporarily be inconsistent (e.g., one user sees their order canceled, the other sees it confirmed).
📉 Trade-off: Some temporary inconsistency, but system is always responsive.
Use case: Messaging apps — better to let users keep chatting and sync later.
âś… Option 3: Consistency + Availability (CA)
Alice likes this. No data mismatch, and always responsive! But then...
🚨 Oops: It only works if there's no network partition. Not realistic in distributed systems.
Conclusion: CA works only in single-node or non-partitioned setups. In real distributed systems, you must tolerate partitions — so this combo isn’t practical.
đź§ What Did Alice Learn?
In the real world, network partitions are inevitable. So most distributed systems must pick between C or A — they can’t have both when the network fails.
Alice wisely chooses different trade-offs for different services:
- For payments, she picks CP.
- For live delivery tracking, she goes with AP.
🎯 Final Thought
Understanding CAP isn't about memorizing acronyms — it's about making smart trade-offs. Each choice fits a different context. Like Alice, you should always ask:
“What matters most here — accuracy or availability — when the network goes wrong?”
That’s how real-world systems are built. 🚀
This content originally appeared on DEV Community and was authored by Sajidur Rahman Shajib

Sajidur Rahman Shajib | Sciencx (2025-07-12T21:26:44+00:00) 🧠Understanding the CAP Theorem – Through Alice’s Distributed Adventure 🚀. Retrieved from https://www.scien.cx/2025/07/12/%f0%9f%a7%a0-understanding-the-cap-theorem-through-alices-distributed-adventure-%f0%9f%9a%80/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.