π PACELC Theorem
The PACELC theorem is an extension of the CAP theorem that provides a more complete framework for understanding trade-offs in distributed databases.
- CAP theorem says: In the presence of a Partition (P), a distributed system must choose between Availability (A) and Consistency (C).
- PACELC theorem adds: Else (E) β even when there is no partition β systems must still make a trade-off between Latency (L) and Consistency (C).
π PACELC Breakdown
- P: Partition tolerance β unavoidable in distributed systems.
- A: Availability β system responds even if some nodes fail.
- C: Consistency β all nodes see the same data at the same time.
- E: Else β what happens when there is no partition.
- L: Latency β how quickly the system responds.
π In short:
- During a partition (P) β choose A or C.
- Else (E), when no partition β choose L or C.
π Example
- Amazon DynamoDB: BASE-oriented β favors Availability during partitions, and Low Latency otherwise.
- Google Spanner: ACID-oriented β favors Consistency during partitions, and Consistency even when no partition (higher latency).
β
Pros of PACELC
- More realistic than CAP β covers both partition and non-partition scenarios.
- Helps architects design systems with clear trade-offs.
- Explains why some databases are fast but eventually consistent, while others are slower but strongly consistent.
β οΈ Cons
- Complexity: Harder to explain and apply than CAP.
- No βperfectβ system β trade-offs are inevitable.
- Requires deep understanding of workload and priorities.
π Best Practices
- Use PACELC to evaluate distributed databases (NoSQL, NewSQL, cloud-native DBs).
-
Match system choice to business needs:
- Financial systems β Consistency first (C over A, C over L).
- Social media feeds β Availability + Low Latency (A over C, L over C).
- Document trade-offs clearly for stakeholders.
π Key Takeaway
PACELC theorem says:
- If Partition (P) β trade-off between Availability (A) and Consistency (C).
- Else (E) β trade-off between Latency (L) and Consistency (C).
Itβs the natural evolution of CAP, giving a fuller picture of distributed system design.