PACELC Theorem

Overview

The PACELC theorem, an extension of the CAP Theorem by Daniel Abadi, addresses limitations of CAP by considering latency and scenarios where partition tolerance isn’t a factor. Unlike CAP, which focuses solely on partition scenarios, PACELC accounts for normal operating conditions.

The PACELC acronym stands for:

  • Partition Tolerance (P): Same as in CAP.
  • Availability (A): Same as in CAP.
  • Consistency (C): Same as in CAP.
  • Else (E): New - In the absence of partitions, a choice between latency and consistency must be made.
  • Latency (L): New - The time between a request and its response.
  • Consistency (C): Same as in CAP.

PAC (Partition, Availability, Consistency) mirrors CAP: during a partition, a system must choose between Availability (A) or Consistency (C). ELC (Else, Latency, Consistency) comes into play when there are no partitions, forcing a trade-off between Latency (L) and Consistency (C). While CAP doesn’t consider latency, PACELC acknowledges its real-world importance, suggesting that distributed databases must balance Consistency (C) and Latency (L) even when partitions are absent.

image-5.png

Possible combinations:

With ELC:

  • EL (Else Latency): Prioritizes low latency for read/write operations, potentially returning stale data.
  • EC (Else Consistency): Prioritizes consistency for read/write operations, without guaranteeing fast response times (low latency).

Note that availability is inherent in both ELC choices.

With PACELC:

  • PA/EL (Partition Tolerance - Availability / Else Latency): System favors availability during partitions and speed during normal operation, sacrificing consistency in both scenarios.
  • PA/EC (Partition Tolerance - Availability / Else Consistency): System favors availability during partitions and consistency during normal operation.
  • PC/EL (Partition Tolerance - Consistency / Else Latency): System prioritizes consistency during partitions but latency in normal operation. This is less common. For example, it might be causal consistent during a partition but eventually consistent otherwise.
  • PC/EC (Partition Tolerance - Consistency / Else Consistency): System always prioritizes consistency, potentially impacting performance.

Database examples:

  • PA/EL: ScyllaDB (default mode), CouchDB (default mode). Note that ScyllaDB can be tuned for greater consistency.
  • PA/EC: Aerospike (key-value/document). Configurable.
  • PC/EL: ScyllaDB or MongoDB (if configured).
  • PC/EC: MongoDB (default replication set), Relational databases like MySQL.

Conclusion:

CAP and PACELC are valuable frameworks for understanding trade-offs in distributed database solutions. Using both can help in making informed decisions about the best approach for a given system.