Global Server Load Balancing is the control plane that determines which CDN point of presence serves every user request. Unlike local load balancing that distributes connections within a single facility, GSLB operates at Internet scale, steering traffic across continents based on proximity, health, capacity, and cost. For a CDN handling tens of millions of requests per second, the GSLB architecture directly dictates time-to-first-byte, cache hit ratio, availability during outages, and even transit spend.
Two foundational models dominate CDN design: DNS-based GSLB and Anycast-based GSLB. While both achieve the same goal of directing users to the optimal edge, their mechanisms, failure modes, and operational trade-offs differ profoundly. Understanding these differences is essential for anyone architecting or evaluating a modern CDN architecture and selecting the right steering strategy for latency-sensitive workloads.
What GSLB Actually Solves
At its core, GSLB answers a deceptively simple question: given a user at IP 203.0.113.45 requesting cdn.example.com, which of 200+ global PoPs should handle it? The answer must balance multiple competing constraints in milliseconds.
First, proximity and latency. The speed of light still matters; routing a user in Berlin to a PoP in Ashburn instead of Frankfurt adds 80-100ms of round-trip time. Second, health and capacity. A PoP undergoing maintenance, experiencing packet loss, or saturated at 95% CPU should be avoided even if it is geographically closest. Third, cost and compliance. Transit pricing varies by region, and data sovereignty rules may require EU users to stay within EU PoPs. Finally, cache efficiency: steering similar users to the same PoP improves cache hit ratios and origin offload.
A robust GSLB system continuously ingests telemetry — active health checks, passive latency measurements, BGP path data, and server load metrics — and converts it into routing decisions. How those decisions are enforced is where DNS and Anycast diverge. Your choice also influences how effectively you can apply load balancing algorithms at the global layer.
DNS-Based GSLB: Authoritative Control at the Application Layer
DNS-based GSLB is the traditional and still most widely deployed model. The CDN operates authoritative nameservers that provide custom answers for each DNS query based on real-time policy.
| Metric | Edge Processing | Origin Processing | Improvement |
|---|---|---|---|
| Latency (p50) | 8–15 ms | 120–300 ms | 15–20x faster |
| Cache Hit Ratio | 85–95% | N/A | Reduces origin load |
| TLS Handshake | 1–5 ms (nearby PoP) | 50–150 ms | 10–30x faster |
| Bandwidth Cost | $0.01–0.04/GB | $0.05–0.12/GB | 3–5x cheaper |
| Availability | 99.99% (multi-PoP) | 99.9% (single DC) | 10x fewer outages |
When a client resolver queries cdn.example.com, the authoritative DNS server inspects the resolver's IP (using EDNS Client Subnet where available), maps it to a geographic and network location via a GeoIP and network cost database, checks the health and load of candidate PoPs, and returns one or more A/AAAA records pointing to the best PoP's unicast IP addresses. A short TTL, typically 20 to 60 seconds, ensures clients can be re-steered quickly.
The strength of this model is granularity. Policies can be arbitrarily complex: weighted round-robin for capacity distribution, geofencing for regulatory compliance, latency-based routing using synthetic measurements, or active-passive failover for origin protection. Integration with Real User Monitoring (RUM) allows dynamic adjustment based on observed performance per ASN. For teams focused on cost optimization, DNS steering can also prefer cheaper transit or owned backbone PoPs when performance is equivalent.
cdn.example.com. 30 IN A 198.51.100.10 ; us-east-1 - weight 100, health OK
cdn.example.com. 30 IN A 203.0.113.20 ; eu-central-1 - latency 18ms for 81.0.0.0/8
cdn.example.com. 30 IN A 192.0.2.30 ; ap-southeast-1 - fallback if eu-central fails
# Authoritative logic pseudocode
if edns_subnet.country == "DE" and health["fra"] == "healthy":
return fra_unicast_ips, ttl=30
elif load["fra"] > 0.85:
return ams_unicast_ips # shed load to Amsterdam
However, DNS-based GSLB has a fundamental weakness: it does not control the path, only the destination. Once a resolver caches the response, the CDN cannot revoke it until the TTL expires. In practice, many ISP resolvers ignore low TTLs and clamp them to 60-300 seconds, and client-side caching in browsers and operating systems adds further delay. During a PoP failure, up to 30% of traffic may continue hitting the failed site for minutes, causing errors and retry storms.
DNS also depends on resolver location accuracy. If a user in Warsaw uses a public resolver in London, EDNS Client Subnet may be absent or truncated to /24, causing the GSLB to mislocate the user and return a UK PoP instead of the closer Warsaw PoP. Studies show resolver-to-client distance adds 10-40ms of misdirection in 15-20% of queries without ECS.
Anycast GSLB: Network-Layer Steering via BGP
Anycast takes the opposite approach. Instead of giving different answers to different users, the CDN advertises the exact same IP prefix — often a /24 for IPv4 or /48 for IPv6 — from every PoP via BGP. The Internet's routing fabric then does the load balancing.
Each PoP's edge routers announce the anycast prefix to upstream transit providers and peers. BGP's path selection algorithm ensures each client packet is delivered to the topologically nearest PoP in terms of AS path length and local preference. No DNS logic is required for proximity; the network itself finds the shortest path. A user in Tokyo naturally reaches the Tokyo PoP, while a user in São Paulo reaches the São Paulo PoP, using the same destination IP.
The performance advantage is immediate. Connection setup avoids an extra DNS indirection hop, and failover is handled by BGP withdrawal. If a PoP fails, its announcement is withdrawn and packets automatically converge to the next-best path, often within 2-10 seconds for well-peered networks, compared to 30-120 seconds for DNS TTL expiry. Anycast also provides inherent DDoS resilience: attack traffic is geographically dispersed across all PoPs rather than concentrated on a single unicast IP.
protocol bgp upstream {
local as 64500;
neighbor 203.0.113.1 as 1299; # Telia
export where proto = "static";
}
protocol static {
route 192.0.2.0/24 via "lo0"; # Anycast service IP, advertised everywhere
}
# Health check withdraws route if local service fails
if !check_http("127.0.0.1:80/health") then withdraw 192.0.2.0/24;
Yet Anycast's simplicity is also its limitation. BGP is unaware of application state. It routes based on network topology, not server load, latency under load, or cache contents. A PoP with a short AS path but 98% CPU utilization will still receive traffic until BGP is manually de-preferenced via AS path prepending or community strings, which are coarse and slow to propagate. Anycast also complicates troubleshooting: the same IP exists everywhere, so traceroutes and logs require PoP-identifying headers or TCP anycast tricks.
Statefulness is another challenge. Long-lived TCP connections, especially with HTTP/2, HTTP/3 and QUIC, can break if a BGP flap mid-connection reroutes packets to a different PoP that has no connection state. Modern Anycast CDNs mitigate this with consistent hashing at the edge, TCP anycast proxies, or by using Anycast only for the initial handshake before redirecting to unicast.
Head-to-Head
Neither model is universally superior. The right choice depends on your traffic profile, operational maturity, and performance targets. For static asset delivery with high cacheability, Anycast's speed and resilience often win. For dynamic, personalized, or regulated workloads requiring precise control, DNS remains indispensable.
| Dimension | DNS-Based GSLB | Anycast GSLB |
|---|---|---|
| Routing Layer | Application (DNS) | Network (BGP) |
| Failover Time | TTL-dependent, 30–180s typical | BGP convergence, 2–15s |
| Granularity | Per-query, per-ASN, per-country | Per-prefix, coarse via prepending |
| Proximity Accuracy | High with ECS, 85–90% | High for network distance, not latency |
| DDoS Handling | Single PoP absorbs attack | Attack distributed globally |
| Operational Complexity | DNS ops, GeoIP DB, TTL tuning | BGP ops, peering, route management |
| Cost | Lower network cost, higher DNS QPS | Requires extensive peering/transit |
Hybrid Architectures: The Modern Standard
Leading CDN providers — Cloudflare, Fastly, Akamai, and AWS CloudFront — no longer treat DNS and Anycast as mutually exclusive. The hybrid model layers both techniques to capture their complementary strengths.
A common pattern is Anycast for ingress plus DNS for steering. The CDN advertises an anycast prefix for its edge, ensuring every user has a nearby entry point with minimal latency and automatic DDoS scrubbing. Once the packet arrives at the anycast PoP, an L7 proxy or secondary DNS decision can redirect to a more optimal unicast PoP if needed. For example, a user whose BGP path lands in London but whose content is hot-cached in Frankfurt can be internally rerouted or given a unicast DNS answer for subsequent requests.
Another hybrid uses DNS as the primary steering plane and Anycast as the resilience plane. Normal traffic follows DNS-based answers to unicast IPs, allowing fine-grained capacity management. Simultaneously, the same PoPs advertise an anycast backup IP. If authoritative DNS becomes unavailable or a PoP's unicast health check fails, clients automatically fall back to the anycast IP without DNS re-resolution. This dual-stack approach is particularly effective for cache invalidation workflows where consistent PoP selection matters.
Some providers also implement DNS-over-Anycast: their authoritative DNS servers themselves are anycasted. This gives DNS queries the same low-latency, DDoS-resilient properties as data traffic, while still allowing per-query custom answers. It reduces DNS resolution time by 15-25ms and improves availability during DNS-targeted attacks.
Implementation Considerations
Choosing and operating GSLB requires attention to measurement, health checking, and observability.
Health Checks and Failover Logic
For DNS GSLB, health checks should be external, frequent (5–10 second intervals), and multi-perspective. A PoP that is reachable from your monitoring network may be unreachable from Southeast Asia due to a peering issue. Use distributed probes and require 2-of-3 failures before marking a PoP down to avoid flapping. For Anycast, integrate health checks directly with BGP daemons so a failed local service automatically withdraws the route — a pattern known as “BGP health injection.”
TTL and Caching Strategy
Do not set TTLs blindly to 10 seconds hoping for fast failover. Very low TTLs increase authoritative QPS 5–10x, raise costs, and still do not guarantee compliance. A balanced approach is 30 seconds for dynamic content and 60–120 seconds for static assets, combined with a low-TTL anycast fallback record. Monitor resolver behavior via DNS analytics to detect ISPs that clamp TTLs.
Observability and Debugging
Instrument both layers. For DNS, log every decision with EDNS subnet, returned IP, and reason code. For Anycast, embed PoP identifiers in HTTP response headers (e.g., X-Served-By: fra-03) and expose a /cdn-cgi/trace style endpoint. Without this, diagnosing why a user was routed to a distant PoP becomes guesswork. Combine RUM data with BGP looking glass checks to correlate routing changes with performance shifts.
Finally, test failover regularly. Conduct controlled PoP drains and BGP withdrawals during low-traffic windows and measure convergence time, error rate, and cache miss spike. A GSLB system that has never been failed over is a system you cannot trust.
Global load balancing is not a set-and-forget setting. It is a continuous optimization loop between network topology, application health, and user experience. Whether you lean toward DNS precision, Anycast resilience, or a hybrid of both, the goal remains the same: serve every request from the best possible edge, every time.
Frequently Asked Questions
What is the main difference between DNS-based and Anycast GSLB?
DNS-based GSLB returns different IP addresses per query based on location and health at the DNS layer, while Anycast advertises the same IP from all PoPs and lets BGP route users to the nearest location. DNS provides granular policy control; Anycast delivers faster, network-native failover.
Why does DNS caching hurt DNS-based load balancing?
Recursive resolvers and browsers cache DNS responses for the TTL duration, so traffic shifts and failover are delayed until caches expire. Many ISP resolvers override low TTLs to 60–300 seconds, causing stale mappings, uneven load, and continued traffic to failed PoPs during outages.
Is Anycast always faster than DNS-based GSLB?
Anycast often reduces initial latency by 10–30ms by avoiding DNS indirection and using BGP's shortest path. However, BGP selects paths by AS hops, not real-time latency or server load, so it can route to a suboptimal PoP without additional application-aware steering on top.
Should CDNs use a hybrid DNS + Anycast approach?
Yes. Most large CDNs use Anycast for fast ingress and DDoS distribution, combined with DNS for capacity management, geofencing, and fine-grained failover. This hybrid gives you Anycast resilience with DNS application-aware control — the current best practice.