Regions, availability zones and failover

A cloud provider offers servers in regions around the world. The region you choose sets how far your servers are from your users and how well your site survives a failure.

The cloud console's form for a new server asks for a region first: Singapore, Tokyo, Sydney, Oregon or Virginia. A student team building a project app for users in Metro Manila picks one. The console then asks for an availability zone, and the team presses Create.

Singapore, Tokyo, OregonRegions
One data center in a regionAvailability zone
A standby copy of the dataFailover
Think first. If light in fiber travels 200,000 km per second, what is the fastest possible round trip between Manila and Virginia, which is 27,400 km there and back?
The answer is 27,400 divided by 200,000, which is 0.137 seconds or about 137 ms. Students who answer 69 ms have counted one direction only. The slider in the next step shows the same figure.

Distance sets the latency your users feel. Move the slider or click a region on the map, then read the time to first byte.

your users primary region other regions you could pick failed
What the distance costs
More detail

How the figures are worked out

The minimum round trip is the round-trip distance divided by the speed of light in glass fiber. Real networks take about 1.5 times that, because packets pass through switches and rarely travel in a straight line.

Time to first byte here is five round trips plus the 40 ms your code takes to run. No code, purchase or optimization gets below the minimum. Only moving closer does.

Where you have seen this

In Round trips and latency, most of a page load was round trips, and more server capacity did not make a slow round trip shorter. A distant region produces the same effect.

Choose how much protection to buy, then press a failure button and see what survives. The options run from cheapest to most expensive.

Simulate a failure
Choose how much protection to buy
More detail

Load balancers and data center failures

A load balancer uses health checks to stop sending traffic to a failed machine, as in Load balancers and scaling. A data center failure takes every machine in it, so it needs one of the options in the failure step.

Two ways to copy data

Multi-AZ saves each write in both data centers before confirming it. This is called synchronous replication, and it works because the two data centers are milliseconds apart.

Multi-region copies each write to Tokyo after confirming it. This is called asynchronous replication, and the newest writes can be lost if the primary region fails.

Recovery time and recovery point

The recovery time objective (RTO) is how long until you are back. The recovery point objective (RPO) is how much data you accept losing. Choose both before an outage, because afterward they are chosen for you.

Every user of your project is in Metro Manila, so choose Singapore. Use multi-AZ, which means two data centers in one region, if the provider offers it by default. It costs little and protects against a data center failure. Skip multi-region, which doubles the cost and needs code to resolve conflicting writes.

You can now choose a region setup for a project.

More detail

Multi-region also accepts a window of lost data, all to survive an event that has never happened to your users. It makes sense when a region outage costs more than running two of everything. Know that number before you decide.