Insights

Active-Active or Active-Passive Across Regions? Start With How Your Data Replicates

November 22, 2026
0:00
Many multi-region plans start with a diagram that has two regions, a global load balancer, and arrows going both ways. Someone asks whether it should be active-active or active-passive, and the team picks one based on cost or on how resilient it sounds. The database usually gets discussed last, even though it is the part that decides whether the plan survives a regional outage. Most stateless app tiers can run in any number of regions. The real question is what happens to a write while two copies of your data disagree. This article follows a single write through the replication pipeline and looks at where it can be lost or duplicated. Once that path is clear, the topology choice mostly makes itself.
Asynchronous replication is the default in most relational setups, including streaming replication in PostgreSQL and standard binlog replication in MySQL. A single write goes through these steps:
  1. The client sends UPDATE and COMMIT to the primary in region A.
  2. The primary writes the change to its local log (the WAL in PostgreSQL, the binary log in MySQL) and flushes it to disk.
  3. The primary tells the client the commit succeeded.
  4. Some time later, the log record is shipped over the network to the replica in region B.
  5. The replica writes the record to its own log and applies it to its data.
The client got its success message at step 3. Steps 4 and 5 happen afterwards, and the time between them is your replication lag. Inside one data center the lag is often small enough to ignore. Across regions, every record also has to cross a long network path, and lag can grow when the link is congested or when the replica falls behind applying a burst of writes. Now suppose region A goes dark between steps 3 and 4. The client was told the transaction committed. Region B never received it. If you promote region B, that transaction does not exist anywhere you can reach. This window is your real recovery point objective (RPO), meaning how much recent data you can lose. Under async replication the RPO is never zero, whatever the architecture document says. It equals whatever lag existed at the moment of failure. None of this makes async replication wrong. It means an active-passive design on async replication is a decision to accept losing the last few seconds of writes in exchange for fast local commits. That trade is often fine, but make it on purpose.
Synchronous replication moves the success message to after step 5, or at least after the replica confirms it has durably stored the record. In PostgreSQL this is controlled by synchronous_standby_names and synchronous_commit. MySQL offers semi-synchronous replication through a plugin, where the source waits until at least one replica acknowledges receipt of the transaction. The gain is clear. When the primary reports a commit, a second region already has it, so losing region A does not lose acknowledged writes. The cost is that every commit now includes a cross-region round trip. If the regions are far apart, that round trip is added to every write transaction, and applications that commit many small transactions feel it the most. The bigger problem is what happens when region B becomes unreachable. The primary has to choose between two bad options:
  • Keep waiting. Commits hang until the standby returns. You keep consistency and lose availability, so an outage in region B stops writes in region A. PostgreSQL behaves this way if the configured synchronous standby cannot be reached.
  • Give up and continue asynchronously. MySQL semi-sync does this after its timeout expires. Writes keep flowing, but you are quietly back to async, with the same data-loss window as before, often without anyone noticing.
If your plan assumes zero data loss, find out which of these two behaviors your setup actually has and whether anything alerts when the fallback happens. A common fix for the hanging problem is to require acknowledgment from any one of several standbys, with at least one in a different region. That removes the single point of stall but adds more replicas to run.
Active-passive has one writer. The passive region receives changes and serves no production writes until failover. Replication flows in one direction, so the only open questions are lag and promotion. Active-active means both regions accept writes. With async replication between them, this is the sequence:
  1. A user in region A sets an order's status to shipped. Region A commits locally.
  2. At about the same time, a support agent routed to region B sets the same order to cancelled. Region B commits locally.
  3. Each region ships its change to the other.
  4. Each region now receives a change that contradicts what it already holds.
Neither database did anything wrong. Both writes were valid locally. The conflict only appears when replication tries to merge them. You need a rule for that, and the common rules all lose something:
  • Last write wins keeps the change with the later timestamp. It depends on clocks agreeing across regions, and it silently throws away the other update.
  • Application-level merging works for data that can be merged, such as counters or sets. It does not help for an order that cannot be both shipped and cancelled.
  • Rejecting and flagging keeps both versions for later repair. This is safe, but someone has to do the repair.
There are also simpler collisions. Two regions generating auto-increment IDs will hand out the same primary key. In MySQL, auto_increment_increment and auto_increment_offset give each writer its own interleaved range, and UUIDs avoid the issue entirely. Both fix key collisions. Neither fixes two regions updating the same row. Teams that run active-active writes successfully usually avoid conflicts by design instead of resolving them afterwards. One approach is to give each record a home region: a user's data is written only in the region that owns it, and other regions forward writes there or only serve reads. The other is to use a database built on a consensus protocol, where a write commits only after a majority of replicas agree. Consensus removes conflicts but puts a cross-region round trip in the write path again, and it needs an odd number of voting locations. With only two regions, losing either one loses the majority, so a third region or a lightweight voter becomes required.
In active-passive, failover is a sequence of states, and split-brain comes from skipping one of them:
  1. Detect. Something decides region A's primary is gone. A health check failing from one location does not prove the primary is dead. It may only mean the network path between the checker and the primary is broken.
  2. Fence. Make sure the old primary cannot accept writes, even if it is still running. Common methods are cutting its network access, revoking the application's credentials, or forcing it read-only.
  3. Choose. Pick the replica with the most recent data. If you have more than one standby, compare their replay positions rather than picking one at random.
  4. Promote. Make that replica writable.
  5. Redirect. Point the application at the new primary, through DNS, a load balancer, or connection configuration.
Split-brain happens when step 2 is skipped or fails. A network partition separates the regions, region B gets promoted, and region A's primary is still alive and serving any clients that can reach it. You now have two primaries accepting writes, which is accidental active-active with no conflict handling. When the partition heals, the histories have diverged, and the old primary cannot simply rejoin as a replica because it holds writes the new primary never saw. This is why automatic failover across regions usually includes a witness or quorum component in a third location. The witness confirms that region A is unreachable from more than one viewpoint before promotion is allowed. The redirect step also needs testing on its own. Failover that works at the database layer but still sends traffic to the dead region through cached DNS has not finished. The checklist in testing DNS failover after moving to multi-DC covers that layer.
Before you discuss topology, look at the replication you already have. These queries are read-only. Run them on the primary for PostgreSQL and on the replica for MySQL.
BASH
# PostgreSQL (on the primary): replica state, sync mode, and lag
psql -c 'SELECT application_name, client_addr, state, sync_state, write_lag, flush_lag, replay_lag FROM pg_stat_replication;'

# MySQL 8.0.22+ (on the replica); use SHOW SLAVE STATUS on older versions
mysql -e 'SHOW REPLICA STATUS\G' | grep -E 'Replica_IO_Running|Replica_SQL_Running|Seconds_Behind_Source'
In PostgreSQL, sync_state shows async, sync, potential, or quorum for each standby, so you can see right away whether the zero-data-loss assumption holds. In MySQL, Seconds_Behind_Source is a rough estimate based on event timestamps. It can read zero while the replica is not receiving anything at all, so always check both running threads alongside it. Watch these values during your busiest write period, not only at quiet times. The lag at peak load is the data you would lose if the primary region failed at that moment. On managed database services, the equivalent information usually appears as replica lag metrics in the provider's console or API. Promotion behavior and fencing differ between providers, so read how your provider handles a cross-region promotion before you rely on it.
Start with two plain questions. How many seconds of acknowledged writes can you afford to lose? Can two regions ever change the same record at the same time? If some loss is acceptable and you have one writer, active-passive on async replication is the simplest setup that works. Spend your effort on fencing and a rehearsed promotion runbook. If you need zero loss, add synchronous replication to a nearby standby and measure the commit latency before committing to it. Choose active-active writes only once you know how each record avoids or resolves conflicts, and once you have a third vote for quorum. When support engineers get an escalation about orders that disappeared after a regional failover, the cause is often replication lag that nobody measured, so measure it first.

Join My Newsletter & Get Updates!

Get notified whenever a new technical guide, server infrastructure breakdown, or personal reflection goes live, plus a curated weekly digest.