By WalkingTree December 23, 2020
The CAP theorem states that a distributed system can deliver only two of the three overarching goals of microservices i.e consistency, availability, and partition tolerance. Not only is it impossible to have it all but developers may even struggle to deliver more than one of these qualities at a time.
When it comes to microservices, the CAP theorem seems to be an unsolvable problem. It’s better to face the fact when it comes to the design stage, and you’ll need to think carefully about the type of application you’re building, and it’s most essential needs.
CAP theory and microservices
- Consistency – All clients see the same data at the same time, no matter the path of their request. This is important for applications that have frequent updates.
- Availability – Functioning application components will return a valid response, even if they are down. This is important if an application’s user population has a low tolerance for outages.
- Partition tolerance – The application will operate even during a network failure that results in lost or delayed messages between services.
Applying PACELC to microservices
The requirement for partition tolerance in distributed systems gave rise to the PACELC theorem, a sibling to the CAP theorem. If we use PACELC rather than a pure CAP to define databases, we can classify them according to how they make the trades. In PACELC, relational database management systems and NoSQL databases that implement ACID (atomicity, consistency, isolation, durability) are designed to assure consistency.
Read on to know more about the CAP and PACELC theorem and how they apply to Microservices.