I always like simple frameworks that help put some order into chaos.
Last month while in Seattle, I ran into something that for whatever reason had managed to escape my radar screen. If there was a single thing that made the trip to Seattle worthwhile, that was it.
I’m talking about the CAP Theorem. I'm blogging about it here because after talking to a few people, I realized that not enough database people actually knew about it.
For any distributed systems that share data, there are three desirable properties: Consistency, Availability, and Partition tolerance, i.e. CAP). The CAP Theorem states that, out of these three desirable properties, you can have at most two simultaneously. The practical implication is that you must make trade-offs when building a system that provides distributed access to data.
The consistency property means that any part of the system will provide exactly correct data when responding to a request as if the request were processed on a single node in an instance. The availability property means that the system is ‘online’ and the client of the system can expect to receive a response for its request. And partition tolerance refers to tolerance to network partition in that the system should continue to function in case network is partitioned or disrupted (e.g. some nodes are offline or communication links are down).
So a scaled-up database at a single site—including one in a local failover cluster—has consistency and availability, but it’s meaningless to talk about network partition tolerance. With a distributed database with distributed locking, you can guarantee to deliver consistent data even in case of network partition, but you would have to sacrifice availability because if you continue to allow the same data to be updated on different nodes , the client will receive inconsistent data.
It’s interesting to apply the CAP Theorem to various familiar systems and scenarios. But instead of my repeating it, you can read about the CAP Theorem yourself. Here are two references, and more can be found when you google for “CAP Theorem”.
- Brewer’s Conjecture and the Feasibility of Consistent, Available, Partition-Tolerant Web Services
- Eric Brewer’s presentation