Skip to main content
Anycast and Geo-Routing: How Requests Reach the Nearest PoP

Anycast and Geo-Routing: How Requests Reach the Nearest PoP

KU
· Founder & Chief Editor
• 7 min read•Updated •61 views

A request leaving a laptop somehow lands on a server 20ms away. Here is what actually decides which point of presence answers.

Key takeaways

  • Three separate systems pick the PoP that answers a request.
  • Anycast announces one IP from many sites and lets BGP choose the topologically closest, GeoDNS returns different IPs based on the resolver's location, and latency-based DNS picks the region with the lowest measured latency.
  • Use anycast for stateless edge traffic and latency DNS for origin selection.

Three mechanisms decide which point of presence answers a request. Anycast announces one IP from many locations and lets BGP pick the topologically closest. GeoDNS answers with a different IP depending on where the resolver sits. Latency-based DNS picks the region with the lowest measured latency. They are separate systems, and they can disagree.

Verified against

Amazon Route 53 latency routing, Cloudflare Load Balancing (dynamic steering and the load balancer API), against the AWS Route 53 developer guide, Cloudflare developer docs and RFC 7871 (EDNS Client Subnet). Checked October 2026.

Most people lump all of this together as "the CDN figures it out." When latency goes weird, it is usually because one layer made a call the other didn't expect, so knowing which one is in play changes how you debug.

Anycast: one IP, many locations

With anycast, the same IP address is announced from dozens or hundreds of locations at once. Every PoP running BGP says "I am 104.16.0.1" to its upstream networks. The internet's routing tables then carry your packet to whichever announcement is topologically closest: fewest AS hops, per the routing policy of every network in between. RFC 4786 documents the operational practice.

You can see it. Run a trace to a Cloudflare address from two continents and the same IP terminates in different cities:

code
$ dig +short one.one.one.one
1.1.1.1

$ curl -s https://1.1.1.1/cdn-cgi/trace | grep colo
colo=FRA        # from Frankfurt

# same command from a US host
colo=IAD        # from Ashburn

Same IP, different building. No DNS trick involved: the DNS answer is identical everywhere. BGP did the sorting. This is why anycast is the default for DNS resolvers and DDoS scrubbing: attack traffic gets spread across every PoP instead of piling onto one.

The catch: BGP optimizes for hop count and each network's own preferences, not for your latency. A packet can be routed to a "nearby" PoP that sits behind a congested peering link or takes a scenic path through a transit provider. Topologically near is not the same as fast. A typical case: a user in Sydney pinned to a Singapore PoP because their ISP's preferred path runs through a cheap transit provider instead of a direct peer, adding tens of milliseconds.

GeoDNS: different answers by resolver location

The older approach is to hand out different IPs depending on where the DNS query came from. The authoritative nameserver looks at the resolver's IP (or, with EDNS Client Subnet, a truncated slice of the actual client subnet), maps it to a region, and returns the address of the closest cluster.

This is what Route 53 geolocation and latency routing policies do. A latency record set looks like this:

JSON
{
  "Name": "api.example.com",
  "Type": "A",
  "SetIdentifier": "eu-west-1",
  "Region": "eu-west-1",
  "AliasTarget": {
    "HostedZoneId": "Z32O12XQLNTSW2",
    "DNSName": "eu-alb-1234.eu-west-1.elb.amazonaws.com",
    "EvaluateTargetHealth": true
  }
}

Add one of these per region and Route 53 answers each query with whichever region has the lowest latency from that user's network. AWS notes the latency data is based entirely on traffic between users and AWS data centers, and it shifts over time, so a user routed to one region this week may land in another next week. Geolocation policy is the blunt cousin: it routes by continent/country regardless of measured performance, which is what you want for data-residency or licensing rules, not for speed.

Latency-based routing

Latency routing is GeoDNS with a feedback loop. Instead of a static country-to-region map, the provider keeps a live latency table between networks and your regions and picks the fastest. Route 53 builds this from its own measurements. Cloudflare Load Balancing's dynamic steering builds per-region RTT profiles from health-monitor probes, using an exponentially weighted moving average:

code
# cloudflare/load-balancer.yaml (fields from the Load Balancers API)
steering_policy: "dynamic_latency"
default_pools:
  - us-east-pool
  - eu-west-pool
session_affinity: "none"
adaptive_routing:
  failover_across_pools: true

dynamic_latency picks the pool in default_pools with the lowest RTT and requires health checks on those pools. With no RTT data yet for a region, traffic follows failover order, and Cloudflare says to allow about 10 minutes for the profile to build. failover_across_pools lets zero-downtime failover retry against a healthy origin in another pool; it defaults to false.

The gotchas that bite

Resolver location is not user location. GeoDNS sees the resolver, not the person. Someone in Denver using 8.8.8.8 may look like they are wherever Google's nearest resolver PoP is. EDNS Client Subnet (RFC 7871) fixes most of this by passing a truncated client subnet prefix, which Route 53 latency routing takes into account, but not every resolver sends it, and some strip it for privacy. When answers look wrong, DNS troubleshooting on Linux covers checking which resolver you are actually hitting.

DNS TTLs cache your decisions. If you set a 3600s TTL and then a region goes down, resolvers keep handing out the dead IP for up to an hour. Latency and failover routing want short TTLs (30 to 60 seconds). That is more query load, which is the price of fast reconvergence.

Anycast can flap. When BGP announcements shift (a peering session bounces, a route gets withdrawn), mid-connection traffic can suddenly land on a different PoP. For stateless requests, fine. For anything holding TCP state without a shared session layer, that is a reset.

Measuring it for real

Synthetic checks from a monitoring vendor's clean, well-peered datacenters will tell you everything is 15ms and lie to you. Real User Monitoring (RUM), a small script beaconing actual PerformanceNavigationTiming and connection RTT from real browsers, is the only thing that shows the Sydney-via-Singapore path. Put the two side by side. When synthetic says fast and RUM says slow, you are looking at a peering or ECS problem, not a code problem.

Smart placement is the payoff. Routing users to the nearest PoP means little if that PoP then makes three round trips to a database on the other side of the planet. Running compute near the data, or replicating the data near the compute, is where edge functions earn their place. Pair this with multi-region failover so a fast path that dies fails over before users notice.

Questions people ask

What is the difference between anycast and GeoDNS?

Anycast gives every location the same IP and lets BGP routing deliver each packet to the topologically nearest announcement, so DNS returns one answer everywhere. GeoDNS returns different IPs depending on where the DNS query came from, usually the recursive resolver's address or an EDNS Client Subnet prefix. Anycast reacts at the routing layer; GeoDNS decisions are cached for the record's TTL.

Why is my traffic going to a far-away PoP?

Usually one of three things. BGP chose a path that is few hops but slow, often through transit instead of a direct peer. Your resolver is far from you and doesn't send EDNS Client Subnet, so GeoDNS placed you by the resolver. Or a resolver cached an answer from before a failover. Check curl -s https://1.1.1.1/cdn-cgi/trace style endpoints and dig against the authoritative server to see which layer chose.

Does Route 53 latency routing use the user's location?

It uses latency data between users' networks and AWS Regions, not geography. AWS says that data comes entirely from traffic between users and AWS data centers and changes over time. When the resolver supports the edns-client-subnet extension, Route 53 receives a truncated version of the user's IP and uses it, otherwise it sees only the resolver's address.

The call we'd make

Use anycast for anything stateless and attack-exposed: DNS, static edge, TLS termination. Use latency-based DNS routing for origin selection, with short TTLs and health checks wired in. Turn on EDNS Client Subnet if your provider supports it. And do not trust a single synthetic dashboard. Put RUM next to it, because the only latency that matters is the one your actual users are paying.

Sources

Explore topics:Cloud
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Anycast and Geo-Routing: How Requests Reach the Nearest PoP. DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/anycast-and-geo-routing-nearest-pop

Markdown

[Anycast and Geo-Routing: How Requests Reach the Nearest PoP](https://www.devopsness.com/blog/anycast-and-geo-routing-nearest-pop) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)

KU

Kiril Urbonas

Founder & Chief Editor

586 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.