Consistency in CAP Context
You'll learn what "consistency" actually means in the CAP theorem and why it's stricter than you might think.
What CAP Consistency Really Means
In everyday language, "consistency" might mean your data isn't corrupted or follows certain rules. But in the CAP theorem, consistency has a very specific, rigorous definition: linearizability.
Linearizability means that after any write completes, all subsequent reads from any node must immediately see that write. It's as if all nodes share a single, perfectly synchronized copy of the data. Every client sees the exact same state at the same logical moment in time.
The CAP Guarantee
CAP consistency guarantees:
- Single-system image: The distributed database behaves as if it's one atomic system
- No stale reads: You never read old data after a write has been acknowledged
- Total ordering: All operations appear to happen in a strict global order
Why This Matters During Partitions
Remember from the CAP tradeoff: during a network partition, you cannot guarantee both consistency and availability. If you choose consistency, nodes that can't communicate with others must refuse reads and writes rather than risk showing different data to different clients.
Think of it like a classroom with two whiteboards. If the teacher writes "X = 5" on one board, CAP consistency means every student must see X = 5 immediately, even those looking at the other board—or the board must be covered up (unavailable) until they can be synchronized.
Key Takeaway:
Consistency in CAP means linearizability—every node sees the same data at the same time after a write, creating a single-system illusion even in a distributed environment.