Databases

PACELC Theorem

● Advanced ⏱ 11 min read database

The PACELC theorem is an extension of the CAP theorem that addresses a critical gap: CAP only describes trade-offs during network partitions, but partitions are rare. What trade-offs do distributed systems make during normal, partition-free operation? PACELC, formalized by Daniel Abadi in 2012, adds the latency vs. consistency dimension that governs everyday distributed database behavior.

The Gap in CAP

CAP tells us: when a partition occurs, choose consistency or availability. This is useful, but it leaves out most of a database’s operating life. Partitions are exceptional events — real systems spend 99.9%+ of their time operating without a partition.

During normal operation, a distributed database still faces a fundamental trade-off: to ensure all replicas see the same data before responding (consistency), the system must wait for network round-trips to coordinate. This coordination adds latency. To respond quickly (low latency), the system can acknowledge writes before all replicas confirm, at the cost of consistency windows.

This latency vs. consistency trade-off is always present, not just during partitions. CAP says nothing about it. PACELC does.

PACELC Explained

PACELC is an acronym that encodes two branches of a conditional:

If Partition (P):
    choose Availability (A) or Consistency (C)
Else (E, no partition):
    choose Latency (L) or Consistency (C)

Every distributed system falls into one of four quadrants:

During PartitionDuring Normal OperationClassificationExamples
Prefer AvailabilityPrefer LatencyPA/ELCassandra, DynamoDB (default), Riak, CouchDB
Prefer ConsistencyPrefer ConsistencyPC/ECHBase, VoltDB, etcd, Zookeeper
Prefer ConsistencyPrefer LatencyPC/ELMongoDB (default), PNUTS, Megastore
Prefer AvailabilityPrefer ConsistencyPA/ECRare; some tunable systems in specific configurations
PACELC: two branches — partition behavior (Availability vs Consistency) and normal operation behavior (Latency vs Consistency)

The PAC Branch (Partition Behavior)

This branch is identical to CAP. During a network partition:

Choose Availability (PA): The system continues accepting reads and writes on all reachable nodes, even though some nodes cannot communicate with each other. Data may diverge. After the partition heals, the system reconciles the diverged state via conflict resolution strategies.

Choose Consistency (PC): The system refuses to serve requests from nodes that cannot reach a quorum of other nodes. Reads and writes on the isolated partition are rejected or blocked until connectivity is restored. No data divergence occurs, but some clients experience unavailability.

The ELC Branch (Normal Operation)

This branch is what PACELC adds beyond CAP. During normal operation (no partition), when a write arrives:

Choose Latency (EL): The system acknowledges the write quickly — often after writing to a single node or a subset of replicas — and replicates asynchronously in the background. The client receives a fast response, but for a brief window, some replicas lag behind. A subsequent read from a lagging replica returns stale data.

Choose Consistency (EC): The system requires acknowledgment from all replicas (or a quorum) before responding to the client. Every node has the new value before the write is declared successful. Subsequent reads from any node return the latest value, but the write latency includes the network round-trip to every required replica.

The latency difference between EL and EC can be significant. In a database with replicas across two data centers separated by 50ms of network latency, an EC write takes at least 50ms more than an EL write. Multiply by millions of writes per day and the throughput and tail latency impact is substantial.

System Classifications

PA/EL Systems — Availability and Low Latency First

PA/EL systems prioritize being fast and always available, accepting that data may be transiently inconsistent.

Cassandra (default configuration):

DynamoDB (eventual consistency mode):

PA/EL systems are ideal for: high-write workloads (IoT telemetry, event logging), globally distributed applications where cross-region write latency would be prohibitive, and domains where brief stale reads are tolerable (social feeds, recommendation engines, analytics counters).

PC/EC Systems — Consistency Always

PC/EC systems favor consistency in all situations, accepting higher latency and reduced availability during partitions.

HBase:

etcd and Zookeeper:

PC/EC systems are ideal for: coordination services (distributed locks, leader election, service discovery), configuration management, financial ledgers, and any use case where reading stale data causes incorrect behavior.

PC/EL Systems — Consistent Under Partition, Fast Otherwise

PC/EL is an interesting middle ground: during a partition, the system sacrifices availability to maintain consistency; but during normal operation, it prioritizes low latency over strict consistency for reads.

MongoDB (default configuration with replica sets):

💡
MongoDB’s Tunable Position

MongoDB’s PACELC classification shifts based on configuration. With writeConcern: majority and readConcern: majority, it moves toward PC/EC. With writeConcern: 1 and readPreference: secondary, it operates closer to PC/EL or even PA/EL. This flexibility is powerful but requires deliberate configuration — the defaults do not provide the strongest consistency guarantees.

Tunable Systems

Many modern databases do not occupy a fixed PACELC position — they allow tuning per operation. This is one of PACELC’s most practical insights: you don’t have to make a global choice. You can choose different trade-offs for different operations based on their consistency requirements.

Cassandra’s consistency levels:

You can also achieve strong consistency in Cassandra by setting both write and read consistency to QUORUM: since writes must be confirmed by a majority and reads must consult a majority, the intersection guarantees the reader sees the latest write.

DynamoDB’s strongly consistent reads: By default, DynamoDB reads are eventually consistent (EL). Setting ConsistentRead: true makes the read contact the leader replica and wait for the most recent data — moving to EC at the cost of slightly higher latency and double the read capacity units.

The Key PACELC Insight

During normal operation (which is almost always), the trade-off is latency vs. consistency — not availability vs. consistency. This means that even for a system you’ve decided should be “consistent,” you need to decide: how much latency is acceptable to achieve that consistency? Synchronous replication to a replica 200ms away costs 200ms per write. Is that acceptable for your use case? PACELC forces you to quantify this rather than treating consistency as free.

Design Considerations

In System Design Interviews

Invoke PACELC when you need to justify database configuration, not just database selection. “We use Cassandra, which is PA/EL by default. For the payment confirmation record we write at QUORUM (EC), accepting the higher latency because consistency is non-negotiable. For the activity feed read, we use ONE (EL) — the 50ms latency savings outweigh the risk of a user seeing a post that’s 200ms stale.” This shows you understand that the same database can exhibit different PACELC positions depending on how it is used.