Friday, May 21, 2021

System design: CAP theorem -> PACEL theorem | My 20 minutes study

May 21, 2021

My highlights:

  1. It states that in case of network partitioning (P) in a distributed computer system, one has to choose between availability (A) and consistency (C) (as per the CAP theorem), but else (E), even when the system is running normally in the absence of partitions, one has to choose between latency (L) and consistency (C)

PACELC theorem

From Wikipedia, the free encyclopedia
Jump to navigationJump to search

In theoretical computer science, the PACELC theorem is an extension to the CAP theorem. It states that in case of network partitioning (P) in a distributed computer system, one has to choose between availability (A) and consistency (C) (as per the CAP theorem), but else (E), even when the system is running normally in the absence of partitions, one has to choose between latency (L) and consistency (C).

Overview[edit]

PACELC builds on the CAP theorem. Both theorems describe how distributed databases have limitations and tradeoffs regarding consistency, availability, and partition tolerance. PACELC however goes further and states that an additional trade-off exists: between latency and consistency, even in absence of partitions, thus providing a more complete portrayal of the potential consistency trade-offs for distributed systems.[1]

A high availability requirement implies that the system must replicate data. As soon as a distributed system replicates data, a trade-off between consistency and latency arises.

The PACELC theorem was first described by Daniel J. Abadi from Yale University in 2010 in a blog post,[2] which he later clarified in a paper in 2012.[1] The purpose of PACELC is to address his thesis that "Ignoring the consistency/latency trade-off of replicated systems is a major oversight [in CAP], as it is present at all times during system operation, whereas CAP is only relevant in the arguably rare case of a network partition."

Database PACELC ratings[edit]

Database PACELC ratings are from [3]

  • The default versions of DynamoDBCassandraRiak and Cosmos DB are PA/EL systems: if a partition occurs, they give up consistency for availability, and under normal operation they give up consistency for lower latency.
  • Fully ACID systems such as VoltDB/H-Store, Megastore and MySQL Cluster are PC/EC: they refuse to give up consistency, and will pay the availability and latency costs to achieve it. BigTable and related systems such as HBase are also PC/EC.
  • Couchbase provides a range of consistency and availability options during a partition, and equally a range of latency and consistency options with no partition. Unlike most other databases, Couchbase doesn't have a single API set nor does it scale/replicate all data services homogeneously. For writes, Couchbase favors Consistency over Availability making it formally CP, but on read there is more user-controlled variability depending on index replication, desired consistency level and type of access (single document lookup vs range scan vs full-text search, etc). On top of that, there is then further variability depending on cross-datacenter-replication (XDCR) which takes multiple CP clusters and connects them with asynchronous replication and Couchbase Lite which is an embedded database and creates a fully multi-master (with revision tracking) distributed topology.
  • Cosmos DB supports five tunable consistency levels that allow for tradeoffs between C/A during P, and L/C during E. Cosmos DB never violates the specified consistency level, so it’s formally CP.
  • MongoDB can be classified as a PA/EC system. In the baseline case, the system guarantees reads and writes to be consistent.
  • PNUTS is a PC/EL system.
  • Hazelcast IMDG and indeed most in-memory data grids are an implementation of a PA/EC system; Hazelcast can be configured to be EL rather than EC.[4] Concurrency primitives (Lock, AtomicReference, CountDownLatch, etc.) can be either PC/EC or PA/EC.[5]
  • FaunaDB implements Calvin, a transaction protocol created by Dr. Daniel Abadi and author[1] of PACELC theorem, and offers users adjustable controls for LC tradeoff. It is PC/EC for strictly serializable transactions, and EL for serializable reads.
DDBSP+AP+CE+LE+C
DynamoDBYesYes[a]
CassandraYesYes[a]
Cosmos DBYesYes
CouchbaseYesYesYes
RiakYesYes[a]
VoltDB/H-StoreYesYes
MegastoreYesYes
BigTable/HBaseYesYes
MySQL ClusterYesYes
MongoDBYesYes
PNUTSYesYes
Hazelcast IMDG[6][5]YesYesYesYes
FaunaDB[7]YesYesYes

See also[edit]

Notes[edit]

  1. Jump up to:a b c Dynamo, Cassandra, and Riak have user-adjustable settings to control the LC tradeoff.[3]

References[edit]

  1. Jump up to:a b c Abadi, Daniel J. "Consistency Tradeoffs in Modern Distributed Database System Design" (PDF). Yale University.
  2. ^ Abadi, Daniel J. (2010-04-23). "DBMS Musings: Problems with CAP, and Yahoo's little known NoSQL system". Retrieved 2016-09-11.
  3. Jump up to:a b "Consistency Tradeoffs in Modern Distributed Database System Design" slide summary by Arinto Murdopo, Research Engineer
  4. ^ Abadi, Daniel (2017-10-08). "DBMS Musings: Hazelcast and the Mythical PA/EC System"DBMS Musings. Retrieved 2017-10-20.
  5. Jump up to:a b "Hazelcast IMDG Reference Manual"docs.hazelcast.org. Retrieved 2020-09-17.
  6. ^ Abadi, Daniel (2017-10-08). "DBMS Musings: Hazelcast and the Mythical PA/EC System"DBMS Musings. Retrieved 2017-10-20.
  7. ^ Abadi, Daniel (2018-09-21). "DBMS Musings: NewSQL database systems are failing to guarantee consistency, and I blame Spanner"DBMS Musings. Retrieved 2019-02-23.

External links[edit]

No comments:

Post a Comment