Background
What I know already
- The acronym is “Consistency, Availability, and Partition Tolerance”
- You can only guarantee two at a time (at most)
What I know I don’t know
Why?
I mean, I have an idea, but articulating it is hard.
Learning notes
Definitions
Consistency: All nodes in a distributed system have the same data.
Availability: Every request receives a response within a “reasonable time.”
Partition Tolerance: The distributed system can continue to function even when some nodes can’t talk to each other because of network failures.
Does partition tolerance only account for network failures?
What about when a node is reachable on the network, but the service it provides goes down? (Maybe it ran out of memory or something.)
Yes, it only refers to network failures
See FAQ 15 of The CAP FAQ
A better definition
If your system may experience partitions, it cannot always be both consistent and available.
Put another way, “When your distributed system experiences partitions, what do you sacrifice? Consistency, or availability?”
Why is the CAP theorem true?
We can’t write to one node and read that data from another immediately. We have to wait some time for the changes to propagate across the partition before we get consistency. If we don’t wait, we sacrifice consistency. If we do wait, we sacrifice availability.
See FAQ 8 of The CAP FAQ?