CAP Theorem
Learn what the CAP theorem is and why it is important in the database world.
We'll cover the following
When working with distributed systems, we usually encounter some characteristics that are mutually exclusive. That is why it’s important for us to trade off such characteristics. Picking the right database for a project means considering availability, consistency and partition tolerance, and here is where the CAP theorem can prove useful.
Partition tolerance
This is an important concept in distributed systems. When talking about distributed systems it does not necessarily imply microservices or other similar architecture. It can be a simple monolith that interacts with a database. It is all about having components that communicate with each other over a network. Technology is not perfect and problems can appear. When such problems appear on a network it can lead to breakdowns in components such as databases or microservices. Those breakdowns or partitions on the network may produce some inconsistencies and problems in our applications.
Here is when the concept of partition tolerance comes into the picture. Preventing applications from failing when partitions in a network occur is what partition tolerance means. The image below shows how a database has three replicas. Eventually, some replica could go down and information could not be synchronized. Despite this event, the microservice could continue operating correctly.
Get hands-on with 1400+ tech skills courses.