CAP Theorem
The CAP theorem is a fundamental principle in distributed systems theory that defines the trade-offs between three important properties: Consistency, Availability, and Partition tolerance. The theorem, introduced by Eric Brewer in 2000, asserts that it is impossible for a distributed system to simultaneously guarantee all three properties. Instead, a distributed system can provide at most two of these three guarantees. The concept has significant implications for the design of distributed databases and applications, as systems must choose which two properties to prioritize based on the specific needs of the use case.
https://en.wikipedia.org/wiki/CAP_theorem
In the context of the CAP theorem, consistency refers to the guarantee that every read operation will return the most recent write, ensuring that all nodes in the system have the same data at any given time. Availability means that every request (read or write) will receive a response, even if some nodes are unavailable. Partition tolerance means that the system will continue to operate even if network partitions or communication breakdowns occur between different parts of the system. Depending on which two of these three properties a system prioritizes, different consistency models like Eventual consistency or Strong consistency are used.
https://en.wikipedia.org/wiki/Consistency_(distributed_databases)
The CAP theorem helps developers and engineers make informed decisions about trade-offs in system architecture. For example, a system prioritizing consistency and partition tolerance, like HBase or Cassandra, may sacrifice availability in the event of a partition, ensuring that only the most up-to-date data is available. In contrast, systems prioritizing availability and partition tolerance, like CouchDB, might sacrifice consistency for the sake of responsiveness and uptime. Understanding the CAP theorem is essential for designing distributed systems that meet specific performance and reliability needs.
https://en.wikipedia.org/wiki/Distributed_database
- Snippet from Wikipedia: CAP theorem
In database theory, the CAP theorem, also named Brewer's theorem after computer scientist Eric Brewer, states that any distributed data store can provide only two of the following three guarantees:
- Consistency
- Every read receives the most recent write or an error. Note that consistency as defined in the CAP theorem is quite different from the consistency guaranteed in ACID database transactions.
- Availability
- Every request received by a non-failing node in the system must result in a response. This is the definition of availability in CAP theorem as defined by Gilbert and Lynch. Note that availability as defined in CAP theorem is different from high availability in software architecture.
- Partition tolerance
- The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes.
When a network partition failure happens, it must be decided whether to do one of the following:
- cancel the operation and thus decrease the availability but ensure consistency
- proceed with the operation and thus provide availability but risk inconsistency. Note this doesn't necessarily mean that system is highly available to its users.
Thus, if there is a network partition, one has to choose between consistency or availability.