Pidoku

Multi-Region and Disaster Recovery

Module 23 Lesson 23.f 1h Difficulty 3/5

Prerequisites 23.b, 23.e


Before you start: words you need#

WordPlain meaning
Region / zoneA region is a cloud location in one geography (for example, Mumbai). A zone is one separate data centre inside it.
RTTRound-trip time: how long a packet takes to reach a server and come back. Set mostly by distance.
Active-activeEvery region serves traffic all the time. Active-passive: a standby region waits until the main one fails.
FailoverMoving traffic away from a failed region to healthy ones.
RTORecovery time objective: how long until service is restored after a disaster.
RPORecovery point objective: how much data you may lose, measured as time.
Data residencyA legal or contractual rule that data must stay inside a country or region.
EgressData leaving a cloud region, which the cloud charges for per gigabyte.

1. What is it?#

Running the service in more than one region, and having a written, tested plan for losing one of them. There are three distinct reasons to do it, and they lead to different designs:

1. LATENCY     distance costs time. Singapore to US-East is roughly 200+ ms of RTT before any
               inference happens: a quarter of an 800 ms TTFT budget spent on physics.
2. AVAILABILITY survive losing a zone or a whole region.
3. RESIDENCY   prompts and outputs must not leave a jurisdiction. Often the real driver,
               and not negotiable.

For LLM services the latency reason is stronger than usual: TTFT is the number users feel, and network RTT is a fixed tax on it, paid at least once per request.


2. Why does it matter?#

Because an LLM replica is not a cheap web server:

STATELESS WEB SERVICE             LLM SERVICE
replicas are small and cheap      a replica is many GPUs and 100+ GB of weights
starts in seconds                 starts in minutes
capacity is plentiful             GPUs are scarce and differ by region
state lives in a database         KV cache is per replica and short-lived
failover = a DNS change           failover = a DNS change + GPU capacity in the other
                                  region, which you must already be paying for

The cost of multi-region is duplicated GPU capacity, and GPUs are the expensive part. The decisions in this lesson are about how much of that duplication you really need.


3. Simple analogy#

A hospital network with three hospitals. Each must handle its own town’s patients. If one hospital floods, the other two take its patients, but they cannot each keep a third of their beds empty all year just in case. Instead they agree in advance: in an emergency, cancel routine operations (shed low-priority work), open the overflow wards (run hot), and send only the serious cases across town.


4. Tiny example#

Three regions with 45%, 30% and 25% of a 300 request/s global peak. Each node serves 14 request/s at the SLO; normal planned utilization is 70%.

no failover (each region sized for its own peak)       32 nodes   1.00×
full failover, keeping 70% utilization                 51 nodes   1.59×
full failover, running at 90% during the failure       40 nodes   1.25×
shed the free tier (30%) and run at 90% during failure 36 nodes   1.12×

Surviving the loss of any region costs 59% more if nothing may degrade, and 12% more if you accept a planned, documented degradation. Section 6 has the program.


5. Technical explanation#

Deployment patterns#

PATTERN                              COST       FAILOVER         LATENCY       WHEN
single region                        1.0×       none             poor far away small scale, one market
active-passive (warm standby)        1.5–2×     minutes to hours poor          DR required by compliance
active-active, full failover         1.5–2×     seconds          good          strict availability
active-active, degraded failover     1.1–1.3×   seconds, degraded good         the usual answer
active-active + overflow routing     varies     seconds          good          large fleets

Active-active with degraded failover is the pragmatic middle: every region serves its own traffic normally; when one fails, the others run hotter and shed low-priority traffic. Write that degradation down, with numbers, as part of the plan.

Two things make it cheaper still:

  • Peaks are in different time zones. A US evening peak is an Indian early morning. The program assumes every region peaks at once, which is the worst case; real failover headroom is often smaller.
  • Batch and free-tier traffic need not fail over at all. Shed it, or delay it.

Routing#

LATENCY-BASED DNS / ANYCAST
  ✓ simple, standard          ✗ DNS caching makes failover take minutes
                              ✗ knows nothing about GPU capacity

GLOBAL LOAD BALANCER (application layer)
  ✓ health- and capacity-aware, fast failover
  ✓ can overflow: "EU is at 90%, send 10% of new sessions to US"
  ✗ another component to run, and to make highly available

HYBRID (usual)
  latency-based DNS for the main route + application-layer overflow + fast health checks

Keep sessions in one region. A multi-turn conversation should stay where its prefix cache is (12.m, 21.h), and in the jurisdiction its data belongs to. Route by conversation ID within a region, and move sessions only on failover. Residency-bound traffic must never overflow abroad, even in a disaster; plan its failover inside the jurisdiction (another zone, or a second region in the same country).

What lives where#

IN EVERY REGION            model weights (regional object storage + node caches),
                           container images, configuration, a registry replica

REGIONAL, NEVER REPLICATED KV cache, in-flight requests, local caches

GLOBAL OR CAREFULLY SPLIT  quota and rate-limit state ← the hard one
                           billing records, API keys and auth, audit logs

Quota across regions. Three options:

1. split each tenant's quota by region       simple; a tenant in one region gets 1/N
2. a global store, eventually consistent     close to correct; adds a cross-region dependency
3. enforce locally, reconcile centrally      fast; over-use detected after the fact
   → usual answer: generous local budgets, central reconciliation every few seconds,
     corrections in the next window (23.j)

Never put a cross-region quota check in the request path: it adds an ocean’s RTT to every request.

Getting weights everywhere#

1. push each release once to every region's object storage (cross-region replication
   or an explicit pipeline), and verify checksums there
2. pre-load node-local caches (a DaemonSet, or the image) from the regional copy
3. shift traffic only after every region has the release (23.g)

Cross-region egress costs money: roughly $0.02 per GB between US regions on AWS in 2026, more on some routes. Nodes in one region pulling weights from another region’s bucket on every deploy pay it again for every node.

The DR plan#

Write it down, with numbers:

SCENARIO: loss of us-east (45% of traffic)

DETECTION
  synthetic generations failing for > 60 s, or error rate > 50% for > 30 s
  → automated: global load balancer removes the region

IMPACT (the "shed free tier" sizing from section 6: 14 / 12 / 10 nodes)
  free tier shed everywhere (≈30% of traffic)
  eu-west:  ~46% → ~72% of capacity → acceptable
  ap-south: ~54% → ~84% of capacity → queue wait rising, degraded

EXPECTED DEGRADATION
  p95 TTFT 780 ms → ~1,900 ms for moved users (extra RTT + hotter queues)
  premium tier: within SLO (reserved capacity)

RECOVERY
  RTO, degraded service:  ~2 minutes (health check + load balancer)
  RTO, normal service:    45–90 minutes, IF extra GPUs can be found in the surviving regions
  RPO:                    zero for serving (no durable state); in-flight requests are lost.
                          Billing, quota and audit records need their own RPO.

ACTIONS
  1. automated: region removed; degradation ladder engages (23.d)
  2. manual: request extra capacity in surviving regions; status page updated
  3. on recovery: return traffic in steps (10% at a time) so cold replicas
     do not face a stampede

Step 3 matters: sending 45% of traffic back at once to replicas that have just started, with empty prefix caches, causes a second incident.

Cutting the cost#

1. size regions by their own traffic, not equally
2. tier-aware failover: only premium traffic fails over; free and batch are shed
3. one shared overflow pool instead of N+1 in every region
4. spot or on-demand capacity for the overflow tier, bought during the event (if the cloud has it)
5. an external API as the DR target for open models: expensive per token, cheap as insurance (23.c)

Option 2 is the most under-used. Holding full failover capacity for free-tier traffic is rarely worth the money.


6. Under the hood#

The sizing in section 4, plus the cost of pulling weights across regions.

Go
// regions.go — how many nodes per region to survive losing any one region.
package main

import (
	"fmt"
	"math"
)

type region struct {
	name  string
	share float64 // fraction of global peak traffic that lands here
}

const (
	globalPeak = 300.0 // requests/s at the global peak
	nodeCap    = 14.0  // requests/s per node at the SLO
	normalUtil = 0.70  // planned utilization in normal operation
	shedShare  = 0.30  // free-tier share of traffic, shed during a regional failure
)

func nodesFor(rps, util float64) int { return int(math.Ceil(rps / (nodeCap * util))) }

func main() {
	regions := []region{{"us-east", 0.45}, {"eu-west", 0.30}, {"ap-south", 0.25}}

	// Size each region for the worst case: its own traffic plus its share of a lost region's.
	plan := func(failUtil, keep float64) (int, []int) {
		total, per := 0, make([]int, len(regions))
		for i, r := range regions {
			n := nodesFor(globalPeak*r.share, normalUtil)
			for j, lost := range regions {
				if i == j {
					continue
				}
				// the lost region's (kept) traffic is spread over survivors by their share
				others := 1 - lost.share
				load := globalPeak*r.share + globalPeak*lost.share*keep*(r.share/others)
				if m := nodesFor(load, failUtil); m > n {
					n = m
				}
			}
			per[i] = n
			total += n
		}
		return total, per
	}

	base := 0
	for _, r := range regions {
		base += nodesFor(globalPeak*r.share, normalUtil)
	}
	fmt.Printf("%-44s %4d nodes  1.00x\n", "no failover (each region for its own peak)", base)
	for _, c := range []struct {
		name           string
		failUtil, keep float64
	}{
		{"full failover at normal utilization", normalUtil, 1},
		{"full failover, run hot (90%) during failure", 0.90, 1},
		{"shed free tier, run hot (90%) during failure", 0.90, 1 - shedShare},
	} {
		t, per := plan(c.failUtil, c.keep)
		fmt.Printf("%-44s %4d nodes  %.2fx  %v\n", c.name, t, float64(t)/float64(base), per)
	}

	// Weight distribution: pulling weights across regions on every deploy.
	const weightsGB, nodesPerRegion, perGB = 140.0, 30.0, 0.02
	perDeploy := weightsGB * nodesPerRegion * perGB
	fmt.Printf("\ncross-region pull per node: $%.0f per region per deploy; "+
		"replicate once instead: $%.2f\n", perDeploy, weightsGB*perGB)
}

Output:

no failover (each region for its own peak)     32 nodes  1.00x
full failover at normal utilization            51 nodes  1.59x  [20 17 14]
full failover, run hot (90%) during failure    40 nodes  1.25x  [16 13 11]
shed free tier, run hot (90%) during failure   36 nodes  1.12x  [14 12 10]

cross-region pull per node: $84 per region per deploy; replicate once instead: $2.80

Each region is sized for the worst single loss: for eu-west and ap-south that is losing us-east. The weight-pull line looks small, but multiply it by models, regions, and deploys per week, and it is pure waste.


7. Performance implications#

  • RTT goes straight into TTFT. A user 200 ms away pays it at least once per request, more if the connection is new (TLS). Nothing in the engine can win it back.
  • Failover moves users further away. Their TTFT rises by the extra RTT on top of hotter queues.
  • Moved sessions start cold. Their prefix caches are in the lost region, so prefill costs rise just when capacity is short.

8. Production implications#

  • Decide the driver first: latency, availability or residency. They imply different designs.
  • Size for degraded operation, not full failover, unless you can afford ~1.6×.
  • Document the expected degradation with numbers.
  • Keep sessions and residency-bound data regional.
  • Enforce quota locally, reconcile centrally.
  • Distribute weights regionally; never pull across regions per node.
  • Test failover at least twice a year. A plan never executed is a document, not a capability.
  • Ramp traffic back gradually after recovery.

9. Common mistakes#

  1. Building for availability when the real need is latency, or the reverse.
  2. Sizing every region for all the traffic: 3× cost for three regions.
  3. Cross-region weight pulls: large egress bills.
  4. Global quota checks in the request path: an ocean’s latency on every request.
  5. Sessions hopping between regions: cold caches, inconsistent behaviour, residency breaches.
  6. Returning all traffic at once after recovery: a cold-start stampede.
  7. Failing residency-bound traffic over abroad.
  8. Never testing failover, and never writing down the expected degradation.

10. Hands-on exercise#

  1. Run regions.go. Change the shares to 60/25/15. Which region now drives the cost, and why?
  2. Add a fourth region with 10% of traffic. Does the failover premium go up or down?
  3. For your user base, estimate p50 and p95 RTT to one region versus the nearest of three. What share of your TTFT budget does it save?
  4. Write the DR plan of section 5 for a service you know, with real numbers.
  5. In a test environment, block one region’s health checks and measure detection time, traffic shift time and the degradation users saw. Compare with your plan’s RTO.

11. Interview questions#

  1. What are the three reasons for multi-region, and how do they change the design?
  2. Why is multi-region more expensive for LLM services than for web services?
  3. How would you size three regions to survive losing one without doubling cost?
  4. How do you enforce rate limits across regions?
  5. Why should sessions stay in one region?
  6. What are RTO and RPO for an inference service, and why is RPO unusual here?
  7. Why ramp traffic back gradually after a region recovers?

12. Further reading#

Checked on 12 November 2026.

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in