What it is
“Strong consistency” is used loosely, but its precise form for a single object (a key, a register, a row) is linearizability (Herlihy and Wing, 1990): every operation appears to take effect atomically at some instant between its invocation and its response, and that order agrees with real time. Practically:
- Once a write has completed, every read that starts afterwards, from any client, returns that value or a newer one.
- Once any read has returned a value, no later read returns an older one.
- Operations that overlap in time may be ordered either way.
It is what CAP calls “C”. For multi-object transactions the analogous guarantee is strict serializability (serializable plus real-time order; Spanner calls it external consistency).
Why it exists
Code written for a single database assumes one copy: check a balance then debit it, insert a username that must be unique, acquire a lock, elect a leader. With replicas, a read can hit a copy that has not yet seen a confirmed write, and those checks silently become wrong. Linearizability lets you keep writing code as if there were one copy, even though there are many.
How it works
Single leader, leader reads. All writes and reads go to one node, which orders them. Simple, linearizable as long as there is exactly one leader. The catch is the word exactly: after a partition, a deposed leader may not know it was replaced. Protocols handle it in two ways:
- ReadIndex (Raft): before answering, the leader records its commit index and confirms with a heartbeat round that a majority still accepts it as leader. One round trip per read (batchable).
- Leader leases: followers promise not to elect a new leader for a lease period; the leader serves reads locally while its lease is valid. No round trip, but correctness depends on bounded clock drift and pauses.
Synchronous replication to followers. The leader confirms a write only after followers have applied it, so a confirmed write is present everywhere. Follower reads then never miss a confirmed write. Strictly, there is still a window while a write is in flight where one follower shows it and another does not, so a client could see the new value and then the old one; fully linearizable designs close that with quorum reads or reads through the leader. Waiting for every follower also means one slow follower slows every write and one dead follower blocks writes.
Majority quorums (consensus). Raft, Multi-Paxos and Zab commit a write when a majority of nodes has persisted it, and elect leaders by majority vote. Any two majorities intersect, so a new leader always has every committed entry, and a read that consults a majority (directly, or via a leader that proved its leadership) sees the latest commit. With 2f + 1 nodes the system tolerates f failures; latency is set by the fastest majority, not the slowest node. etcd, ZooKeeper, Consul, CockroachDB, TiKV and Spanner (Paxos plus TrueTime) work this way.
Leaderless quorums. Dynamo-style stores with N replicas, writing to W and reading from R with R + W > N, make reads overlap the latest write. On their own they are not linearizable: concurrent writes, sloppy quorums, partial write failures and missing read repair can all produce anomalies. Treat “quorum” there as “usually fresh”, not as linearizable.
The cost. Each linearizable write needs a round trip to a majority; each linearizable read needs either the same or a lease. Across regions that is tens to hundreds of milliseconds per operation, and during a partition the minority side cannot serve.
When to use it
Where a stale read becomes a bug rather than a delay: distributed locks and leases, leader election, configuration and service metadata, uniqueness constraints (usernames, idempotency keys), account balances and inventory with hard limits, and any check-then-act sequence across clients. Coordination services (etcd, ZooKeeper) exist so you can keep this small, strongly consistent core separate from the bulk data.
When not to
Feeds, counters, analytics, recommendations, caches and most read-heavy content tolerate staleness. Paying a majority round trip for them wastes latency and capacity. Often a weaker guarantee covers the real requirement: “a user sees their own edits” is read-your-writes, not linearizability.
Trade-offs
| Approach | Reads | Writes | Tolerates |
|---|---|---|---|
| Leader reads with ReadIndex | One majority round trip, leader capacity | Majority round trip | Minority failures |
| Leader reads with lease | Local on leader | Majority round trip | Minority failures; assumes bounded clock drift |
| Sync to all followers, follower reads | Local on any follower (small in-flight gap) | Wait for slowest follower | No failed follower without reconfiguration |
| Async followers | Fast, not linearizable | Fast | Anything, but loses consistency |
Alternatives
- Sequential consistency: one global order respected by each client, but not tied to real time.
- Causal consistency: causally related operations are seen in order; available during partitions.
- Session guarantees: read-your-writes, monotonic reads, monotonic writes, writes-follow-reads; cheap and often enough for user-facing features.
- Bounded staleness: reads at most t seconds behind, e.g. follower reads at a timestamp in distributed SQL databases.
Failure modes
- Stale reads from a deposed leader when leadership is not re-verified or leases rely on clocks that jumped.
- Lock without fencing: a client whose lock expired during a pause keeps writing; the storage must reject stale fencing tokens.
- Even-sized clusters: 4 nodes tolerate only 1 failure, like 3, while adding a node to every quorum.
- Cross-region quorum latency: placing a majority across continents makes every write pay intercontinental round trips.
- Assuming “quorum” means linearizable in leaderless stores.
In production
Keep consensus groups at 3 or 5 members spread over failure domains so one zone loss leaves a majority. Use the database’s linearizable read mode explicitly where needed (for example, etcd’s default linearizable reads versus serializable reads, or reading from the leaseholder in CockroachDB). Monitor leader changes, commit latency and lease expiry. Use fencing tokens for anything protected by a lock. Measure the latency cost per operation and confine strong consistency to the data that needs it.
Common misconceptions
- “Strong consistency means ACID.” ACID is about transactions on one database; linearizability is about replicas agreeing with real time.
- “If replication is synchronous, every read is linearizable.” Not during in-flight writes, and not if a deposed node can still answer.
- “Quorum reads are always linearizable.” Only with additional mechanisms; R + W > N alone is not enough.
- “Strong consistency is too slow to use.” Within a region a majority round trip is typically a millisecond or two; the cost becomes dominant across regions.
Interview angle
Define linearizability with the timeline (“a read that starts after a write completes must see it”), then say how you would get it: a Raft or Paxos group, majority commits, leader reads with ReadIndex or leases. Explain the cost (a majority round trip per write, more across regions) and the availability consequence (the minority side stops during a partition). Then scope it: “I would use etcd for locks and leader election, and keep the user feed eventually consistent.”
Model assumptions
The simulated steps use a simplified model, not a benchmark. The app sends 120 requests per second (20% writes over 30 keys, Zipf 1) through a database proxy that sends writes to the leader and reads to the followers (or to the leader when the follower routes are removed). Each database has 8 connections, 30 ms reads and 10 ms writes. Followers apply each change about 50 ms after the leader (a 2 ms link plus a 50 ms replay delay; Follower 2’s link becomes 120 ms later on). Synchronous means the leader confirms once every follower has applied the write (10 ms of apply time each, on top of the replay delay) and its acknowledgement has travelled back; the leader keeps a connection busy meanwhile; in the majority step it confirms once one of the two followers has (leader plus one follower is 2 of 3), and reads go to the leader, standing in for ReadIndex or a lease (the leader's leadership check is not modelled). A stale read is a follower read that misses a write the leader already confirmed, which the lesson treats as a linearizability violation; the model does not check the in-flight window. The definition timeline and the deposed leader are scripted illustrations: the engine has no leader election, terms, ReadIndex or leases. Numbers show behaviour and orders of magnitude only.
How to read this demonstration.
- Actual engine simulation: a leader with two followers: asynchronous follower reads that go stale, reads routed to the leader, synchronous replication with its latency (delay, apply, acknowledgement), a distant follower, and the 1-of-2 acknowledgement rule with a follower crash.
- Scripted animation: the definition timeline and the deposed-leader step (traffic paused).
- Hybrid demonstration: none.
- Simplified model: one fixed leader; the stale-read counter counts follower reads that miss a write the leader already confirmed; it does not check the order of concurrent operations or the in-flight window, so it does not prove linearizability.
- Time compression: slow motion (about 0.1 times real time).
- Not supported by the simulation: Raft or any consensus protocol, leader election, terms, ReadIndex and leases, linearizability checking, network partitions.