After considering such facts In the year 2000, Eric Brewer developed one theorem that is called as CAP Theorem or Brewer’s conjecture.
CAP Theorem, states that:
“In a distribution system can only have two out of following three Consitentency, Availability, and Partition Tolerance- One of them must be a sacrifice. You can’t promise all three at a time across reading/write requests.”
- Consistency: Every read request receives the most recent write or an error.
- Availability: Every request should receive a (non-error) response, without the guarantee that it contains the most recent write.
- Partition Tolerance: The system continues to work despite an arbitrary number of messages being dropped/delayed by the network between nodes/partitions.
In the CAP theorem, consistency is quite different from the ACID database transactions. In distributed systems, partition tolerance means the system will work continue unless there is a complete network failure. If a few nodes fail then the system should keep going.
CAP Theorem Example
You can decide your system technologies based on your primary importance for Consistency, Availability and Partitioning Tolerance. Here we are just taking one example base on database selection:
CA (Consistency + Availability) Type
In this system consistency and availability is primary constraints but such type of system not provide a guarantee of one of the system is offline then the whole system is offline. Otherwise, some of the nodes will not consistent and also not have the latest information.
For Example, Oracle and MySQL are good with Consistency and Availability but not partition tolerant.
CP (Consistency + Partition Tolerant) Type
In this system, consistency and partition tolerance is primary constrains but such a system not provide a guarantee for availability and throws an error as long as the partitioned state not resolved.
For Example, Hadoop and MongoDB stored redundant data in multiple slave nodes and it tolerates an outage of a large number of nodes in the cluster.
AP (Availability + Partition Tolerant) Type
Such a system can not guarantee consistency because if updates can be made to either of a node if some nodes or network issues. This system can have different values on different nodes.
For Example, CouchDB, Dynamo DB, and Cassandra PA type database.
Note CouchDB and Dynamo DB store values in key-value pairs while Cassandra store values in the form of a column family.
- ACID vs BASE for Database Transactions
- ACID Properties for Database Transactions
- BASE Properties for Distributed Database Transactions
You must be logged in to post a comment.