Skip to content

Lesson 5 of 9 · 28m

Geo-Distributed State and the Consistency Menu

Choose between global strong consistency, regional authority, replication lag, and edge-local state based on invariants rather than fashion.

Distributed state discussions become useless the moment somebody says “we need strong consistency” without naming the invariant. Money cannot be negative. Inventory cannot be sold twice. A leaderboard can lag. A feature flag can converge. Consistency is not one property; it is a menu of guarantees attached to specific operations.

Name the invariant first

Before choosing a database or replication model, write the rule that must never break:

Invariant: a user may not spend the same credit twice.
Invariant: a seat count may not exceed the purchased license count.
Invariant: every user eventually sees their own profile update.
Invariant: recommendations may be stale for up to five minutes.

Different invariants in the same product can choose different models. The mistake is forcing the entire system into the strictest model because nobody separated them.

The practical consistency menu

single-writer strong consistency
  simplest reasoning, highest WAN write latency

regional authority
  writes routed to owning region; good locality, harder movement

multi-writer conflict resolution
  low-latency writes, difficult semantics and merge correctness

read replicas / cached reads
  fast reads, stale reads, explicit staleness handling

edge-local ephemeral state
  very fast, must not be authoritative

There is no free lunch here. CAP is often oversimplified, but the operational lesson survives: during network partition, you choose whether to preserve availability or prohibit potentially conflicting operations.

Geo-routing users is not geo-locating truth

A user in Europe hitting a European PoP does not mean their authoritative object lives in Europe. If the write still depends on a primary database in Virginia, you have built a globally distributed proxy to one database. Sometimes that is correct! It gives you TLS termination, caching, and edge policy while preserving simple write semantics. Just do not confuse it with regional data authority.

Replication lag is user experience

Read-your-writes failures feel broken even when the system is “eventually consistent according to design.” After mutation, route the user’s reads to the authoritative region or use tokens, timestamps, or write-aware caching to preserve causality:

POST /profile -> authoritative region commits version 42
response sets/profile returns replication watermark or object version
subsequent reads wait for or request version >= 42

You may not implement full causal tracking on day one, but you must at least understand which operations users expect to observe immediately.

CRDTs are not magic merge dust

Conflict-free replicated data types work when the data shape supports commutative or semantically mergeable operations: counters, sets with clear add/remove semantics, some collaborative text structures. They do not solve business conflicts such as “two users bought the last concert ticket.” If the invariant is scarce resource allocation, you need serialization or reservation semantics somewhere.

A sane default architecture

For many applications: keep strongly consistent writes in one or a few authoritative regions, aggressively cache immutable or low-risk reads at the edge, and use asynchronous replication for recovery and read locality. Add regional write authority only when latency or sovereignty requirements justify operational complexity.

Field notes

  • “Multi-region active-active” is a topology, not a consistency guarantee. Ask how conflicts are prevented or resolved.
  • Clock-based last-write-wins can silently discard correct data when clocks skew. Prefer explicit versions where correctness matters.
  • Test failover with writes in flight. Quiescent failover demos hide the interesting behavior.
  • Put the consistency rule in the schema or service contract, not only in a design document nobody reads during an incident.

Was this lesson helpful?

Sign in to rate