StoicBuilder

HandbookXV the PantheonConsistency trade-offs

XVthe Pantheon, Design the system

Consistency trade-offs

1 min readUpdated 28 November

In plain words

The CAP theorem says that when a network partition splits a distributed system, each side must choose between staying consistent, by refusing some requests, and staying available, by answering with data that may be out of date.

Where you see it

Harbor runs in two regions, and the link between them drops for a minute. Should the Europe region keep accepting custom domain claims, risking two customers claiming the same name, or refuse them until the link returns? That decision is made per feature.

Design doc, two regionsagent
Feature During a split WhyCustom domain claims refuse (consistent) a name can only have one ownerDeploy log viewing serve the local copy slightly old logs harm no oneUsage counters accept, merge later counts can be added up afterwardsPlan upgrades refuse, retry later money needs one answer
Not one choice for the system, but one per feature, decided by the cost of a wrong answer.

What goes wrong

  1. Treating it as pick two of three

    Partitions aren't optional in a real network, so the real choice is what to do when one happens. The rest of the time you trade latency against consistency, which the PACELC framing adds.

  2. One choice for the whole system

    The domain registry needs consistency while the activity feed wants availability. Decide per feature, by what a wrong or missing answer would cost.

  3. Assuming your database's defaults

    Replicated databases and caches differ in what they promise during failures, and settings like synchronous replication change it. Read what yours guarantees, and test a failover before you rely on it.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
For each feature that writes data in more than one place or region, tell me what happens today if the regions can't reach each other: does it refuse, serve stale data, or accept conflicting writes? Propose consistent or available for each, with the cost of being wrong and how conflicts would be resolved afterwards.

Quick check

Sign in to earn +10 XP for it

During a network split between Harbor's two regions, which feature should refuse writes rather than accept them on both sides?

Got a prompt that touches consistency trade-offs?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.