← Back to Concepts
CAP Theorem
Understand the fundamental trade-offs between Consistency, Availability, and Partition tolerance
CAP Mode
Network
Write Data
Read Data
Try This:
- Write some data (e.g., "v1") with all nodes connected - both modes work perfectly
- Click Create Partition to simulate a network split
- In CP mode, try writing "v2" - it will fail to maintain consistency
- Switch to AP mode and write "v3" - it succeeds but only writes to the partitioned node
- Click Read Data to see inconsistent values across nodes in AP mode
- Click Heal Partition to restore the network and observe the results
Node Cluster
CONNECTED
💾
Node 1
Data: v0
💾
Node 2
Data: v0
💾
Node 3
Data: v0
Understanding CAP:
- CP (Consistency + Partition tolerance): Rejects writes during partition to maintain consistency. Prioritizes correctness over availability.
- AP (Availability + Partition tolerance): Accepts writes during partition but allows inconsistency. Prioritizes availability over consistency.
- The Theorem: In a distributed system with network partitions, you must choose between Consistency and Availability.
Metrics
Total Writes
0
Successful
0
Failed
0
Inconsistent Reads
0