What is a global load balancer (GSLB)?
A global load balancer — also called GSLB, global server load balancing — sends each request to the nearest healthy region or data centre behind one hostname. A regional load balancer (nginx, HAProxy, an AWS ALB) picks a server inside one site; the global one works a level above and picks the site. It is built in one of two ways: DNS steering, where an authoritative DNS server answers each query with a different region’s IP, or anycast, where one IP is announced from many edge locations and a proxy at each edge forwards to a region.
It exists for two reasons:
- Latency. From Warsaw a round trip takes ~20 ms to Frankfurt, ~100 ms to Virginia and ~300 ms to Sydney. A new HTTPS connection spends two round trips (TCP, then TLS 1.3) before the request is even sent — see what a TLS handshake costs — and every serial request adds another.
- Availability. When a whole region fails — power, a bad deploy, a provider outage — the global layer stops sending users there. Without it, “multi-region” is two copies of the app and a DNS record pointing at one of them.
Global vs regional load balancer
| Global load balancer | Regional load balancer | |
|---|---|---|
| Chooses | a region or data centre | a server (VM, pod) inside one region |
| Built from | DNS answers, or an anycast IP with edge proxies | an L4/L7 proxy on a regional IP |
| Decides by | region health, client location, latency, weights, capacity | round robin, least connections, hashing, per-server health |
| Failure it handles | a region or site going down | a server or zone going down |
| Examples | Route 53, Global Accelerator, Traffic Manager, Cloudflare Load Balancing | nginx, HAProxy, Envoy, AWS ALB / NLB |
They stack. The global layer picks the region, then that region’s load balancer picks the server:
How DNS-based global load balancing works
The oldest and still most common GSLB is an authoritative DNS server that answers differently depending on who asks. api.example.com has no fixed A record; on each query the GSLB looks at the health of every region and at where the query came from, and returns the address of one region’s load balancer.
- The client asks its recursive resolver (the ISP’s, or
1.1.1.1,8.8.8.8) forapi.example.com— the same walk as in the recursive DNS resolution simulator. - The resolver asks the GSLB, which is authoritative for that name.
- The GSLB sees the resolver’s IP — or, if the resolver sends it, the client’s subnet in the EDNS Client Subnet option (ECS, RFC 7871). It maps that to a location, drops unhealthy regions, applies the policy and answers with, say,
192.0.2.10(eu-west) and a short TTL. - The client connects straight to eu-west. The GSLB is not in the data path.
Strengths: it works for any protocol that resolves a name, it costs a DNS query rather than a proxied byte, and each region keeps its own IP addresses — so one GSLB can span several clouds and your own racks.
Weaknesses — all from caching, and from who the GSLB actually sees:
- Failover waits for the TTL, and then some. An answer with TTL 60 s can be served from resolver caches for 60 s after the region died. A resolver may be configured with a TTL floor (Unbound’s
cache-min-ttl), and clients cache on their own: connection pools keep a resolved address for as long as the connection lives, and a JVM running under a security manager caches lookups forever by default. Most users move within the TTL; a tail takes minutes. A lower TTL buys more queries, not instant failover. - The GSLB sees the resolver, not the user. A user in Warsaw on a public resolver whose nearest node is in Frankfurt looks like Frankfurt. ECS fixes that when the resolver sends it: a truncated prefix, at most /24 for IPv4 and /56 for IPv6 by the RFC’s recommendation. Google Public DNS sends ECS to name servers it has detected as supporting it; Cloudflare’s
1.1.1.1and Quad9’s9.9.9.9deliberately do not. - Granularity is one resolver’s whole population. A weighted split (“10% to the new region”) is applied per answer, and every client behind that resolver reuses the answer until the TTL ends. At low query rates the real split is lumpy.
How anycast global load balancing works
Anycast announces the same IP prefix over BGP from many locations at once. Each router keeps its best path to that prefix, so a packet to the address arrives at whichever site is nearest in BGP terms. There is one IP for the whole world and no per-region answer to cache.
Anycast alone only gets packets to the nearest edge. A pure anycast service — the DNS root servers, 1.1.1.1 — answers from that edge directly; RFC 4786 (BCP 126) describes how to operate one. A global load balancer adds a proxy at each edge: it terminates TCP (and, for an L7 product, TLS or QUIC), then forwards over the provider’s private backbone to a backend region chosen by health, capacity and latency.
What that buys:
- Failover without a cache. The edge chooses a backend for every new connection or request. Once the health checks mark a region down, traffic moves at once — the only delay is detection.
- Short handshakes. The TCP and TLS round trips run against an edge a few milliseconds away; only the request crosses the ocean, on a connection the edge already holds open.
- One static IP. Allow-lists, firewall rules and device firmware can pin it.
What it costs:
- BGP optimises for policy and path length, not latency. Routers prefer local policy (LOCAL_PREF) first and the shortest AS path second. “Nearest” is usually right and occasionally absurd: a peering decision can send a user to an edge on another continent. Providers tune it with prepending, communities and selective announcements.
- A route change can break a connection. If the best path flips mid-connection, the packets of an existing TCP flow land on an edge with no state for it. It is rare enough that TCP over anycast works in practice; long-lived connections (WebSockets, large uploads) feel it first.
- It needs an AS, address space and many PoPs — which is why most teams rent it from a cloud or CDN.
DNS-based vs anycast: the difference
| DNS steering | Anycast + edge proxy | |
|---|---|---|
| Addresses | one per region | one for the world |
| In the data path | no — it only answers DNS | yes — terminates the connection at the edge |
| Protocols | anything that resolves a name | what the proxy speaks: TCP/UDP (L4) or HTTP(S) (L7) |
| Failover time | detection + TTL + client caches | detection only |
| What it sees | the resolver’s IP, or an ECS prefix | the client’s real IP and every connection |
| Steering granularity | per resolver, per TTL | per connection or per request |
| Backends | any public IP: multi-cloud, on-prem | whatever the provider’s edge can reach |
| You pay for | DNS queries and health checks | hours, plus every GB through the edge |
Rule of thumb: put an anycast L7 proxy or CDN in front of HTTP, and use DNS steering for everything that is not HTTP — databases, MQTT, SMTP, game servers — and for anything that must span providers. The two also combine: a DNS-steered name can point at several anycast front ends.
Health checks and failover time
Both kinds depend on health checks, and the details decide how good the failover is:
- Probe from many places. A single checker reports its own network problems as your outage. Route 53 runs checkers in up to eight AWS regions and treats an endpoint as healthy while more than 18% of them say so.
- Probe something real. A TCP connect proves the load balancer is up. An HTTP
GET /healthzthat touches the database proves the region can serve. Too deep is also wrong: if every region’s check calls the same shared dependency, one failure marks every region dead at once. - Fail open. When every target looks unhealthy, the checks are more likely broken than the whole fleet, so the usual answer is “serve all of them”. Route 53 does this (“if no record is healthy, all records are healthy”), Azure Traffic Manager returns its degraded endpoints as if they were online, and Cloudflare sends traffic to a fallback pool whose health it ignores.
- Time to drain = detection + propagation. Detection is interval × failure threshold. Route 53 and Azure Traffic Manager both default to a 30 s interval and 3 failures (≈90 s), with a 10 s fast option (≈30 s). DNS steering then adds the TTL — Route 53 recommends 60 s or less on health-checked records — plus the client-side tail. An anycast edge adds nothing after detection: once an endpoint is marked unhealthy, Global Accelerator “instantly begins directing traffic” to another one.
| Setup | Detection | Propagation | Most users moved after |
|---|---|---|---|
| DNS, 30 s interval × 3, TTL 60 s | ~90 s | up to 60 s | ~2.5 min |
| DNS, 10 s interval × 3, TTL 60 s | ~30 s | up to 60 s | ~1.5 min |
| Anycast edge, 10 s interval × 3 | ~30 s | none | ~30 s |
Steering policies (routing policies)
Once the unhealthy targets are removed, a policy picks among the rest. The same six exist in every product under slightly different names:
| Policy | Picks | Typical use | Called |
|---|---|---|---|
| Failover / priority | the first healthy target in a fixed order | active-passive DR: primary region, standby region | Route 53 failover, Traffic Manager Priority, Cloudflare Off |
| Geolocation | by the client’s country or continent | data residency (EU users stay in the EU), licensing | Route 53 geolocation, Traffic Manager Geographic, Cloudflare Geo |
| Geoproximity | by distance, optionally biased per region | shift a share of load from a hot region to a neighbour | Route 53 geoproximity, Cloudflare Proximity |
| Latency-based | the region with the lowest measured RTT from that network | active-active with a global user base | Route 53 latency, Traffic Manager Performance, Cloudflare Dynamic |
| Weighted | by ratio, e.g. 90 / 10 | canary a new region, blue/green between stacks | Route 53 weighted, Traffic Manager Weighted, Cloudflare Random |
| Capacity / spillover | the nearest region until it is full, then the next | absorb a spike without overloading one site | Google Cloud WATERFALL_BY_REGION |
Latency-based is not “geographically closest”: the provider keeps measurements of round-trip time between client networks and each region, taken over time, and sends a user where packets actually travel fastest.
Global load balancer products
| Product | Mechanism | Notes |
|---|---|---|
| AWS Route 53 | DNS | routing policies: simple, failover, geolocation, geoproximity, latency, IP-based, multivalue answer, weighted; health checks attach per record |
| AWS Global Accelerator | anycast, L4 (TCP/UDP) | two static anycast IPv4 addresses (four when dual-stack); client TCP terminates at the nearest AWS edge and rides the AWS backbone to endpoint groups, each with a 0–100% traffic dial |
| Google Cloud global external Application Load Balancer | anycast, L7 proxy | one anycast IP for all regions (Premium Tier); Google Front Ends terminate TLS at the edge and send each request to the closest region with capacity, overflowing to the next-closest |
| Azure Traffic Manager | DNS | routing methods: Priority, Weighted, Performance, Geographic, MultiValue, Subnet |
| Azure Front Door | edge L7 proxy | TLS termination and split TCP at the edge. The classic tier is anycast; Standard / Premium pick the edge PoP during DNS resolution and reach it over a unicast IP — an edge proxy reached by DNS steering |
| Cloudflare Load Balancing | DNS-only, or anycast L7 proxy | the same pools and monitors either as DNS answers or proxied through Cloudflare’s anycast network |
| F5 BIG-IP DNS (GTM before v12), IBM NS1 Connect, Akamai GTM | DNS | the classic GSLB appliance and the managed multi-cloud DNS services |
What a global load balancer does not solve
Moving traffic between regions is the easy half. The hard half is everything with state:
- Data. If eu-west holds the primary database and Asian users fail over to it, nothing changes for the data. If ap-southeast held the primary, failover is a database promotion: writes not yet replicated are lost or must be reconciled. The data layer, not the load balancer, sets your real RPO.
- Sessions. A user moved to another region loses whatever lived only in the old region’s memory. Keep sessions in signed tokens or a replicated store.
- Capacity. A failed region’s load lands on the survivors. Three regions at 70% each cannot absorb a third of the traffic: the two survivors would need 105%. N+1 sizing — any two of three regions can carry everything, so each runs at no more than ~66% — is the usual answer.
- Thundering herd on recovery. When the region returns and all its users come back at once, cold caches and empty connection pools take the full load. Ramp it back with weights instead of a flip.
FAQ
Is a global load balancer the same as a CDN? No. A CDN caches content at the edge; a global load balancer routes requests to the region that will serve them. They are often the same anycast network sold as two features (Cloudflare, Google Cloud, Azure Front Door), and a CDN in front does not remove the need to pick an origin region.
Do I still need a regional load balancer? Yes. The global layer picks a region and stops there; spreading requests over servers, zone failover and connection draining inside the region are the regional load balancer’s job.
What TTL should a GSLB record have? 30–60 s. Route 53 recommends 60 s or less for records tied to a health check. Going lower mostly raises query volume: resolvers and clients that ignore the TTL still set the tail.
How fast is global failover? Detection (interval × threshold, typically 30–90 s) plus, for DNS steering, the TTL and client caches — about 1.5–2.5 minutes for most users with a 60 s TTL. With an anycast edge proxy it is the detection time alone.
TL;DR: A global load balancer chooses the region; a regional load balancer chooses the server. It is built either from DNS (answer each resolver with a different region’s IP — cheap, protocol-agnostic, but failover waits on cached TTLs and it sees the resolver, not the user) or from anycast (one IP announced by BGP from every edge, a proxy there forwards to a healthy region — no cache to wait for and short handshakes, but you need a provider’s network). Both depend on multi-vantage health checks and a policy: failover, geo, latency, weighted, spillover. It moves traffic, not data: replication, sessions and spare capacity decide whether a regional failover actually works.