CDNs and Anycast: Which Server Answered Your Request?
Technical
Look up the address behind a large website or a public DNS resolver and you get a single row of results, as though one machine sat at the other end of it. There may be no such machine. The address can be answered in many separate places at once, and the copy that answered you was picked by the network rather than by you or by the service.
The practice is called anycast, and the IETF documents behind it are unusually frank about both what it buys and what it quietly costs.
The same address, asserted in many places
The definition fits in a line. RFC 4786, published as Best Current Practice 126 in December 2006, calls anycast “the practice of making a particular Service Address available in multiple, discrete, autonomous locations, such that datagrams sent are routed to one of several available locations”. A Service Address, in the same terminology section, is “an IP address associated with a particular service”.
Nothing about the address itself gives this away. The Internet Architecture Board’s review of the practice, RFC 7094, states it flatly: “Anycast addresses are syntactically indistinguishable from unicast addresses.” The same document adds that, unlike ordinary addressing, “it is not considered an error to assert the same anycast address on multiple interfaces within the same or multiple systems”.
The consequence is worth stating. RFC 7094 records that in 1997 the IAB clarified that IPv4 anycast addresses were pure “locators” and could never serve as “identifiers” of hosts or interfaces. An address of this kind tells you where to send something. It does not name what will receive it.
There is a second kind of address sharing, and this one runs the other way. When several households leave through one public address, many clients share a single source address on the way out, and why that happens to home connections is a separate subject with separate causes. Here the sharing runs inbound. Many servers hold one destination address on purpose, because the operator arranged it that way.
The catchment your packet falls into
So who chooses? Not your browser, and not the service. RFC 4786 puts it in the network: “The routing system decides which node is used for each request, based on the topological design of the routing system and the point in the network at which the request originates.”
The document borrows a word from physical geography for the result. A catchment, it says, is “an area drained by a river, also known as a drainage basin”, and by analogy “the topological region of a network within which packets directed at an Anycast Address are routed to one particular node”. You are not assigned a server. You are standing somewhere in the network, and the slope of the routing system takes you to one.
None of this is new. The first specification, RFC 1546, dates from November 1993 and says of itself that it “does not specify an Internet standard of any kind”. Its account is the one everything since has elaborated: a host sends to the address, and the internetwork provides “best effort delivery of the datagram to at least one, and preferably only one, of the servers that accept datagrams for the anycast address”. It is equally plain about the limit. “An internetwork has no obligation to deliver two successive packets sent to the same anycast address to the same host.”
The speed claim comes with its own hedge
Among the reasons RFC 4786 lists for distributing a service this way is the obvious one, improving response time by shortening the network distance between client and server. The document then qualifies that in the next breath: “Topological nearness within the routing system does not, in general, correlate to round-trip performance across a network; in some cases, response times may see no reduction, and may increase.”
That is worth keeping to hand whenever somebody makes a performance claim about edge infrastructure. Nearest in the routing system means nearest under whatever metrics the routing protocols are using. Nearest in time means fewest milliseconds. The practice document does not promise that the first delivers the second.
Our own tool separates the same two things when it explains why a figure moves between runs. A round-trip measurement lists its causes individually: “Latency depends on physical distance to the server, how many network hops your traffic takes, congestion at your ISP or ours, WiFi signal quality, and whether other devices are competing for bandwidth on your network.” Distance and hop count sit as two separate entries on that list. Distance alone sets a limit nothing in the routing system can beat, and where that limit comes from is worth knowing before you judge any figure.
Even distribution is the other thing not to assume. RFC 4786 says so in terms: “Load-balancing between Anycast Nodes is typically difficult to achieve”, and puts distribution between nodes as “generally unbalanced in terms of request and traffic load”. Coarse distribution to make a busy service scale, yes. An even split, no.
The service that suited it from the start
DNS became the early home for this because of a property of DNS rather than a preference. Writing in January 2014, RFC 7094 observed that “UDP is the ‘lingua franca’ for anycast today”, and the reason is statelessness: a question and an answer that each fit in a single packet do not care whether the next packet reaches the same machine.
Anything holding state cares a great deal. The same document sets out what happens to a connection-oriented protocol when packets “may initially be routed to one anycast instance, but subsequent IP packets may be delivered to a different anycast instance if (for example) a route has changed”. In that case “the TCP connection will likely elicit a connection reset but will certainly result in the disruption of the connection”. RFC 4786 frames the risk as an operational warning: “Operators should be aware that, especially for long running flows, there are potential failure modes using anycast that are more complex than a simple ‘destination unreachable’ failure using unicast.”
Two IETF documents disagree about how far the practice should spread, and seven years separate them. In 2006, RFC 4786 judged that “the scaling problems described here prevent anycast from being a useful, general approach for service distribution on the global Internet”, leaving it suited to “a limited number of Internet-critical services”. By January 2014, RFC 7094 was recording the world as it had turned out: despite the architectural objections, “there is expanding deployment (e.g., for content distribution networks)”. Both documents still stand. The practice spread anyway.
RFC 7094 also said the technique “has been deployed for over a decade for DNS resolution services”. Which organisation actually stands behind one of the well-known resolver addresses, and what it retains about the questions you send it, is a different matter, and the three best-known ones set out against each other answers that from their own published policies.
What a lookup returns for an address like this
Point an IP lookup at one of these addresses and the result is accurate and oddly unsatisfying. Nothing in it says which of the service’s locations handled your last request.
Our own lookup page is upfront about the location field: “Location is approximate and may point to a city, region, datacentre, or network exchange.” The last two entries in that list are the interesting ones here. Try one of those addresses yourself and a result naming an exchange rather than a town is not a database failure.
RFC 7094 records that DNS use of the technique was first specified in 2002, in RFC 3258, and that document explains why exchanges keep turning up: “Ideally, servers should be placed topologically near the points at which the operator exchanges routes and traffic with other networks.”
Working out which copy answered is a known difficulty rather than a gap in the tooling. RFC 4786 states it directly: “A service distributed using anycast imposes an additional variable on the diagnostic process over a simple, unicast service”. It goes on to recommend that services built this way carry some means of identifying the node inside the protocol itself. Monitoring meets the same wall, because “the observed accuracy and availability of the service is, in general, different when viewed from clients attached to different parts of the network”. Checking such a service from one place does not tell you how it looks from another. What the single check you did run is nonetheless able to tell you depends on which machine composed the reply, and that much can be read off the message itself.
The short version
An anycast address is a label that several machines answer to, and the routing system hands your packet to whichever one your corner of the network drains towards. That buys resilience, and a shorter trip is the point of it. It does not buy a guarantee of either, and the best practice document says as much itself.
So when a lookup gives you a network and a vague region for an address you expected to pin down, nothing has gone wrong. There was never a single place to find. What such a result honestly tells you is which operator is answering, and that the question of where belongs to your own position in the network rather than to the address.