The PACELC theorem is as follows:
If the network is partitioned, we choose between availability and consistency else, we choose between latency and consistency.
This definition was introduced to encompass latency's role in distributed systems that operate without network partitions.
The CAP theorem proposed that due to the nature of distributed systems, they could only provide two of the following three guarantees:
Consistency
Availability
Partition tolerance
This theorem allows programmers to weigh the trade-offs according to their product's needs. Let's understand each of them below:
By consistency, we mean the system can read the most updated version of the data or else return an error.
The replica here is a node that
By availability, we indicate the system should respond with non-error replies to all requests.
By partition tolerance, we mean the system to be unhindered by packet drops or delays due to the network. So this would mean we have the perfect network and routers that never failed or had multiple contingency paths to all nodes on the distributed system.
Note: When trading off partition tolerance for consistency and availability (CA) we cannot completely sacrifice partition tolerance as we will always have delays and packet drops in a distributed system.
As we can see below, we can wait a pretty long while but provide consistency and availability. This means that the user may face delays indefinitely.
So, in essence, the CAP theorem suggests developers have to choose between either consistency or availability since we can always face network partitions.
However, the CAP theorem forces us to assume that the system has network partitions, which is not necessarily the case at all times. So the PACELC is used as a more flexible theorem to understand the trade-offs in distributed systems. Both DynamoDB and Cassandra are