StoicBuilder

HandbookXV the PantheonEventual consistency

XVthe Pantheon, Design the system

Eventual consistency

1 min readUpdated 28 November

In plain words

Eventual consistency means different parts of a system may show different values for a short time after a change, but they all agree once the updates have finished travelling, provided no newer change arrives.

Where you see it

A Harbor customer pays, and the checkout page says Paid. The invoice list, updated by a worker from a payment event, still says Unpaid for three seconds. That isn't a bug if the design expects it, but the screen should say Processing rather than contradict itself.

Timeline of one paymentdatabase
14:02:00.000 checkout saves the payment status = paid14:02:00.050 payment.succeeded event queued14:02:00.050 invoice list (read model) status = unpaid <- the window14:02:03.100 worker updates the invoice list status = paid
The window is three seconds here. Design what users see inside it, and alert if it grows to minutes.

What goes wrong

  1. Ignoring the window instead of designing for it

    Users who see Unpaid after paying will pay again or open a ticket. Show a pending state, or show the user's own change straight from the write, while the rest catches up.

  2. Using it where it can't be allowed

    A balance, a stock count or a name that must not be given out twice needs one source of truth with a transaction or a lock. Eventual is fine for feeds, search results and reports.

  3. Never measuring the lag

    Three seconds becomes three hours when a worker stalls, and nobody notices until customers do. Track the age of the oldest unprocessed event, and alert when it passes your limit.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
List every place in this app where one copy of data is updated after another, such as read models, caches, search indexes and replicas. For each, tell me the normal delay, what the user sees during it and whether that's acceptable; add a pending state where it isn't obvious, and a metric for the lag.

Quick check

Sign in to earn +10 XP for it

Which Harbor feature can safely be eventually consistent?

Got a prompt that touches eventual consistency?

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

Check your own prompt

Free, no sign-up.