Patterns

Multi-region with GeoDNS

Open a second region, route each region's Users to it with GeoDNS, and keep reads local, so far Users stop paying the ocean twice on every request.

Run a copy of the stack near each large group of Users, and let GeoDNS send them there.

Move up when#

  • Users on another continent are slow and the load bars look healthy, so the delay is distance.

  • Why users leave lists far regions at the top.

  • A far Users' request pays the round trip twice, once to open the connection and once to ask.

The Design#

Before, all Users enter the home region.

Drag to pan. Hold Ctrl or Cmd and scroll to zoom.

At 3.00k Users the Simulation solves this Design to Apdex 0.91, p99 370 ms, 0.0% errors and $16/s Burn.
WhereSettingValueWhy
App ServerInstance sizelargeLarge, so distance and not capacity is what the far users feel.
DatabaseInstance sizelargeMatch the App Server.

After, European Users enter their own Users Node.

Drag to pan. Hold Ctrl or Cmd and scroll to zoom.

At 3.00k Users the Simulation solves this Design to Apdex 0.98, p99 334 ms, 0.4% errors and $32/s Burn.
WhereSettingValueWhy
App ServerInstance sizelargeLarge, as in the one-region Design.
DatabaseInstance sizelargeThe primary stays at home and takes every write.
UsersRegioneuA Users Node in Europe gives GeoDNS somewhere nearby to send European Users.
App ServerRegioneuThe App Server runs beside its Users, so their calls skip the ocean.
App ServerInstance sizelargeMatch the home App Server.
Read ReplicaRegioneuReads stay in Europe. A replica copies the primary, so some reads come back a little stale.
Read ReplicaInstance sizelargeMatch the primary, since it replays every write.

Research this Design needs: Read replicas, Multiple zones, Multiple regions, GeoDNS.

The picture shows the home tab. Nodes in Europe carry an EU tag and the round trip to reach them, and a link across regions shows its cost under the belt. The European App Server reads from a local replica and writes to the home primary.

Why it works#

With GeoDNS each region's Users enter their own Users Node, or the nearest one that is up. Their App Server sits beside them, so calls skip the ocean. A replica answers reads at home. Regions with no Node of their own, such as Asia-Pacific here, still reach the nearest one and pay its trip, which that region's own Apdex shows.

What it costs#

Writes still cross to the primary, and some replica reads come back stale. Calls between regions bill egress, so keep each region's App Server calling its own data. Each open region costs Cash to open and adds the Burn of every Node you copy into it. The Mirror copies a region for you and then drifts, and a Region outage takes down every Node in it that is not global.

In Quorum#

Set a Node's Region and place a Users Node there. Research Multiple zones, Multiple regions, GeoDNS and Infrastructure as code. Follow Go global and read GeoDNS. The next rung, compute at the edge, moves small handlers next to the user.