Understanding CAP Theorem
CAP Theorem - a central concept in distributed computing. But what does it really mean? How does it affect the design and operations of our distributed systems? Let's decode this mystery in simple terms.
Introduction to CAP Theorem
The CAP theorem, also known as Brewer's theorem, named after computer scientist Eric Brewer, postulates that it's impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees:
Consistency
Every read receives the most recent write or an error.
Availability
Every request receives a response, without guarantee that it contains the most recent write.
Partition tolerance
The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes.
It’s like a "pick any two" scenario. The acronym 'CAP' stands for Consistency, Availability, and Partition Tolerance - the three attributes we just discussed.
Consistency
Picture an e-commerce platform, where you add a product to your cart. If the system is consistent, the item will appear in your cart across all nodes of the distributed system. When a system is consistent, it means all nodes see the same data at the same time. The moment a write is performed, all subsequent reads will reflect the change.