Q12 · What patterns help maintain consistency across multiple services?

Back to 24 Architecture Questions.

The question is not “keep data in sync”. The axis it turns on: which service owns the fact, and how a reader learns it changed. Two services holding “the same” data are not a sync problem; they are an ownership question: which service is allowed to change it. Consistency across services is what you get after ownership is settled: one owner, and copies that are projections of the owner’s facts.

One owner, many projections Orders owns the fact and appends to an event log. Search and analytics build their own copies by applying those events, and each copy is only as fresh as the events it has applied. FIGURE 12 ONE OWNER, MANY PROJECTIONS Orders owns the fact Event Log append-only Search Copy stale until applied Analytics Copy stale until applied one owner per fact; every copy is a projection, lagging by exactly the events it has applied

What the answer should contain

Assign every fact exactly one owner. The owner is chosen by domain ownership, not by which team has the table today. Everything else holding that data is a projection: a copy that is consistent only by a stated policy, never by hope.

Propagate by events, atomically with the commit. The owner appends the fact to a log as part of committing it (the outbox pattern: the business row and the event land in one local transaction). Consumers build and update their copies from the log, which is why the transport has to be a log and not a queue: a late consumer needs to re-read from its own position.

Know each copy’s freshness as a number. “Eventually consistent” is not a design; it is an apology. A copy carries its last-applied event timestamp, and readers can see how far behind it is. Staleness becomes a measured property with an alarm, not a surprise.

When a reader must be current, ask the owner. A targeted synchronous read of the one fact, from the owner, for the one use case that needs it (the payment-status check). This is a scalpel: syncing everything back to the owner recreates the monolith with extra network hops.

Two writers on one fact is a boundary bug. If two services can mutate the same fact, the service boundaries are wrong, the lost-update races are back, and no pattern will save the design until ownership is reassigned.

Invariants spanning services become sagas. “Order charged implies stock decremented” cannot be a distributed transaction in most realistic stacks; it becomes a saga of local steps with declared compensations, or the invariant moves inside one owner’s service, where a plain transaction can hold it.

Ideas worth mentioning out loud

Follow-ups to expect

Red flags in an answer

Sources