All lessons · Guided routes

Simulator · Cloud architecture

Zones, regions, and failover

Quillfern's booking site runs in one cloud region. Choose how many availability zones it uses, how the database is protected, and what fails.

At Quillfern Parcels. This is the system from chapter 7 of the Quillfern story, "Moving to the cloud": The office data room has one power feed. A cooling failure takes everything down for six hours on a Monday.

What the model simplifies

Illustrative figures: an instance is up 99.5% of the time, a zone 99.95%, a region 99.99%, the load balancer 99.99%; failures are independent and the surviving instances have enough capacity. Instance failures happen in zone A, as does a zone failure; the database primary is in zone A. Prices are made-up round numbers for comparison only, not any provider's. Every number on this page comes from one shared set of calculations, which the simulation questions use too, so a question can never disagree with what the simulator shows.

The drills, written out

Zone A goes down with the only database
  1. Healthy state. Two zones, two app instances in each, one database in zone A. Modelled availability is 99.430%.
  2. Trigger. A cooling failure takes zone A offline.
  3. What is affected. Zone B's app instances are healthy, but every booking needs the database, which was in zone A.
  4. Symptoms. The booking site returns errors for every page that reads or writes data. The load balancer's health checks still pass in zone B, because the app is up.
  5. Metrics. Error rate near 100%; database connection timeouts on every instance; recovery time: until the failed part comes back.
  6. Logs. The app logs show the database is unreachable.
    ERROR could not connect to server: Connection timed out
            Is the server running on host "orders-db" and accepting TCP/IP connections on port 5432?
  7. Reasoning. Two zones protect only what is in both. The single database was a single point of failure, so the second zone bought nothing in a zone outage.
  8. Mitigation. Run a synchronous standby in zone B with automatic failover. Now the same zone failure promotes the standby; recovery takes about 1–2 minutes of database failover.
  9. Recovery. Zone B serves all bookings with no data lost (RPO 0: the standby is synchronous). Cost rises to USD 685 a month from USD 495, which is the price of that protection.
  10. Prevention. List every dependency of a request and check it is in more than one zone; test it with a zone failure game day; make health checks include the database.
A whole region is lost
  1. Healthy state. Three zones and a synchronous standby: no single zone failure stops bookings. Modelled availability 99.977%.
  2. Trigger. A faulty change to the provider's regional network takes the whole region down for hours.
  3. What is affected. Everything: all zones of the region share the failure.
  4. Symptoms. The site does not answer at all; DNS still points at the region.
  5. Metrics. Every health check fails; time to recover: until the failed part comes back.
  6. Logs. Monitoring from outside the region shows connection timeouts; monitoring inside it is down too.
    curl: (28) Connection timed out after 10001 milliseconds
  7. Reasoning. Zones protect against a building or power failure, not against a failure of the region itself. Only a copy in another region helps here.
  8. Mitigation. Keep an asynchronous replica in a second region with a small app tier. On a region failure, promote the replica and point DNS at the second region; that takes minutes to an hour.
  9. Recovery. Bookings resume from the second region; scans written in the last seconds before the failure may be missing (RPO seconds: the regional replica lags a little).
  10. Prevention. Write down the RTO and RPO the business needs, rehearse the regional failover, and keep DNS time-to-live short enough for that RTO.

Learn it properly

All simulators · Curriculum map