Theorem Every Developer Should Know: CAP

furkangulsen

Furkan Gulsen

Posted on February 20, 2023

Theorem Every Developer Should Know: CAP

CAP theorem briefly; argues that in a distributed architecture, there cannot be Consistency, Accessibility and Partition Tolerance at the same time.

Image description

Consistency: Let there be two servers named x and y in the distributed system. When we request it, it will give the e-mail address of the user named “furkan” from the X server. If the e-mail value received in return for the "furkan" username from server y is the same as the e-mail value received in X, consistency is ensured here.

Availability: Distributed systems should always be available. If there are only two servers named X and Y in the distributed system, both servers should always be available.

Partition Tolerance: X and Y servers are interconnected. If server X goes down for any reason, server Y should be able to continue running.

So why does the CAP theorem claim that these three properties cannot exist simultaneously? Let's take a look at them now...


Image description

CP Defenders

  • Availability was sacrificed.
  • It is based on Consistency and Partition Tolerance.
  • Closing the inconsistent node when a split occurs between two nodes.

Image description

AP Defenders

  • Consistency is sacrificed.
  • It is based on Availability and Partition Tolerance.
  • When a split occurs between two nodes, access to both will be available. However, the database to which either node is connected is not guaranteed to be the same. In this case, there is no consistency between the two nodes.

Image description

CA Defenders

  • The Partition Tolerance property has been sacrificed.
  • It is based on Availability and Consistency.
  • All nodes are accessible and each node is consistent with each other. No division can occur between nodes.
💖 💪 🙅 🚩
furkangulsen
Furkan Gulsen

Posted on February 20, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related