protocol

Anycast Routing

Announcing the same IP address from many locations so that network routing delivers each client to the topologically nearest one.

networkingcdnlatency

Anycast is what makes global services feel local without any client-side logic. The same address is advertised from dozens of sites, and BGP delivers each packet to whichever announcement is nearest by routing metrics — so a user in Frankfurt reaches Frankfurt and one in São Paulo reaches São Paulo.

Its advantages over DNS-based geographic routing are meaningful: failover is handled by the routing layer within seconds by withdrawing an announcement, with no dependence on DNS caching or on clients respecting TTLs. It also absorbs volumetric denial-of-service attacks by spreading traffic across every site rather than concentrating it, which is why every serious DNS and CDN operator uses it.

The constraint that shapes what can be built on it: routing decisions are made per packet by the network, and a route change mid-connection sends packets to a different site with no session state. That is harmless for stateless UDP protocols like DNS, and it is why long-lived TCP connections over anycast need care — in practice, stable enough that it is used widely, and a real consideration for very long connections.

The other honest limitation is that "nearest" means nearest by BGP path selection, which reflects commercial peering relationships rather than geography or latency. Anycast usually routes well and occasionally routes a user across an ocean for reasons entirely outside your control.