Concept · Databases

PACELC Theorem

01

Why this matters

CAP only describes what happens during a partition — but partitions are rare. Most of your system's life is spent in the no-partition state, where CAP has nothing to say. The real everyday tradeoff there is between latency and consistency. PACELC (Daniel Abadi, 2010) captures both cases: "If Partition then A-or-C; Else L-or-C."

If you can explain PACELC in an interview, you demonstrate that you think about distributed systems beyond the pop-CAP version everyone has memorized.

02

What the letters mean

Partition: if the network is broken between nodes…

Availability: …keep serving reads/writes (may return stale data), OR…

Consistency: …refuse writes until partition heals.

Else (no partition): …

Latency: …serve fast, from the nearest replica (eventual consistency), OR…

Consistency: …coordinate with other replicas to ensure the read is latest (strong consistency, slower).

Every distributed database occupies one of four quadrants: PA/EL, PA/EC, PC/EL, PC/EC.

03

The four quadrants

SystemUnder partitionNo partitionQuadrant
CassandraAvailable (AP)Latency-first (EL)PA/EL — always fast, always available, never strict
DynamoDB (default)AvailableLatencyPA/EL
DynamoDB (strong reads)AvailableConsistentPA/EC — pay ~2× for consistent reads
MongoDB (replica set)Consistent (CP)LatencyPC/EL — writes from primary, reads often from secondaries
Postgres (sync replica)ConsistentConsistentPC/EC — strictest but slowest
SpannerConsistentConsistentPC/EC — uses TrueTime to make EC fast globally
The PACELC Quadrants SVG
PC (consistency under partition) PA (availability under partition) EC ← → EL PC / EC always consistent, slower Spanner Postgres + sync replica CockroachDB PA / EC consistent reads, available under partition DynamoDB strong reads MongoDB w/majority PC / EL consistent under partition, fast normally MongoDB replica set (rare combo) PA / EL always available, fast, may be stale Cassandra DynamoDB default Riak Latency cost of EC across regions: ~180ms (VA ↔ Singapore)
04

Deep dive — why the EL/EC choice matters

Even with no partition, multi-region systems face a choice every single read: serve from the local replica (fast, maybe stale) or round-trip to the leader (correct, slow)?

Numbers make this concrete. Your user is in Singapore. Your leader is in Virginia. Round-trip = ~180ms. If you pick EC (consistent reads from leader), every read costs 180ms minimum. If you pick EL (eventual, from Singapore replica), reads cost 1ms — 180× faster — but the replica may be a few milliseconds behind the leader.

A user's "Settings" page probably needs EC (they just changed their password, the next page must show the new state). A user's news feed needs EL (15ms of staleness is invisible; 180ms per read is a disaster). Real systems often pick per-query, not per-system.

The interview sentence

"Cassandra is PA/EL: during a partition we prefer availability; in the steady state we prefer low latency by reading from any replica. We accept eventual consistency — acceptable for our feed use case."

05

Real-world

Spanner

PC/EC the hard way

Google built TrueTime (globally-synchronized clocks via GPS + atomic clocks) so that consistent reads don't require a cross-region round-trip. Most engineering ever put into avoiding the EL/EC compromise.

Cassandra

PA/EL with tunable C

Per-query consistency: ONE for EL speed, QUORUM for read-your-writes, ALL for EC at the cost of availability if any replica is down.

Read replicas everywhere

EL hiding behind EC

MySQL and Postgres often run with multiple read replicas. Writes go to primary (EC for writes); reads go to any replica (EL). Most apps tolerate this — unless a user writes then immediately reads.

Session stickiness

Pragmatic EC for one user

Route a user's reads to the replica that received their latest write. Pseudo-EC without the global coordination cost. Works until the replica fails.

06

Used in problems

News feed picks PA/EL for massive read scale. Typeahead suggestions tolerate milliseconds of staleness (EL) for latency. Google Docs picks PC/EC for collaborative edits — correctness is non-negotiable.

Next up