NoSQL — CAP Theorem

Kavini Welarathne
2 min readFeb 17, 2020

--

Let's see what is CAP Theorem...

CAP theorem, which was first designed by Eric Brewer, is one way to understanding the design of a distributed system. The CAP theorem is also called Brewer’s Theorem because it was first advanced by Professor Eric A. Brewer during a talk he gave on distributed computing in 2000. Two years later, MIT professors Seth Gilbert and Nancy Lynch published a proof of “Brewer’s Conjecture.”

We can only achieve at most two out of three guarantees for a database:

C- Consistency

“ All nodes in the network see the same data at the same data. “

This condition states that the reader gets the most recently written & Successfully written data. A system that is void of this consistency is called an inconsistent system.

A- Availability

“Database requests always receive a response (when valid).”

Availability is a guarantee that every request receives a response about whether it was successful or failed. The number of users a system can cater to better is the availability.

P- Partition Tolerance

“A network fault doesn’t prevent messaging between nodes”

Partition Tolerance is a guarantee that the system continues to operate despite arbitrary message loss or failure of part of the system. This condition states that the system does not fail, regardless of if messages are dropped or delayed between nodes in a system.

let's keep going…

CAP theorem — NoSQL

It is very important to understand the limitations of the NoSQL database.

Today, NoSQL databases are classified based on the two CAP characteristics they support:

Let's take a look at various scenarios or architectures of systems to better understand the CAP theorem.

  • CA (Consistent and Available)

The first one is RDBMs where Reading and writing of data happens on the same machine. CA systems are consistent and available systems in the absence of any network partition.

  • AP (Available and Partition Tolerant)

These are systems highly available as there are multiple machines to serve. Also, such systems are partition tolerant because if one machine goes down, there are other machines available

  • CP (Consistent and Partition Tolerant)

A CP database delivers consistency and partition tolerance at the expense of availability. When a partition occurs between any two nodes, the system has to shut down the non-consistent node

So now you know the basics of the CAP Theorem.

Thank you.

See, you soon…

--

--

Kavini Welarathne
Kavini Welarathne

Written by Kavini Welarathne

Software Engineer | Researcher |

No responses yet