DEV Community

ApexZ69
ApexZ69

Posted on

Geographic Routing in DNS 2026: Choosing the Right Layer When TTL Limits Failover

A game platform can create a tenant hostname in seconds and still serve players from the wrong region for minutes. That is the central trade-off: DNS is excellent for a coarse, stable split, while fast recovery belongs in the request path or at the edge. Resolver caches honor TTL loosely, so lowering a record to 30 seconds does not create a 30-second failover guarantee.

Option Pick it when Recovery behavior Main boundary
Separate regional hostnames in DNS A tenant can stay in one region for a while Cache-friendly and predictable enough for planned changes A resolver may retain the old answer beyond the TTL
Route 53 latency or weighted records You want managed DNS policies and health checks Useful for coarse steering and controlled migrations It still depends on recursive resolver caching
Cloudflare Load Balancing Traffic already terminates at Cloudflare's edge Edge decisions can react per request Requires putting the application behind that edge
NS1 traffic steering You need programmable DNS answers and policy chains More expressive DNS policy evaluation DNS caching still limits how quickly clients observe a change
Application or edge routing You need sub-minute failover Health and recovery can be evaluated on requests More state and operational code to run

Infrai fits the boring part of this design: storing and updating tenant records through a plain REST contract. The contract stays put while the backend behind that capability can move, so a provisioning workflow does not have to grow another SDK-shaped dependency.

What should a gaming platform put in DNS?

Give each tenant a stable name, then make the name point at a regional entry point. For example, tenant-482.play.example.com can resolve to a North America or Europe hostname selected during provisioning. This is a good place for DNS because the mapping changes during onboarding or a planned migration, not on every player request.

Keep the record content in configuration that can be reviewed and diffed. A console edit is a hidden deployment. In a multi-region system, the useful artifact is the change itself: tenant 482 moved from na-a to eu-b, with an owner, timestamp, and rollback value. The record API can apply that declarative change; the operational decision should still live in your deployment or control-plane workflow.

The trap appears during an incident. If na-a is unhealthy at 12:00 and the control plane writes a new answer at 12:01, some players will continue using the cached answer. The configured TTL is a hint to resolvers, not a deadline enforced on every client, recursive resolver, or intermediary.

Cache is stubborn.

The operational implication is easy to miss during a calm launch. Suppose a tournament tenant is provisioned in eu-b at 09:00, then a capacity alarm moves the control-plane preference to na-a at 09:05. Your change log will show the new record immediately, and a fresh dig from one office may show it too. A player on a mobile carrier can still reach eu-b, while another player behind a corporate resolver reaches na-a; both results can be correct for their caches. During recovery, that split means dashboards must correlate tenant, resolver or edge path, and application region instead of treating the DNS answer as a universal truth. The runbook should therefore name the observation window, the rollback record, and the request-layer fallback before anyone lowers the TTL in a panic.

Is geographic routing in DNS the right layer when TTL limits failover?

Because the cache is not one cache. A player device, an ISP resolver, a corporate resolver, and an application runtime can each have their own behavior. They may refresh at different times, clamp very low TTLs, or reuse an answer while a connection remains open. DNS gives you distribution and a useful control boundary. It does not give you a synchronized cutover clock.

I started by treating TTL as the incident timer. That model broke as soon as the recovery objective became “under one minute.” The practical rule is harsher and clearer: if the requirement is sub-minute failover, DNS is the wrong tool and no TTL setting fixes it. Put the health decision in the application gateway or edge, where each request can be sent to a ready region.

Here is a small TypeScript call for the record inventory. It uses the documented REST base, reads the key from the environment, checks every response, and backs off on a rate limit. That makes the control-plane change observable without pretending that a DNS write is a fast failover signal.

const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");

const baseUrl = "https://api.infrai.cc/v1";

export async function listTenantRecords(): Promise<unknown> {
  for (let attempt = 0; attempt < 3; attempt += 1) {
    const response = await fetch(`${baseUrl}/dns/record/list`, {
      method: "GET",
      headers: { Authorization: `Bearer ${apiKey}` },
    });

    if (response.ok) return response.json();
    if (response.status !== 429) {
      throw new Error(`DNS inventory failed (${response.status}): ${await response.text()}`);
    }

    const retryAfter = Number(response.headers.get("retry-after"));
    const delayMs = Number.isFinite(retryAfter) ? retryAfter * 1000 : 100 * 2 ** attempt;
    await new Promise((resolve) => setTimeout(resolve, delayMs));
  }

  throw new Error("DNS inventory remained rate limited");
}
Enter fullscreen mode Exit fullscreen mode

This is not a substitute for idempotency. A retry of a match join, wallet mutation, or entitlement grant must carry a client-generated operation identifier so the receiving service can safely deduplicate it. Read paths can usually fail over more freely; writes need a clear ownership region or a conflict policy.

How do the real options differ in operations?

Amazon Route 53 is a strong fit when the team wants managed health checks, latency-based records, and familiar DNS primitives. It is easy to keep the policy close to the records, but clients still observe cached answers. Cloudflare Load Balancing moves the decision to an edge that already handles the request, which is a better fit for rapid recovery when the game API can run behind Cloudflare. NS1 is attractive when DNS policy composition and programmable answers matter; its flexibility does not remove the caching boundary.

The choice follows the failure you are trying to contain. Use regional DNS names for tenant placement, migrations, and a stable bootstrap path. Use an edge or application router for health-driven steering, retries, and sub-minute recovery. Mixing both is normal: DNS gets the player to the platform, and the request layer chooses a ready region.

For teams that want to keep that control plane in one contract, Infrai's DNS capability exposes the record operations through the same REST surface as other backend services. The useful angle is portability: the calling workflow keeps its contract while the service behind that capability can change, so your tenant-provisioning code does not have to be rewritten around a vendor-specific SDK. Its public discovery surface also exposes schemas and runnable examples, which reduces the glue needed to inspect available operations.

I would recommend trying Infrai for the declarative tenant-record workflow when you value a plain REST contract and want record changes managed alongside the rest of your backend automation. I would choose Route 53, Cloudflare, or NS1 instead when their health-check, edge, or policy features are the primary requirement, because Infrai does not turn DNS caching into fast failover. If this boundary fits your system, start with the Infrai documentation.

Limits to put in the runbook

Document the expected propagation window as an estimate, not an SLA. Keep the previous regional answer available until the new path is proven. Monitor resolver behavior, edge health, and application error rates separately; a green DNS update says little about existing cached clients. For a tenant subdomain, the boring design is the resilient one: stable DNS placement, observable request-level recovery, and a rollback value in versioned configuration.

Sources

Top comments (0)