Practice this topic in a realistic system design interview
A global service may need to answer users in Tokyo, Frankfurt, and São Paulo without sending everyone to one datacenter. Anycast routing is one way to do that.
With anycast, several locations advertise the same IP prefix. The internet then routes each client to one reachable location using BGP, the routing system that connects networks together. There is no central application server choosing the target.
That makes anycast useful for stable global entry points: public DNS resolvers, CDN edges, DDoS scrubbing networks, and API front doors.
The important catch is that anycast is a network-level tool. It does not know whether a server is overloaded, whether a database is slow, or whether the nearest GPU cluster has capacity. And when people say anycast sends users to the "nearest" server, they really mean the best route according to the internet, not always the physically closest datacenter.
This chapter explains how anycast works, where it helps, and where it can surprise you in production.
Before anycast makes sense, it helps to compare it with the other common IP delivery models.
Unicast is the normal model for most network traffic. One destination IP address points to one reachable endpoint, or to one load balancer address, in a specific part of the network.
When a browser connects to an application server, it usually uses unicast.
Broadcast sends traffic to every host on the local network segment. It is useful for local protocols such as ARP and DHCP. Routers do not forward normal broadcast traffic across the public internet.
Multicast sends packets to receivers that joined a multicast group. It is used in some controlled networks for things like media distribution, market data, and infrastructure protocols. It is not how most public web applications reach users.
With anycast, multiple locations advertise the same IP prefix. The client's network picks one path using BGP.
From the client's point of view, there is one address. From the internet's point of view, that address is reachable from many places.
Anycast is often described as routing to the "nearest" server. A better way to say it is: anycast routes to the best BGP path from that part of the internet. That often means low latency, but not always.
The important difference is who makes the first routing decision:
| Model | Delivery Pattern | Decision Point | Common Use |
|---|---|---|---|
| Unicast | One address to one endpoint | Normal routing to one prefix origin | Web traffic, APIs, databases |
| Broadcast | One sender to all local hosts | Local network segment | ARP, DHCP |
| Multicast | One sender to subscribed receivers | Multicast routing and group membership | Controlled media or data distribution |
| Anycast | One address to one of many instances | BGP route selection | DNS, CDN edges, DDoS scrubbing, global entry points |
Anycast is different because the routing layer chooses the destination instance. The sender does not choose it, and your application usually does not choose it either.