- What is CAP theorem?
- RDBMS system such as Oracle achieves which of the following two: Consistency, Availability, Partition Tolerance
- NoSQL datastore such as HBase tends to achieve which of the following two: Consistency, Availability, Partition Tolerance
The article below addresses some of the above questions. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.
Following points are discussed later in this article:
- What is CAP theorem?
- Some Examples of DB system vis-a-vis CAP Theorem
- Which DB system to choose based on CAP requirements?
What is CAP theorem?
CAP theorem states that any database system can only attain two out of following states which is Consistency, Availability and Partition Tolerance. Following is brief definition of these three terms:
- Consistency: Any changes to a particular record stored in database, in form of inserts, updates or deletes is seen as it is, by other users accessing that record at that particular time. If they don’t see the updated data, it is termed as eventual consistency.
- Availability: The system continues to work and serve data inspite of node failures.
- Partition Tolerance: The database system could be stored based on distributed architecture such as Hadoop (HDFS).
Following diagram depicts the above three terms:
Following are some of the URLs of pages where further details could be found:
Some Examples of DB system vis-a-vis CAP Theorum
- RDBMS systems such as Oracle, MySQL etc supports consistency and availability.
- NoSQL datastore such as HBase supports Consistency and Partition Tolerance.
- NoSQL datastore such as Cassandra, CouchDB supports Availability and Partition Tolerance.
Which DB system to choose based on CAP requirements?
- CP-based database system: When it is critical that all clients see a consistent view of the database, the users of one node will have to wait for any other nodes to come into agreement before being able to read or write to the database, availability takes a backseat to consistency and one may want to choose database such as HBase that supports CP (Consistency and Partition Tolerance)
- AP-based database system: When there is a requirement that database remain available at all times, one could DB system which allows clients write data to one node of the database without waiting for other nodes to come into agreement. DB system then takes care of data reconciliation at a little later time. This is the state of eventual consistency. In applications which could sacrifice data consistency in return of huge performance, one could select databases such as CouchDB, Cassandra.
He has also authored the book, Building Web Apps with Spring 5 and Angular.
Latest posts by Ajitesh Kumar (see all)
- Difference between Machine Learning & Traditional Software - October 30, 2019
- Neural Network Architecture for Text-to-Speech Synthesis - July 29, 2019
- Reverse Image Search using Deep Learning (CNN) - July 27, 2019