Video in progress

If you need active-active writes in two regions, how do you resolve conflicting changes to the same record?

First I separate out which data truly has to be written in two places: a lot can be tied to a "home region", which removes conflicts altogether. For the rest, last-write-wins, field-level merging or CRDTs, depending on the semantics of the data.

📖 Answer

The real price of active-active is conflicts. When the network partitions, two regions change the same row in different ways, and then someone loses.

The strongest method is preventing the conflict. Each user gets a home region; their writes happen only there, and other regions read or forward the request. Even if the user flies to another country, writes are a bit slower, but they're correct. For money and inventory I choose this almost every time.

Where you truly need to write on both sides:

Method When it fits Risk
Last-write-wins (timestamp) profile avatar, a setting clock skew; one change is silently lost
Field-level merge different fields of a profile still LWW within one field
CRDT (counter, set) like count, cart, tags doesn't exist for every type, deletion is tricky
Manual resolution in the app documents, important records UX and code complexity

Trusting the physical clock in LWW is dangerous: if NTP is off by 50 ms, the write that actually came later loses. A hybrid logical clock or a version vector is better: at least you detect a real conflict.

The cart is the classic example: with an OR-Set, items added in two regions both stay. But you may get a complaint like "a deleted item came back", so agree on this with the business up front.

Also, unique constraints (username, email) don't work in active-active: two regions hand out the same username at the same time. I move those to a single globally synchronous service or to the owning region.

And finally: don't pick active-active just to get "fast failover". In many cases active-passive with fast failover is enough, with much less complexity.