Consistency vs Availability: How to Choose, Operation by Operation

By Arkaitz

Your design review has one decision on the table, and somebody has already
answered it with a noun. The system is eventually consistent. You know that
settles nothing. The read that renders a product description and the read that
decides whether you can sell the last unit in a warehouse take different paths,
and you should not pay the same price for both.

You are choosing, for one operation at a time, whether a reader may see a value
that is not the latest committed one, and whether a writer may be told no. Three
inputs settle it for you: what the stale read costs your reader, what the refused
write costs your business, and how many minutes of downtime you can operate.
Everything else is a mechanism you buy one of those with.

You will meet the narrow version of the theorem in
the CAP theorem explained with real examples;
this post is the decision that follows it. Below you get the procedure, then the
evidence from the systems that already ship the dial: DynamoDB, Cassandra,
Cosmos DB, Spanner, PostgreSQL, Kafka and etcd.

Consistency vs availability: what are you choosing?

Consistency gives one correct answer, whichever replica serves it. Availability
gives an answer at all, even a late one. While your network is unreliable you
cannot guarantee both for the same operation, so you give one up, and the one you
give up is a cost you can price.

Your pricing is asymmetric, and the asymmetry is the whole skill. A read can be
served a little old with nobody harmed. A write cannot be served half-refused:
either your row is committed or your caller learns it was not. When you hear a
team say it chose eventual consistency, check its writes — they are usually
still strong on the same table.

So start with the direction. Are you deciding how fresh a read must be, or
how often a write may be refused? You are making two decisions with two budgets,
even when they touch the same row.

Why does the system-wide label fail?

You get a different answer from the same product on every call path. The default
is one path; the override carries its own bill. Sometimes the default is the
cheap end, sometimes it is the safe one. That is why the label describes a
default you can override, not a capability you own.

DynamoDB returns an eventually consistent value unless the request sets
ConsistentRead, and a strongly consistent read only exists on a table or a
local secondary index. Ask for one on a global secondary index and you
get a ValidationException.

Cosmos DB sets five levels on an account, and an SDK client can override the
default for its own reads while writes still replicate at the account's
level. Spanner returns strong reads by default and stale reads
on request. An etcd Range call is linearizable by default;
serializable=true serves the same read locally, cheaper, possibly stale.

You can watch the label dissolve inside one PostgreSQL cluster. Your primary
serves the latest value, your hot standby serves whatever the replay has reached,
and one synchronous_standby_names list decides whether a standby counts at
all.

When you say our system is AP, you are describing a diagram. When you say
this read may be 400 ms stale and this write may not be refused, you are
describing your system.

What do CAP's C and A require?

You are asking for less than you think. C is atomic consistency, the strictest of
the commonly used models. A requires every request that reaches a non-failing
node to get a response, with no time bound on it. Neither one describes your
p99.

When you ask for C, you ask for a total order on all operations such that each
operation looks as if it were completed at a single instant.
That is
linearizability, not the replicas agree eventually and not ACID's C. When you
ask for A, you ask that every request received by a non-failing node in the
system must result in a response
— and your request can take ten seconds and
still count.

Both words are narrower than the argument you are having, and their scope is a
single register. The authors are explicit about the first: they focus on
atomicity due to its simplicity.
The theorem's own vocabulary needed a patch too: its published definition of
linearizability was missing a prime in condition L2 until Sela, Herlihy and
Petrank amended it at PODC 2021.

That is as far as the theorem takes you. You start where the CAP post stops:
with your operation.

Which three inputs settle the decision?

You price the stale read, you price the refused write, and you check the failure
budget. If all three are cheap, you take the cheapest mechanism. If one is
expensive, that input picks the mechanism for you.

Input The question you ask Cheap answer Expensive answer
Staleness damage What does your reader do wrong with an old value? Nothing they can see Money moves twice, or goods ship
Refusal cost What happens if your write returns an error? A silent retry A lost order and a phone call
Failure budget How long may this path be down per month? 43.2 minutes (99.9%) 4.32 minutes (99.99%) or 26 seconds (99.999%)

Run the three in a fixed order, because the order is the point. You decide the
read first, because you can usually buy freshness on a read with money and
milliseconds. You decide the write second, because you usually buy write
durability with availability. Run it the other way and you end up with an
expensive write path and a read path nobody audited.

The inputs also argue with each other, which is why the order matters. A strong
read that looks free on your product page becomes expensive the moment it
competes with the inventory writes on the same primary. A write that looks cheap
to refuse becomes unacceptable once you price the lost order.

There is a tie-breaker. When two mechanisms clear all three inputs, you take the
lower rung, because every rung above it charges you for something you did not ask
for: a replica to lag, a quorum to reach, a failover to run.

There is also a stopping rule. The moment a mechanism clears your three inputs,
you stop shopping, because you are not looking for the strongest guarantee in the
product — only the cheapest one that survives your worst realistic Tuesday.

Write the three answers down before you write the schema. The expensive one tells
you which of the next three sections you need, and if two come back expensive,
you have found the operation that decides your architecture.

What does a stale read cost your user?

You get one of four answers, and the class sets your bound. Sort your operation
into a class before you shop for a setting.

You can serve a product description, an image URL or a category label five
minutes old and your reader sees nothing wrong. That is the invisible class, and
any rung works, including a cache with an untuned TTL.

You can serve search ranking or recommendations a minute old and your reader gets
a slightly worse answer that the next request fixes. That is the self-correcting
class: minutes stale is still useful.

You cannot serve a stock badge, an estimated delivery date or a price stale
without your reader acting on it. The reader does not see an old value; they see
a promise the system now has to keep. You state the bound for this class in your
product copy, not only in your config.

You cannot serve an account balance, an entitlement or a shipment trigger from
anywhere but the authoritative path. Your reader cannot undo the action with a
later correct read, so you put no cache in front of it that someone can widen
during an incident. The axis is what the reader's next action can survive.

Your bound is the design decision. When you say bounded staleness instead of
eventual, you force yourself to name the number, and Cosmos DB makes that
literal: it lets you configure staleness as K versions or T seconds, whichever
you reach first. A bound you cannot state is a label you have not finished choosing.

What does refusing a write cost your business?

Each write carries a different price, and the ranking rarely matches the read
ranking. Nothing gets refused on a browse, because there is no browse write.

You can refuse an add-to-cart and your client retries it silently. You cannot
refuse a checkout without losing an order. You should refuse a ledger append,
because a failed request is better than a silent loss of the entry.

So you get the asymmetry in one line: strong reads cost you money and latency;
strong writes cost you availability.
The only way to never refuse a write is to
accept every write, including the ones the store cannot durably keep.

You pay twice for atomicity in DynamoDB, which performs two underlying reads or
writes of every item in the transaction: one to prepare the transaction and one
to commit.
Your transaction therefore costs double and stops at 100
items, and you should split it when you can do that without weakening
correctness, because simpler transactions conflict less and succeed more.

Price your refusal in business terms: returns 503 is not a cost, one order in
twenty at peak loses the customer
is, and it tells you whether your write path
may ever be unavailable. An idempotency key turns a retry into a replay rather
than a second charge.

How many minutes of downtime can you operate?

You have fewer minutes than the slide says, and the number picks your mechanism.
You write the budget down before you pick a consistency level, not after.

At 99.9% you get 43.2 minutes of unavailability a month. At 99.99%, 4.32
minutes. At 99.999%, about 26 seconds. You compare against those, not
the nines in a vendor brochure. DynamoDB commits to 99.99% under its Standard SLA
and 99.999% under the Global Tables SLA, and Spanner commits to 99.999%
for multi-region and dual-region instances and 99.99% for regional ones, or
99.95% in Stockholm.

A budget is also a claim about the people who operate the system. Cosmos DB's own
reliability documentation warns you that strong consistency needs at least two
regions to maintain quorum, and that if fewer are available and you do not
perform a failover, the account loses write availability until restoration of
the service.
When you choose strong consistency, you also
choose an operator who can run that failover at the hour it happens. A vendor
SLA is a refund schedule, not an operating target.

The same prerequisite appears in a PostgreSQL config file. With synchronous
replication, the minimum wait time is the round-trip time between primary and
standby
, and your commit may never be completed if any one of the synchronous
standbys should crash.
You have bought durability with a new way to
stop accepting writes.

If your budget is four minutes a month and nobody is on call to press the button,
the strong option is not actually available to you. You pick the rung you can
staff, and you let
how to design a highly available system
own the topology that makes staffing cheaper.

Which rung of the mechanism ladder do you stop at?

You take the lowest rung that satisfies your three inputs, and then you stop.
Every rung above it buys freshness you have not priced and charges availability
you have not budgeted. A leader election is a window with no writes, and every
leader failure pays for one.

  1. You can run one writer with no replica. There is no staleness to bound because there is nothing to read from. You keep the single database until the box is your bottleneck, which is exactly what ecommerce architecture at 100 users shows.
  2. You can put a TTL cache in front. You get speed and a staleness policy whether or not you wrote it down. You use it for the invisible class and never for the irreversible one.
  3. You can read from an asynchronous replica. You bound your freshness by replication lag, which you measure and alert on, and you get read-your-writes back through a token, a log position or a sticky session, not through a label.
  4. You can read from a synchronous replica. You pay one extra round trip for durability and, with the right setting, a replica you can read your own writes from. You also buy a new refusal mode: your write waits for a node that may be gone.
  5. You can require a quorum or a consensus protocol. You keep accepting writes after the leader dies without a human. You pay a majority of nodes, a round trip to that majority, and the maturity to run it, which is the subject of the six decisions that make a system distributed.

One product can straddle several rungs at once. The catalogue reads can sit on
rung two while the ledger sits on rung four, and the fulfilment events ride a
replicated log with its own durability setting. That is not inconsistency in
your design. That is your design.

What do the databases charge you for a fresh read?

You pay money, milliseconds, or an access pattern you can no longer use. Each
product invoices you differently.

DynamoDB charges capacity: Eventually consistent reads are half the cost of
strongly consistent reads
, so your strong read costs twice the RCU for the same
item. The second bill is schema: a strong read does not exist on a global
secondary index, so make it strong can mean redesigning your index for its
access pattern.

Cassandra charges coordination: more replicas must answer, and the slowest one
sets your wait. The default consistency level is ONE for reads and writes, and
QUORUM is sold as strong consistency, but it does not give you linearizability,
because increasing R and W cannot reach the Gilbert–Lynch definition even when
R + W > N. When you need a compare-and-set you buy a lightweight
transaction, at four Paxos phases and four round trips. You can
also choose ANY, which gives a guarantee that a write never fails and hands
the bill to your readers, who cannot read the value until the replicas
recover.

Cosmos DB charges throughput and distance. Strong and bounded staleness read from
two replicas instead of one, so you get half the read throughput for the same
request units. A strong write costs two round trips between your two farthest
regions plus 10 milliseconds at the 99th percentile, and above 8,000 km the
option is blocked by default. You can take session as the cheap default, but your
token is partition-bound and lives in your client; recreate the client and your
reads behave like eventual until your writes rebuild it.

Spanner charges timestamps. Strong is your default, and its stale-read option
carries a minimum useful interval: Use a minimum staleness of 10 seconds to
get a benefit.
Timestamps come from TrueTime, a clock whose
uncertainty is bounded, which is what lets you read consistently across regions
without blocking writes. Exact staleness goes further: a read at a
named timestamp blocks only on conflicting writes.

etcd charges a round trip. A linearizable read reflects the current consensus;
it needs a quorum round trip, while a serializable read is served locally, for
better performance and
availability, in exchange for possible stale reads.

What do the logs and replicas charge you for a durable write?

Your write setting is where you choose what to refuse. You pick it by naming the
failure it accepts, not the guarantee it advertises.

You get five rungs from PostgreSQL, split across two settings: your
synchronous_standby_names list decides whether a standby counts at all, and your
synchronous_commit value decides how far the commit waits. on waits
for your standby to flush to durable storage; remote_write waits only for its
file system; remote_apply waits until the change is visible to queries on the
standby, which the docs say allows for load balancing with causal
consistency.
Above one standby, FIRST 2 (s1, s2, s3) fixes which
node counts, and ANY 2 (s1, s2, s3) needs any two to answer. Those two settings
cover latency, durability and visibility, which is why the same cluster can
behave like three products.

Kafka ships the same ladder in acks. acks=0 does not wait, acks=1
waits for the leader's local log, and acks=all waits for your in-sync
replicas. You buy durability with the pair: with acks=all and
min.insync.replicas=2, the producer raises an exception if a majority of
replicas do not receive a write.
You should also know the default you inherited:
since 0.11, your broker waits for a consistent replica rather than promote a
stale one, and the design doc calls that a simple tradeoff between availability
and consistency.

That is the correction your next Kafka is AP conversation needs. The same doc
says Kafka may not remain available in the presence of network partitions. You
are not running an AP system. You are running a per-topic dial that someone set
to the durable end.

DynamoDB global tables charge the same rate over a larger radius. In the default
multi-region mode, changes replicate asynchronously, typically within a second
or less
, and conflicts resolve last-writer-wins. In the strong mode, a write is
synchronously replicated to at least one other Region before the write operation
returns a successful response
. That mode requires exactly three regions, offers
an RPO of zero, and gives up transactions, TTL and local secondary indexes to get
there.

You give up multi-item atomicity to buy zero data loss across regions. Durability
and atomicity are separate knobs, and a vendor can sell you one without the other.

What does the decision look like, operation by operation?

You run five steps in order, and you get a table you can paste into your design
doc. The steps are the same for a monolith and for a globally distributed
product; only your rungs change, which is why the
system design practical guide puts that
table before the topology.

  1. You name the operation and its direction. Read the stock badge is a decision. Orders is not.
  2. You classify the stale read. Invisible, self-correcting, decision-changing, or irreversible.
  3. You price the refused write. Silent retry, lost order, or unacceptable.
  4. You read the budget. Minutes per month for this path, and the name of the person you can page.
  5. You take the lowest rung that clears all three. You write down the setting, the staleness bound, the timeout, and your fallback.

Here is the table I ask for in a design review, before I look at the diagram. It
is a multi-tenant commerce engine with tenant-keyed shards, and the names are
generic on purpose.

Operation Stale read class Refused write cost Rung and setting Bound or fallback Timeout
Catalogue browse Invisible n/a Cache, TTL 60 s 60 s 200 ms
Product stock badge Decision-changing n/a Bounded-staleness read 2 s, then show check at checkout 200 ms
Add to cart Self-correcting Silent retry Async replica read, primary write 1 s lag alert 500 ms
Promo redemption Irreversible Lost discount, angry customer Conditional write on one shard Retry once, then fail 300 ms
Inventory reservation Irreversible Oversell Conditional write, single writer Zero; abort and retry 1 s
Order placement Irreversible Lost order Local transaction Zero; 40001 retry 1 s
Payment authorisation Irreversible Double charge Idempotency key, strong write Zero; replay first result 2 s
Invoice ledger Irreversible Lost revenue record Synchronous replica, remote_apply Zero; fail closed 500 ms
Fulfilment event n/a Duplicate shipment acks=all, min.insync.replicas=2 At-least-once, dedupe by key 5 s
Tenant analytics Self-correcting n/a Async replica, hourly rollup 1 hour 2 s

The table is the artefact. Notice what you did not write in it: a product label,
a CAP letter, or the word eventual. A table without that last column is the one
that gets re-litigated in the next incident.

The trade shows in two rows. You could make the stock badge strong, but
then you put catalogue reads on the inventory's primary; instead you bound it at
two seconds and let checkout re-check. You accept duplicate fulfilment events
because you can recover a duplicate and cannot recover a lost shipment. Both are
decisions about which failure you would rather explain.

You also put the timeout in the table beside the bound. The CAP post owns the
argument for why that number, not the product name, is the real policy.

What should you stop saying in design reviews?

You should stop saying two things: we chose eventual consistency and we're an
AP system
. Neither is an artefact, and both end your conversation early. What
you have is a set of promises, one per operation, priced in three currencies.

The recap is three prices. You price the stale read by the harm it does.
You price the refused write by what your business loses. You check the budget
against the minutes you can operate and the person you can page.

Then you take the lowest rung that clears all three, and you write the number
down.

Consistency is not a property of your database. It is a promise you make to one
reader about one value at one moment, and availability is a promise you make to
one writer that you will not hang up. You will make both promises thousands of
times, in the same product, on the same afternoon. You should make them one at a
time, on purpose, and let your table prove it.

Related Reading