Book a 30-min callBook a call

Consistency models explained: CAP, PACELC, linearizability and eventual consistency

What the CAP theorem really proves, PACELC, linearizable, causal and eventual consistency, quorums where R + W > N, and how to pick a model for each feature.

Three replica boxes joined by lines, one line cut by a cross, a client circle reading from two of them, and a scale from strong to eventual.
Written by
BYD Tech
Published
Topic
Deep dives
Reading time
15 min read

Questions people ask

Is the CAP theorem still relevant?

Yes, as a precise result with a narrow scope: during a network partition, a replicated system must either refuse some requests or return possibly stale data. It is less useful as a way to classify databases, because most let each request choose, and because the everyday trade-off, outside partitions, is latency against consistency, which PACELC describes.

What is the difference between linearizability and serializability?

Linearizability is about single operations on one object: each appears to happen at one instant between its start and its end, in real-time order. Serializability is about transactions over many objects: the result equals some serial order, which need not match real time. Having both is called strict serializability.

Does R + W > N guarantee strong consistency?

It guarantees that every read quorum overlaps every write quorum, so a read sees the latest write that finished. It does not make reads linearizable while a write is still in flight, and sloppy quorums, last-write-wins conflict resolution and clock skew can weaken it further. Abadi notes that Dynamo-style systems do not reach Gilbert and Lynch’s consistency even with R + W > N.

Can an app use eventual consistency for some data and strong for the rest?

Yes, and most should. DynamoDB, MongoDB and Cassandra all let a request choose its consistency, and a relational primary with read replicas lets you send reads that must be fresh to the primary. Decide per feature, based on which stale read would be a visible bug.

Is a single PostgreSQL server linearizable?

For reads and writes on the primary, a single server behaves like one copy, so committed writes are visible to transactions that start afterward. Isolation is a separate question: at the default Read Committed level, concurrent transactions can still lose updates. Reads from asynchronous replicas can be stale.

Building something like this?