WHITEBOARD / BOARD: MULTI-REGION
Board: multi-region and the real cost of going global
The goal is to show users in three places hitting local Machines, writes replayed to one primary region, and the bill lines that grow every time you add a region.
This page is drawn from https://fly.io/docs/reference/regions/, https://fly.io/docs/blueprints/multi-region-fly-replay/, https://fly.io/docs/reference/load-balancing/ and https://fly.io/docs/about/pricing/.
Whiteboard outcome
When you are done, the board shows three regions each with a Machine, one marked primary with the writable database, read replicas elsewhere, a fly-replay arrow for writes, and a cost note beside each region.
Before you draw: three questions
- Where are the users?
- What share of requests are writes? Avoid read replicas if “more than 50% write requests” (https://fly.io/docs/blueprints/multi-region-fly-replay/).
- Can the app read slightly old data after a write?
Draw it in 6 steps
- Draw three dashed boxes:
ord(primary),gru,ams, each with a Machine. Say: Fly.io lists 17 regions today, and “Fly Volumes and Fly Machines are tied to the region they’re created in” (https://fly.io/docs/reference/regions/). - Draw users on the left with arrows to their nearest box. Say: Fly Proxy sends traffic to the “least loaded, closest Machine”, and routes across regions only when, in its words, “all Machines in the local region are unhealthy or at their
hard_limit” (https://fly.io/docs/reference/load-balancing/). - In
ord, draw a cylinder “primary DB”. In the others, “read replica”. Say: Each Machine reads its local replica, and “primary region is exposed in thePRIMARY_REGIONenvironment variable” (https://fly.io/docs/blueprints/multi-region-fly-replay/). - Draw a dotted arrow from
grutoordlabeledfly-replay: region=ordfor POST. Say: The app answers write requests with only that header and Fly Proxy “will replay the whole request” to the primary (https://fly.io/docs/blueprints/multi-region-fly-replay/). - Write “1MB limit” on the arrow. Requests larger than 1MB cannot be replayed (https://fly.io/docs/networking/dynamic-request-routing/). Under the replicas write “read your own write”: there “will be short periods of time when data is not consistent between replicas and the primary” (https://fly.io/docs/blueprints/multi-region-fly-replay/).
- At the bottom, write the rule: Reads go local, writes go home. Every region you add is another Machine, volume and transfer line. (https://fly.io/docs/blueprints/multi-region-fly-replay/, https://fly.io/docs/about/pricing/)
flowchart LR
U1[Users near gru] --> G
U2[Users near ams] --> A
subgraph G[gru]
MG[Machine] --- RG[(Read replica)]
end
subgraph A[ams]
MA[Machine] --- RA[(Read replica)]
end
subgraph O[ord primary]
MO[Machine] --- PO[(Primary DB)]
end
MG -.fly-replay writes.-> MO
MA -.fly-replay writes.-> MO
PO -.replication.-> RG
PO -.replication.-> RAWhat going global really costs
| Cost line | Fact | Source |
|---|---|---|
| Machines | The same shared-cpu-1x 1GB costs $6.70 in iad, $7.73 in fra and $8.50 in sin per month | https://fly.io/docs/about/pricing/ |
| Three-region example | One Machine per region, 50GB served each and 10GB cross-region traffic each, totals $27.20/month | https://fly.io/docs/about/pricing/ |
| Internet egress | $0.02/GB in North America and Europe, $0.04/GB in Asia Pacific, Oceania and South America, $0.12/GB in Africa and India | https://fly.io/docs/about/pricing/ |
| Cross-region private traffic | $0.006/GB in North America and Europe, $0.015/GB in Asia Pacific, Oceania and South America, $0.050/GB in Africa and India; billed in both directions | https://fly.io/docs/about/pricing/ |
- Derived. Compute for the three-region example is $6.70 + $7.73 + $8.50 = $22.93 against $6.70 for one Machine in
iad(inputs from https://fly.io/docs/about/pricing/).
What they will ask
| Question | Answer | Source |
|---|---|---|
| “Do I get a regional database from Fly.io?” | Managed Postgres runs in a subset of regions, so check the MPG column. Unmanaged Postgres is not supported by support. | https://fly.io/docs/reference/regions/, https://fly.io/docs/about/support/ |
| “Does a regional outage fail over?” | Spreading across regions is the documented defense; entire regions can fail. | https://fly.io/docs/blueprints/resilient-apps-multiple-machines/ |