CAP Theorem states that any distributed system needs consistency, availability and network partition, but you can’t choose all the three property. So choose two of them for your system
- CP – Sacrifice Availability for Consistency
- AP – Sacrifice Consistency for Availability
- CA – Consistent and Available, but not tolerant of partitions
CAP Theorem provides guidelines around what should be chosen in case of network partition, it is unclear during the normal state ( without network partition) what to do.
What is the Problem with CAP?
In some systems you may need consistency at all the time, with or without network partition, but remember consistency comes with cost of latency and throughput.
In some system we may need consistency incase of network partition, but we also need to support low latency and high throughput, we are ready to tradeoff the strong consistency to eventual consistency for the latency and throughput. But CAP theorem doesn’t provide any clear details for this kind of tradeoff.
PACELC is an extension of CAP Theorem, it states that if there is network partition then choose either Availability or Consistency, in normalcy choose Latency or Consistency.
Datastore Classification based on PACELC
DynamoDB are PA/EL systems in PACELC, it is ready to scarifies the consistency for availability and low latency, but they take care of consistency through casual ordering. So we can see that PACELC gives more flexibility in designing your system
Fully ACID systems are PC/EC systems, it is ready to give up availability for consistency.
Hazelcast it provides options to users, so that you can tune your system to be PA/EL or PA/EC.