CAP Theorem
CAP Theorem
A rule that says data spread across multiple servers can't have all three key properties at once.
In Simple Terms
The CAP theorem says that when data is shared across multiple servers, you can't have all three key properties at once. If the servers lose contact but must keep running, you have to choose: return the same latest data everywhere, or keep answering every request. Imagine two branch offices, one in Tokyo and one in Osaka, that both keep the same list of names. When their connection drops, they can either pause service until they can confirm the lists match, or keep helping people even though the information might be out of sync. They can only pick one.
Behind the Name
CAP is made from the first letters of three properties: Consistency, Availability, and Partition tolerance. These are qualities a system can have, and the theorem says you can't fully get all three at once. It's also called Brewer's theorem, after the researcher who proposed it.
Take a Closer Look!
The CAP theorem says that in a system that stores data across multiple servers, you can't fully have all three of consistency, availability, and partition tolerance at the same time.
In other words, when the network connection breaks, you have to choose between keeping the data correct and keeping the system responding.
Here's what each property means in plain terms. Consistency means that no matter which server you ask, you always get the same, latest data. Availability means that if you ask a server that's up and running, you always get a real answer back, not an error.
And partition tolerance means the system as a whole keeps working even if the connection between servers gets cut. As long as multiple servers are linked over a network, a break in communication can always happen, so designs start from partition tolerance and then choose between the other two: consistency or availability.
In real-world development, the choice depends on what the service is for. In situations where mismatched data isn't acceptable, like managing bank balances, designers choose to keep consistency even if it means pausing service for a while.
On the other hand, in cases like showing posts on social media, where it matters more that the service keeps running even if some data is slightly out of date, designs that put availability first are common.