Skip to content

High availability and multi-region

High availability (HA) means a system keeps working when parts of it fail. In the cloud, failures come at three scales: a single server, an availability zone (one or more data centers in a region), or a whole region. Each step up in protection costs more and adds complexity, so the architecture starts with a question: how much downtime and data loss can the business actually accept?

Two numbers answer that question:

  • RTO (recovery time objective): how long the service may be down.
  • RPO (recovery point objective): how much recent data may be lost.
Active-passive across two regions1. Global routing sends users to a healthy region, based on health checks. 2. Normally all traffic goes to Region A, which itself spans three availability zones. 3. Data replicates continuously to Region B. If Region A fails, the replica is promoted and routing switches over.Region A (primary)Region B (standby) Userseverywhere App tieracross 3 zones Global routingDNS, health checks App tierscaled down, ready Primary databasemulti-zone Replica databasepromotable123
Active-passive across two regions Users are routed to the healthy region; data is copied across continuously, so the standby is ready to take over.
  1. Global routing sends users to a healthy region, based on health checks.
  2. Normally all traffic goes to Region A, which itself spans three availability zones.
  3. Data replicates continuously to Region B. If Region A fails, the replica is promoted and routing switches over.
Design Survives Typical RTO Typical RPO Cost and complexity
Single zone A server failure, if you have spares Minutes to hours Since the last backup Lowest
Multi-zone in one region A data center failure Seconds to minutes Near zero (synchronous replication within the region) Modest: the right default for production
Backup and restore to another region A region failure, slowly Hours Since the last backup copied Low running cost
Pilot light / warm standby A region failure Minutes to an hour Seconds to minutes (asynchronous replication) Moderate
Active-active multi-region A region failure with little or no interruption Near zero Near zero to seconds, depending on data design Highest: data consistency is the hard part

The numbers are typical, not guarantees. Your RTO and RPO are targets agreed with the business; a rehearsal measures the recovery time and data loss you actually achieve, and shows whether you can meet them.

  • Multi-zone first. Spreading every tier across at least two, ideally three, zones handles the most common large failures at modest cost. Managed databases and load balancers do most of the work.
  • Stateless compute. App servers that hold no local state can be replaced or moved anywhere. State lives in databases, caches and object storage designed for replication.
  • Data decides everything. Copying compute to another region is easy. Copying data is where latency, consistency and cost trade off. Synchronous replication across regions adds latency to every write; asynchronous replication means some recent writes may be lost in a failover.
  • Health checks and automated failover, but with a human decision for full region failover in many organizations, to avoid flapping on a false alarm.
  • Static stability. The standby should work without needing to call the failed region, or the control plane, during recovery.
  • Rehearse. Run game days. Fail a zone or a region on purpose, measure the recovery time and data loss you actually achieve, and compare them with the RTO and RPO targets.
  • Business continuity through failures that do happen, at every scale.
  • Planned maintenance without downtime.
  • Active-active can also put users closer to their nearest region.
  • Cost: standby capacity, cross-region data transfer and duplicated services.
  • Complexity: failover logic, data conflicts and testing are hard to get right.
  • False confidence: an untested failover plan often fails when it’s needed.
  • Multi-zone: for every production workload.
  • Multi-region: for systems where a region outage costs more than the extra design, running and testing effort, such as payments, emergency services and core customer platforms. Also where regulation requires a geographically separate recovery site.

Don’t go active-active by default. Many systems are better served by a solid multi-zone design plus a tested backup-and-restore or warm-standby plan. Agree the RTO and RPO with the business first.

  • Replicating compute but not data, or forgetting secrets, DNS and configuration.
  • Dependencies on a single region hidden in a shared service, an identity provider or a third party.
  • Never testing failover, or testing it only in a smaller environment.
  • Writes accepted in both regions without a strategy for conflicts.

Glossary: CAP theorem, eventual consistency

Written and edited by Abhinav Taduka, enterprise software architect.