systemsMarch 21, 20264 min read

GeoDNS: Routing Users to the Nearest Region

How GeoDNS resolves different IP addresses based on where a user is, why it's the first step in any multi-region architecture, and how it differs from a CDN.

GeoDNS: Routing Users to the Nearest Region

What Is GeoDNS?

GeoDNS is a DNS technique where the same domain name resolves to different IP addresses depending on where the request comes from.

A user in Tokyo gets routed to your Tokyo servers. A user in Frankfurt gets routed to your Frankfurt servers. Same domain. Different IP. Zero application-layer logic required.


The Problem It Solves

Network latency increases with distance. The further a user is from your servers, the higher the round-trip time. For a user in Sydney connecting to a server in Virginia, you're looking at ~200ms of pure network latency before any application logic runs.

At scale, that adds up. Every page load, every API call, every WebSocket connection pays that latency tax.

GeoDNS eliminates it at the routing layer by directing users to the nearest region before a single byte of application traffic is exchanged.


How It Works

Standard DNS: your domain resolves to one IP address, always.

GeoDNS: the DNS server checks the IP address of the resolver making the request and returns the IP of the nearest region.

plain
1User in Tokyo → DNS query for api.example.com → Returns: 35.xxx (Tokyo region)
2User in London → DNS query for api.example.com → Returns: 18.xxx (EU region)

The routing decision happens at DNS resolution time — before any HTTP connection is made. It's the cheapest possible routing: a different answer in the DNS response.

Note

GeoDNS routes based on the user's DNS resolver, not their exact IP. If a user in Tokyo uses a US-based DNS resolver (like 8.8.8.8), they might get routed to the US region. In practice this is rare but not zero.

When to Add It

Add GeoDNS when:

  • You have servers or infrastructure in multiple regions
  • You have global users — meaningful traffic from geographies far from your primary data center
  • Latency is a product concern — real-time features, interactive UIs, APIs with tight SLAs
  • You need region-level failover — if one region goes down, DNS can be updated to route traffic elsewhere

Rule of thumb

GeoDNS is the prerequisite for any multi-region architecture. Without it, all your global infrastructure sits behind one DNS entry that sends everyone to one region.

When NOT to Add It

  • Single-region deployments — you only have servers in one place, GeoDNS doesn't help
  • When a CDN already handles geographic distribution for your content
  • Internal tools with users in one office or geography

Common mistake

Confusing GeoDNS with a CDN. They're different layers. GeoDNS routes DNS queries to the right region. A CDN caches content at edge nodes. You often use both — GeoDNS routes API traffic to the right region, while the CDN handles static asset delivery from the nearest edge.

GeoDNS vs CDN — The Difference

GeoDNSCDN
What it doesRoutes DNS to nearest regionCaches content at edge
What it handlesAll traffic (API + static)Primarily static assets
Latency benefitRoutes to right serverServes from nearest cache node
Where decisions happenDNS resolutionHTTP request level

You typically use both together: GeoDNS routes dynamic API traffic to the nearest application server. The CDN handles static files and doesn't depend on GeoDNS at all.


Real World

AWS Route 53 offers latency-based routing — a form of GeoDNS that routes to the region with the lowest measured latency to the user, not just geographic proximity. Cloudflare does this automatically as part of their DNS service.

Companies like Spotify and Airbnb use multi-region deployments with GeoDNS to route users to the nearest application tier — EU traffic goes to EU servers, US traffic stays in the US. Latency drops by 150–200ms for global users.


Takeaways

  • GeoDNS returns different IP addresses based on where the user's DNS query comes from
  • Routes users to the nearest region at DNS resolution time — before any HTTP traffic
  • Requires multiple regions to be useful
  • Combine with CDN: GeoDNS for dynamic API traffic, CDN for static assets
  • AWS Route 53 latency routing and Cloudflare both provide this out of the box
  • Not a CDN replacement — different layers, different problems
Share