← Tutorials
🌐 Load Balancing

GSLB and anycast DNS: trace traffic and test failover

Separate DNS selection from application routing, understand cache and connection limits, and test what happens when endpoints fail.

By The Downtime Β· Β·Updated 1 month ago
GSLB and anycast DNS: trace traffic and test failover

Global server load balancing (GSLB) and anycast can operate on the same request path. DNS-based GSLB selects an application address. Anycast lets several sites receive traffic for one service address. With anycast DNS, that shared address belongs to the DNS service; it does not automatically make your application's address anycast.

Start by drawing two paths: the DNS lookup and the connection that follows. That distinction tells you which component can move traffic when a site fails, and which clients may keep using the old destination.

Follow the lookup, then the application connection

Consider a hypothetical service with application endpoints in regions A and B. Its authoritative DNS service uses anycast. A client asks a recursive resolver for the application's address. If the resolver needs a fresh answer, it queries an authoritative server. Internet routing selects the anycast DNS site that receives that query.

The authoritative service then applies the configured GSLB policy and returns an answer for region A or B. After resolution, the client opens a connection to the selected application address. The resolver and authoritative DNS server are outside that application connection. Microsoft's Traffic Manager request walkthrough documents this DNS-based model.

The DNS site and application region can be in different places. A nearby DNS server can return a distant application address, and a cached answer can avoid a new authoritative lookup altogether. In the figure, region B is selected only to make the two paths visible; it is not a measured routing result.

Illustrative sequence with region B selected. Anycast determines which DNS site receives the lookup; the DNS policy selects the application address. A cached answer skips the authoritative lookup. View full size β†—

What does "nearest" mean?

Choose a routing policy according to the decision you need. Geography, estimated latency and network path selection answer different questions.

Route 53 geolocation routing maps a location to a record. It can select an endpoint by country or continent; it does not promise the fastest endpoint. Configure a default record for locations that are unmapped or have no matching rule, or those queries can receive no answer.

Latency routing uses AWS latency data collected over time. It does not benchmark your application during each lookup. AWS also warns that this data can differ significantly from latency to resources outside AWS, even in the same city. Measure the application's response time separately, including work performed after the connection arrives.

The location estimate has another limit: the authoritative service usually sees the recursive resolver's IP address. With EDNS Client Subnet, a supporting resolver can send part of the client's address so Route 53 can refine its estimate. Record the resolver and whether it supplies that information when investigating a surprising answer. One lookup from your laptop cannot establish what every user receives.

For anycast, routing policy and network topology determine the selected site. Geographic distance and application response time are not direct inputs to ordinary BGP path selection. RFC 7094 describes these anycast selection and reachability limits. Avoid promising users the physically nearest or fastest healthy application merely because a service uses anycast.

DNS weights and TTLs have narrower jobs

Weighted DNS routing controls record selection using relative weights. A resolver can reuse one answer for many clients, and a client can send many requests over one connection. A ten-percent DNS weight therefore does not establish that exactly ten percent of HTTP requests will reach an endpoint. Compare request counts at the application when evaluating a rollout.

TTL controls normal DNS cache reuse. It does not close established connections or force a browser to move an existing WebSocket. Microsoft's Traffic Manager documentation separates DNS refresh from the client connection. Lower TTLs can help fresh lookups discover a routing change sooner, but first account for answers cached under the previous TTL.

There is also a documented exception to normal expiry. A resolver implementing DNS serve-stale can return expired data when it cannot refresh the answer. That behavior protects DNS availability, while potentially extending use of an old application address.

A recovery test must observe health detection, answer changes, client retries and successful requests. Adding one TTL to a failure timestamp is not proof that users recovered. The DNS TTL and failover tutorial covers cache timing in more detail.

Health checks need an explicit failure policy

Attach each check to the endpoint whose eligibility it controls. Route 53 performs checks periodically and consults their current state when answering queries; it does not launch a probe for each lookup. Records without an associated check can remain eligible. If all records in a checked group are unhealthy, Route 53 generally treats them as healthy and chooses according to the routing policy, with policy-specific rules such as zero-weight handling. Read the record-selection rules for the exact configuration.

Choose a probe that answers whether this endpoint can serve the intended traffic. A TCP probe establishes that a connection can open. An HTTP probe can evaluate a response, but a static success page may miss a broken application. Azure documents probe protocols, response checks and endpoint states. Use that distinction to design your own readiness response.

Include dependencies only when their failure should remove this endpoint from service. If both regions need the same failed database, marking both regions unhealthy may leave the routing service with no useful alternative. Document the all-unhealthy response and test it on an isolated hostname. The Route 53 failover walkthrough provides a specific two-endpoint example.

Anycast failover depends on the service behind the route

A reachable route can still deliver packets to a broken service. An operator can tie route advertisement or withdrawal to service health, but must consider every service sharing that prefix. Withdrawing a route for one failed application could also move healthy traffic. RFC 4786 explains this coupling and the operational constraints.

When a route changes, an existing flow may reach a different site. If that site lacks the connection state, a long-lived connection can fail. Anycast does not inherently rule out TCP or affinity, but the service design must handle routing changes and state. Test reconnection and session behavior before relying on it.

Using a managed anycast service does not require you to obtain your own ASN or operate BGP. For example, AWS Global Accelerator provides static anycast addresses and forwards application traffic through its network to configured endpoints. That is a different traffic path from anycast authoritative DNS. With a standard accelerator, endpoint health and configuration influence backend selection after traffic reaches AWS. Check the product's behavior rather than applying a generic "BGP failover time" estimate.

Run a drill that separates the failure paths

Use a test hostname with disposable endpoints and synthetic requests. Give each endpoint a harmless response marker so you can identify which region answered. Keep test writes isolated from production data. Before injecting a fault, record the routing policy, health thresholds, resolver, TTL and the expected all-unhealthy behavior.

This worksheet describes tests to perform, not results from a Pingy benchmark. Run one fault at a time and retain timestamps from both the control system and the client.

Fault Evidence to keep
Region A fails its probe Check state, DNS answer, successful request to B
Resolver holds A's answer Remaining TTL, retry behavior, recovery time
Both endpoints fail Returned answer and actual application response
A recovers Eligibility change, traffic return, error rate
Anycast path changes Site marker, connection survival, reconnect result

For the anycast case, use a provider-supported test or a lab where you control route withdrawal. Do not announce public prefixes as an experiment. Measure from several networks, because an anycast observer only sees the site selected along its own path.

Repeat the drill with an established connection as well as a fresh client. Watch capacity at the surviving region and stop if the test exceeds the agreed error or load limit. During recovery, verify application and data readiness before restoring eligibility. Save the observed recovery times with the resolver and connection conditions; those details determine whether the result applies to your users.

πŸ’¬ Comments (0)

No comments yet β€” be the first to weigh in.

Join the conversation.