Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 3 of 6 · Concept · 20 min · revision 1

Multi-region designs, deployment stamps and their consistency cost

Decide when zones are enough and when a second region is worth it, compare write-global, write-local and write-partitioned designs with a seeded simulation of lost updates, and choose between deployment stamps and geodes, including what data residency rules out.

Contentsand lesson path

What you will learn

  • Design redundancy and failover (active-passive, active-active, multi-zone, multi-region, deployment stamps) and remove single points of failure, including DNS and control-plane dependencies.

01. Why it matters

Suppose a learning platform serves schools in Europe, North America and Asia from one cloud region. In one quarter, the largest customer asks what happens if the region goes down, teachers in Asia complain that every page waits on a round trip across an ocean, and a new contract says European student records must stay in Europe.

A second region looks like the answer to all three, but it is a bigger change than a second server: you must decide where writes go, what users see while copies disagree, and who pays for capacity that waits for a disaster. This lesson builds on the previous one and asks: which failures need a region, and which multi-region shape fits which requirement?

02. Start with zones, and know what they do not cover

Failures come in nested failure domains: the set of things one fault can take down together.

Failure domains, from small to large, and the usual defence
process     -> restart it; run several per host
host        -> several hosts behind a load balancer
zone        -> spread hosts and replicas over 2-3 zones of one region
region      -> a second region (this lesson) or a tested regional restore
everywhere  -> staged rollouts of code and config, independent cells
               (a bad global change or a shared control plane)

An availability zone is one or more separate data centres inside a region. In AWS's description, zones are far enough apart to avoid sharing power, cooling or local disasters, yet close enough for synchronous replication with single-digit millisecond latency. Spreading over zones handles the loss of one site cheaply, and the AWS disaster recovery whitepaper notes that a multi-zone design may already meet much of a workload's risk needs.

Treat that as the fair default: zones for availability, plus backups copied to another region for disasters. It fails in three cases: an event that takes out a whole region, latency for users far away, and rules about where data may live. Notice that the last row of the ladder is not fixed by more regions at all. A bad change pushed everywhere at once can break every region together, which is why cloud architecture pairs regions with staged deployments.

03. Multi-region: where do writes go?

Reads are easy: each region serves them from a local replica. Writes decide the design. The AWS whitepaper names three strategies for active/active regions:

  • Write global: every write goes to one primary region and replicates outward. There are no write conflicts, but users far from the primary pay a cross-region round trip on every write, and if the primary region fails, writes stop until another region is promoted. With asynchronous replication, the writes still in flight at that moment are lost.
  • Write local: each region accepts writes and replicates them to the others asynchronously. Writes are fast everywhere and the other regions keep taking writes when one fails, but two regions can change the same item before they hear about each other. Something must settle the conflict. DynamoDB global tables in their default mode, multi-Region eventual consistency (MREC), use last writer wins (LWW): the update with the latest timestamp is kept. Their optional strong mode (MRSC, exactly three Regions) replicates each write synchronously instead, at a higher write latency.
  • Write partitioned: each item, user or tenant has a home region that takes all its writes. There are no conflicts and most writes stay local, but a user away from home pays the round trip, and the home region's failure affects its partition until it is moved.

How much does LWW cost? The simulation below lets two regions add 1 to shared counters, each reading its local copy, and replicates each write after a fixed lag.

Python 3.12 · multiregion.py
"""Two regions both accept writes and replicate to each other after `lag` seconds.
Conflicts are settled by last writer wins (LWW). Each write adds 1 to a counter."""
import heapq
import random


def lost_updates(lag, writes=20_000, items=500, seconds=3600, seed=42):
    rng = random.Random(seed)
    state = [{}, {}]  # per region: item -> (value, timestamp)
    events = []  # (time, kind, region, item, payload); kind 0 = local write
    for _ in range(writes):
        t = rng.uniform(0, seconds)
        heapq.heappush(events, (t, 0, rng.randrange(2), rng.randrange(items), None))
    while events:
        t, kind, region, item, payload = heapq.heappop(events)
        local = state[region]
        if kind == 0:  # read the local copy, add 1, write locally, ship to the peer
            value = local.get(item, (0, -1.0))[0] + 1
            local[item] = (value, t)
            heapq.heappush(events, (t + lag, 1, 1 - region, item, (value, t)))
        elif payload[1] > local.get(item, (0, -1.0))[1]:  # replica: newer stamp wins
            local[item] = payload
    assert state[0] == state[1], "regions did not converge"
    return writes - sum(value for value, _ in state[0].values())


print("20,000 increments over 1 hour on 500 counters, split across 2 regions")
for lag_ms in (50, 200, 1000, 5000):
    lost = lost_updates(lag_ms / 1000)
    share = lost / 20_000
    print(f"replication lag {lag_ms:>5} ms: {lost:>4} increments lost ({share:.2%})")
Expected output (python3 multiregion.py)
20,000 increments over 1 hour on 500 counters, split across 2 regions
replication lag    50 ms:    3 increments lost (0.01%)
replication lag   200 ms:   18 increments lost (0.09%)
replication lag  1000 ms:  110 increments lost (0.55%)
replication lag  5000 ms:  566 increments lost (2.83%)

Nothing crashed and both regions agree at the end, yet 110 of 20,000 increments vanished at a 1-second lag: two regions wrote the same counter within the lag window, both from the same old value, and LWW kept one. If you change the lag from 1 second to 5, losses grow about fivefold, to 566, because the window in which two writes can collide grows with it. Real lag is not constant either: it can grow under load or network trouble, exactly when regions are most likely to disagree.

The fix depends on the data, not the database. LWW is acceptable when the latest value is the only one that matters, such as a display name. It is wrong for counters, balances and stock levels. Those need operations that merge (a counter that adds per-region totals), or writes routed to one home region for that item. Reads have a cost too: a user who writes in one region and is then routed to another may not see their own write. The Azure geode pattern handles this with a session token that the client sends back with later reads, so read-your-writes still holds when the request lands in another region. Multi-leader and leaderless quorums covers conflict handling, and distributed systems fundamentals the consistency models.

04. Deployment stamps and geodes

A deployment stamp, also called a scale unit or cell, is a complete copy of the application, data stores included, that serves a fixed subset of tenants. Azure's Architecture Center lists what stamps buy: a failure or bad deploy stays inside one stamp; you grow by adding stamps when one reaches its tested capacity; updates can roll out stamp by stamp; and a stamp can sit in the region a tenant's data must stay in.

The same page lists the costs. Every stamp is another full set of infrastructure, questions about all customers need data from every stamp, and moving a tenant between stamps needs custom migration logic. A routing layer must map tenants to stamps and be highly available, since every request passes through it. And stamps are not redundant across regions by themselves: if the region holding a stamp fails, its tenants lose access until the region recovers or they are moved, so critical tenants still need a disaster recovery plan, the topic of the next lesson.

A geode (geographical node) is the opposite choice: every region runs the full service and can serve any user. Azure's geode pattern routes each request to a healthy nearby region and backs all regions with one geo-replicated data store, such as Azure Cosmos DB with writes enabled in every region, so the application must tolerate replication lag and concurrent writes, with a chosen consistency level and conflict policy. Each surviving geode must be sized for the traffic redirected from a failed one, and failover, failback and the shared dependencies must be tested under load.

The two can combine: tenants live in stamps, while the routing layer in front of them is itself a geode, so any region can look up any tenant.

Data residency settles many of these choices. If a rule says some data must stay in one jurisdiction, then its replicas, backups, logs and traces must stay there too, and so must the disaster recovery copy, which means a second region inside the same area. The geode pattern page itself says it may not suit workloads that restrict data or users to particular deployments, and points to stamps with data-aware routing instead. Residency is a legal question as well as a technical one: confirm with the people who own the contract which data it covers, then design placement from that answer.

05. When multi-region is not worth it

A second region can roughly double what you run and operate. Each region must hold the load of a failed one, data moves between regions at a cost, and every release, alert and runbook now has a regional dimension. Stay in one region with several zones when most users and data are in one area, when the SLO can be met with zones (lesson 1 shows how to check), or when the team cannot rehearse a regional failover regularly. Write-local designs are also a poor fit when an invariant must hold globally, such as never selling the same seat twice: strong agreement across regions costs at least one cross-region round trip on every write for every user, while routing those writes to one home region charges the round trip only to users far from home.

06. Check your understanding

Practice check · 3 questions

Regions, stamps and geodes

Choose the design or predict the behaviour.

Q1. A SaaS for schools must keep each school's student records in the school's own legal region: the EU, the US or Asia-Pacific. Teachers sometimes travel and sign in from abroad. Which design fits best?
Q2. A social app serves reads from replicas in three regions and sends every write to a primary in region 1, with asynchronous replication. Region 1 goes down. Before anyone acts, what do users see?
Q3. A SaaS runs five deployment stamps in three regions. Stamp 3, the only stamp in region C, serves 400 tenants. Region C has a day-long outage. What happens to those 400 tenants?
Practice only: not graded, not saved, not evidence.

07. Apply it

For the checkout journey of the skill project, decide whether it needs a second region. If it does:

  1. Choose write global, write local or write partitioned for each kind of data (carts, orders, stock levels, payments) and justify each choice, including what happens to it while replication lags.
  2. Decide between stamps, geodes or a mix, and say what the routing layer depends on.
  3. Write down any residency rule that applies and where its data, backups and logs may be placed.
  4. Inject the loss of one region on paper: which users lose what, for how long, and how much data could be lost?

08. Review prompt

Without looking back: what does a multi-zone design protect against, and what does it not? Describe write global, write local and write partitioned, and the cost each one pays. Explain why last writer wins loses updates and why the loss grows with replication lag. Then contrast deployment stamps with geodes, and say which one a data-residency rule usually points to and why.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check