> For the complete documentation index, see [llms.txt](https://dianadarie.gitbook.io/system-design-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dianadarie.gitbook.io/system-design-notes/basics/pacel-theorem.md).

# PACEL Theorem

The PACEL theorem states that in a system that replicates data:

* if there is a partition (‘P’), a distributed system can tradeoff between availability and consistency (i.e., ‘A’ and ‘C’);
* else (‘E’), when the system is running normally in the absence of partitions, the system can tradeoff between latency (‘L’) and consistency (‘C’).

<figure><img src="https://2798622988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSvyZbTXexnOjgYP5Qq4a%2Fuploads%2FyjRWRkYNFuAHj4Bymc7u%2FDiana%20Playground%20(11).jpg?alt=media&amp;token=985b23c8-267b-42a3-8a3f-fb69afee84e1" alt=""><figcaption></figcaption></figure>

**PA/EL** systems - **Dynamo and Cassandra** - They choose availability over consistency when a partition occurs; otherwise, they choose lower latency.

**PC/EC** systems - **BigTable and HBase** - They will always choose consistency, giving up availability and lower latency.

**PA/EC** systems - **MongoDB** - MongoDB works in a primary/secondaries configuration. In the default configuration, all writes and reads are performed on the primary. As all replication is done asynchronously (from primary to secondaries), when there is a network partition in which primary is lost or becomes isolated on the minority side, there is a chance of losing data that is unreplicated to secondaries, hence there is a loss of consistency during partitions. Therefore it can be concluded that **in the case of a network partition, MongoDB chooses availability, but otherwise guarantees consistency**. Alternately, when MongoDB is configured to write on majority replicas and read from the primary, it could be categorized as PC/EC.
