You have probably shipped this bug. A seller changes a price, saves, and the console shows the old number. A buyer refreshes an order list and an order disappears, then comes back on the next refresh. A support agent replies to a message and the reply appears above the question it answers.
None of these throws an exception. None of them shows up on a dashboard. All three are consistency bugs, and each one sits on a different rung of the same ladder.
You need the ladder, because strong vs eventual is not a choice between two boxes. Strong consistency means that once a write completes, any later read returns it. Eventual consistency means that if writes stop, replicas converge on the last value, with no promise about when. Sequential consistency, causal consistency, read-your-writes, and monotonic reads sit between those two sentences, and each one fails in a way a user can describe in a support ticket.
I keep the aim narrow here: the ladder, the symptom, and the price. The post stays out of the CAP theorem's narrow scope on purpose. The theorem explains why the trade-off exists during a fault. What a buyer sees on the next page load is a different question.
What is the difference between strong and eventual consistency?
You get one of two promises. Strong consistency covers the read after the write. Eventual consistency covers what happens when the writes stop.
Werner Vogels gave both in one article. Under strong consistency, after the update completes, any subsequent access (by A, B, or C) will return the updated value.
Under eventual consistency, the storage system guarantees that if no new updates are made to the object, eventually all accesses will return the last updated value.
Read the second sentence again and notice what it withholds from you: a bound. Not a small bound, not a large bound, no bound at all. Eventually
is a liveness promise, and a liveness promise lets a user see yesterday's price all afternoon.
The practical measure is what Vogels calls user-perceived consistency
: the inconsistency window needs to be smaller than the time expected for the customer to return for the next page load.
I use that window as my working rule. If the gap is shorter than the customer's return, the label does not matter.
That gap is where the four rungs in between live.
Why is strong vs eventual consistency the wrong pair to compare?
Because you are choosing between at least six rungs, and each rung produces a different bug.
Jepsen's model map orders the single-object models like this: strict serializable implies linearizable, which implies sequential, which implies causal, which implies writes-follow-reads and PRAM, which implies monotonic reads, monotonic writes, and read-your-writes. Weaker models sit below, and eventual consistency is less a single model than a family of them.
You will not need the hierarchy. What matters is the question each rung answers: which anomaly will the design allow?
Linearizability forbids a value that goes backwards after a write completes. Sequential consistency forbids disagreement about order but permits an order that never happened. Causal consistency forbids an effect before its cause.
Read-your-writes forbids a client's own write from vanishing. Monotonic reads forbid an older value after a newer one. Eventual consistency forbids none of these.
Once you see it that way, the debate changes shape. The choice is not a database personality; it is a list of support tickets you are willing to accept. When I review a design, I ask which anomaly the team has agreed to allow. Quorums, ordering and leader election belong to how to design a distributed system, not here.
What does linearizability actually promise your user?
You get one copy of the data, and every operation takes effect at a single instant in real time.
Jepsen's definition gives the test: every operation appears to take place atomically, in some order, consistent with the real-time ordering of those operations.
If operation A completes before operation B begins, B sees A's effect. That real-time clause is the part you pay for. It is what stops a confirmed write from being invisible to the next reader.
Two production systems sell the promise directly. A Spanner strong read is guaranteed to see all data that has been committed up until the start of this read
, and Google's own FAQ answers Does Spanner provide linearizability?
with Yes.
Cosmos DB calls its strong level linearizable and commits a write to every region before acknowledging it.
The user experiences it as an absence: no order that confirms and then does not exist, no balance that reads high and then low, no saved
that did not save. You pay for that absence in milliseconds on every write and in availability during a failure. Cosmos DB prices it at twice the round-trip time between the two farthest regions plus 10 ms at the 99th percentile, and blocks strong consistency by default beyond 5,000 miles.
That is your top rung. I would pay for it at checkout and argue about it nowhere else. I default lower than that.
What does sequential consistency let you see that linearizability forbids?
You can see a consistent order that never happened.
Keep Lamport's definition: the result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in this sequence in the order specified by its program.
Notice what Lamport leaves you: nothing about wall-clock time. Every client can agree on one total order, and that order can still put a write before a read that physically happened before it. Nobody disagrees. The story the user lived through is still wrong.
Concretely, two support agents can see the refund and the cancellation in the same order, while the customer's screen showed the cancellation completing first. Both agents agree with each other and contradict the customer. That history is legal under sequential consistency and illegal under linearizability.
Almost no product sells this rung by name. It appears inside systems that need a total order for a narrower purpose, such as a replicated log or a coordination service, and it leaks into product behaviour when someone assumes everyone sees the same order
means everyone sees the true order
. I use a blunt test: if you and a colleague can compare screens and disagree about what happened, the system is already below sequential consistency.
What breaks when you only promise causal consistency?
A reply can appear before the post it answers.
Causal consistency requires that causally related operations appear in the same order everywhere, while independent operations may be ordered differently. Jepsen gives a three-person chat: if Attiya asks shall we have lunch?
and Barbarella and Cyrus answer, then no participant ever observes 'yes' or 'no' prior to the question 'lunch?'
, even though the two answers may swap order between readers.
That is the comment thread in your product. That is why you want causality for feeds, threads, and collaborative documents: nobody cares whether two unrelated comments are ordered the same for everyone, but everyone notices a reply above its parent. I would not ship a comment thread on eventual reads, and I would not pay for linearizability to fix it.
MongoDB gives the clearest shipping example. Causal sessions guarantee read-your-writes, monotonic reads, monotonic writes, and writes-follow-reads, but only when reads use majority read concern and writes use majority write concern. A session can be advanced with advanceClusterTime and advanceOperationTime so a second client inherits the causal position of the first.
Here is the part worth internalising. Jepsen found that MongoDB's causal sessions did not preserve causal consistency by default: users needed to specify both write and read concern `majority` (or higher) to actually get causal consistency.
The guarantee was documented, correct, and off by default.
The cost is a specific kind of availability. Causal consistency is sticky available: even in the presence of network partitions, every client connected to a non-faulty node can make progress. However, clients must stick to the same server.
What do read-your-writes and monotonic reads fix?
You get the two bugs users actually report: I saved it and it vanished
and it came back
.
These are the session guarantees, named by Terry and his colleagues at Xerox PARC in 1994. They proposed four: read your writes, monotonic reads, writes follow reads, and monotonic writes, so that a client's view stays consistent with their own actions, even if they read and write from various, potentially inconsistent servers.
Their motivating example is a password change, and it is more than thirty years old and still exact: After changing his password, a Grapevine user would occasionally type the new password and receive an 'invalid password' response. This annoying problem would arise because the login process contacted a server to which the new password had not yet propagated.
That is read-your-writes. The write completed. A different server had not heard about it. The user's own action came back as a rejection.
Monotonic reads are the mirror image, and the same paper gives the example: If the user stops reading mail and returns sometime later, she should not see deleted messages reappear simply because the mail reader refreshed its display from a different copy of the database.
Both guarantees apply per session, not globally. Read-your-writes says nothing about what another user sees: There is no guarantee, for instance, that if process 1 writes a value successfully, that process 2 will subsequently observe that write.
That narrow scope is what makes them cheap for you, and it is what makes them insufficient for checkout.
The costs are not equal, and this is the detail most we do session consistency
claims skip. Read-your-writes is at most sticky available. Monotonic reads can be totally available. Jepsen's summary: If you need total availability, you'll have to give up causal (and read-your-writes), but can still obtain writes follow reads, monotonic reads, and monotonic writes.
So monotonic reads are the bargain of the ladder. The guarantee removes a whole class of it came back
bugs, needs one version number per client, and costs no availability at all. I default to read-your-writes plus monotonic reads for a new product, and nothing stronger until a screen demands it.
Why are sticky sessions the cheapest session guarantee?
Because they buy read-your-writes with a cookie instead of a protocol.
If every request from one browser lands on the same server, that server has seen the write, and your next read returns it. No token, no version, no replica wait. An Application Load Balancer does exactly this: it uses stickiness to bind a user's session to a specific target. This ensures that all requests from the user during the session are sent to the same target.
Vogels names the same mechanism from the storage side. Whether read-your-writes and monotonic reads can be achieved depends in general on the 'stickiness' of clients to the server that executes the distributed protocol for them.
The fragility is in the failure path, and the AWS documentation is unusually honest about it. If the target becomes unhealthy, the load balancer stops routing requests to that target, and chooses a new healthy target
, and it treats the session as now being 'stuck' to the new healthy target.
The session survives. The guarantee does not. Your user's next read hits a server that never saw the write, and the bug disappears from the design and reappears in production at the exact moment the system is already unhealthy.
Sticky sessions give you a reasonable answer with one region, short sessions, and a write rate low enough that a rebind is rare. They are a bad answer when a rebind is likely, because the guarantee vanishes precisely when traffic is being redistributed. I treat them as a caching decision that happens to buy a guarantee, not as a consistency design.
How do you keep read-your-writes when sessions cannot be sticky?
Carry a version with the write, and refuse to serve a read from a replica that has not reached it.
Your write returns a token, and your next read presents it. If the replica is behind, you wait, route to a replica that is caught up, or read the primary. That is the whole pattern, and it works with any store that exposes a position.
Cosmos DB ships it as the session token. The client caches a token after each write and sends it on reads: if the replica against which the read operation is issued contains data for the specified token (or a more recent token), the requested data is returned
, and otherwise the client retries elsewhere. Session consistency is, in Microsoft's words, the most widely used consistency level for single-region and globally distributed applications.
Two limits matter to you. Session tokens are partition-bound
, so a token covers one partition, not the whole database. And when the client has no cached token for a partition, after a restart or on a new instance, reads to that physical partition behave as reads with Eventual Consistency
until new writes rebuild the cache. A session guarantee with a cold cache is not a session guarantee.
MongoDB exposes the same idea as clusterTime and operationTime, with advanceClusterTime and advanceOperationTime to hand a causal position from one session to another.
PostgreSQL gives the raw parts and no SDK. pg_current_wal_lsn() returns the current WAL write location, pg_last_wal_replay_lsn() returns the last location replayed on the standby, and the docs note that pg_wal_lsn_diff on that pair gives the replication lag. You save the first on write, compare it with the second on read, and wait or reroute when the standby has not caught up.
The cost is plumbing, and it is real: every write path must return a token, every read path must accept one, and every client must carry it across page loads, workers, and retries. Terry's estimate of the state involved is reassuringly small, only two version vectors
per session, but the surface area is yours to maintain. I ask for the token on the write path before I argue about the read path, because that is where the contract is cheapest to add.
What does each database actually give you, and what does it charge?
A product name is not a guarantee. The guarantee is the pair of settings you actually deployed.
| System | Strongest common setting | What the user notices when you leave it | What it costs |
|---|---|---|---|
| Spanner | Strong reads by default; external consistency | Nothing, because stale reads are opt-in | Read latency; opt-in staleness is the escape hatch |
| Cosmos DB — consistency levels | Strong through Eventual, five levels | Anything from a vanished write to an old counter | Strong writes: 2×RTT + 10 ms p99; half the read throughput |
| DynamoDB — strongly consistent reads | Optional strong read per request | A GSI read that lags the table | Strong reads cost twice the eventual read; GSIs are always eventual |
| Cassandra — consistency levels | Per-query level: ONE, QUORUM, ALL, LOCAL_QUORUM | An acknowledged write that a later read misses | A higher level means more replicas must answer; last-write-wins can discard by clock |
| PostgreSQL — read replicas | Primary reads; standbys are async | Replica reads that lag the primary | Standby queries can hold back replay for everyone |
| Kafka — acks and visibility | acks=all plus min.insync.replicas |
A record not yet visible to consumers, or lost | The producer blocks on the in-sync set; unclean election trades data for uptime |
Spanner makes strong the default and makes staleness explicit. A stale read is a read at a timestamp in the past
, bounded-staleness or exact-staleness, and Google suggests that 15 seconds is a reasonable staleness value to use for good performance.
That is rare: a vendor telling you which number to put on the dial.
DynamoDB makes the choice per request. Eventual reads cost half of strong ones, strong reads exist only on tables and local secondary indexes, and every GSI read is eventual. So your table can be fresh while the index you built for the orders screen is not. If your support agent sorts by a GSI, the data is eventual and no ConsistentRead flag changes that.
Cassandra's consistency level controls acknowledgement, not delivery: Write operations are always sent to all replicas, regardless of consistency level. The consistency level simply controls how many responses the coordinator waits for before responding to the client.
Overlapping read and write quorums make an acknowledged write visible to a later read, and LOCAL_QUORUM gives single-datacenter clients reads that see the latest write from within the same datacenter
— read-your-writes by geography. That is a real guarantee and it is not linearizability, because conflict resolution is last-write-wins and Cassandra's correctness does depend on these clocks.
Enable transient replication and monotonic reads go away too, which the docs state plainly.
PostgreSQL's standby is the plainest statement of eventual consistency any vendor provides: We say that data on the standby is *eventually consistent* with the primary.
A standby cannot run Serializable isolation today, and a long-running standby query can delay WAL replay, which means one analyst's report can pin every other session on that replica to an older database. A read replica is not a free scaling win for you. It is a consistency decision with an operational footgun.
Kafka is not a database and should not be read as one. acks=all means the leader will wait for the full set of in-sync replicas to acknowledge the record
and guarantees that the record will not be lost as long as at least one in-sync replica remains alive. This is the strongest available guarantee.
With min.insync.replicas, the messages will not be visible to the consumers until they are replicated to all in-sync replicas and the min.insync.replicas condition is met
, and unclean leader election may pick a replica outside the in-sync set even though doing so may result in data loss.
What you get is a per-partition total order: Our topic is divided into a set of totally ordered partitions, each of which is consumed by exactly one consumer within each subscribing consumer group at any given time.
Nothing in that sentence orders two records that landed in different partitions, and nothing in it promises freshness.
I read this table as a menu of defaults, not a ranking. Every row is a setting you deployed, and the setting is what a design review should argue about.
What does the ladder cost in latency and availability?
Consistency is not free, and the bill arrives in four currencies.
Latency and throughput. The table above prices both. A linearizable write waits for the furthest replica, and in Cosmos DB and DynamoDB a strong read consumes more capacity than an eventual one. The numbers are vendor-quoted and they do not move.
Availability under partition. Jepsen's bound is the one to quote in a review: All models at or stronger than cursor stability, snapshot isolation, and sequential cannot be totally available in asynchronous networks. All models at or stronger than read your writes can be at most sticky available.
Notice what that does to the usual story. Even the modest rungs at or above read-your-writes cost you something. The full availability arithmetic belongs to how to design a highly available system, but the rung you pick decides which side goes dark.
Engineering surface. Tokens, retries, idempotency keys, and the tests that prove the guarantee still holds after a failover. This cost never appears on your latency chart and always appears in your on-call rotation.
Durability. Cosmos DB's own table gives session, consistent prefix, and eventual an RPO of < 15 minutes
during a region-wide outage in a multi-region account, while strong consistency is the only row with an RPO of zero. Weaker consistency is not only staler reads. In a regional failure it can also mean lost recent writes.
I rank the four as availability, latency, plumbing, then durability, because that is the order they page you.
Which consistency should you choose for each screen?
Classify screens, not databases. One system can serve several rungs, and usually should.
| Screen | Guarantee needed | Why |
|---|---|---|
| Product page, catalogue, reviews | Eventual | A price that is a second old changes nothing the buyer can act on |
| Seller edits stock, then reloads | Read-your-writes | The user must see their own write, or they will do it again |
| Order list, paginated | Monotonic reads | A page-two refresh must not resurrect a cancelled order |
| Comment thread, activity feed | Causal | A reply must never precede its parent |
| Support console while the buyer is on the phone | Read-your-writes plus causal | The agent reads what the buyer just did, and the thread stays coherent |
| Checkout, payment, inventory reservation | Linearizable | The read and the write are the same decision |
Defend the checkout row, because it is where the argument usually collapses into can we get away with eventual?
You cannot, for a structural reason. Reserving the last unit is a read followed by a write, and the pair has to behave as one operation. That is the same conclusion the CAP post reaches from the other direction.
Defend the catalogue row from the other side. A team that puts strong reads on the product page has bought latency for a guarantee nobody can perceive. If your system is still small enough to have one primary and no replica, there is no staleness to bound, and ecommerce architecture at 100 users is the proof that your honest answer can be none of this yet
.
I would rather defend a small table than a database label. The table survives a change of vendor; the label does not.
What should you write down before you pick a rung?
Write down the ladder, not a checklist. Three lines, in the design doc, before the code.
The first line is which rungs this product actually uses. Not which database it runs, and not a CAP letter. The second is which screen sits on each rung, because a system with one rung is usually a system that never classified its reads. The third is who owns the token that carries the session across servers, because an unowned guarantee is the one that breaks silently at failover.
If you leave those lines blank, you have made no consistency decision. You inherited a default. And a default is what users get: Jepsen reports MongoDB's own user research, roughly 80% of users of their hosted MongoDB service use the default write concern, and 99.6% of users use the default read concern.
The causal guarantee was documented, correct, and effectively unused.
That is the practical case for treating consistency as a ladder instead of a binary. Not because the theory is elegant, but because eventual
and strong
are the two words a vendor puts on a slide, while the four rungs in between are what the code actually does on the page load after a write.
Your users will never say eventual consistency
. They will say the price came back, the order disappeared, or the reply is above the question. Pick the rung that makes those sentences impossible, and pay for it only on the screens where someone would notice. The system design practical guide puts that decision in the order the rest of the design depends on.
Related Reading
CAP Theorem Explained With Real Examples
The string CAP appears zero times in the OSDI 2012 Spanner paper, and so do the surnames Gilbert and Lynch.
How to Design a Distributed System: Six Decisions in Order
You design a distributed system by making six decisions in order — where state lives, how many copies exist, how those
How to Design a Highly Available System: The Design Sequence
Why How to Design a Highly Available System Is a Sequence, Not a Checklist High availability is not bought by piling on