May 13, 2016
Anycast is a routing methodology that sends packets to one node out of a group of potential nodes. It improves connection speed and redundancy by analyzing incoming packets and routing them to the closest available server.
Most of the Internet follows a unicast addressing approach: an IP address links to one particular server, workstation, or router. While this logically makes sense, it introduces a single point of failure which requires additional complexity to work around. Unicast also makes it difficult to optimize services for users in wide geographic areas. For instance, a user in Scotland may have to connect to the same IP address as a user in Canada.
Anycast resolves these issues by allowing multiple nodes to share the same IP address. Similar to how emergency calls work on a phone, Anycast takes a connection to a single IP address and resolves it to one of several available nodes, allowing the Scottish user to connect to a UK server while the Canadian user connects to a North America server.
How Anycast Works
Content providers host web services in several locations around the world. Each location resolves to the same IP address, allowing packets to travel to one or more nodes. When the provider’s routing system comes across an incoming packet, it determines the location nearest to the packet and routes the packet accordingly.
Step-by-step, here’s how Anycast works:
- A user opens a web page or connects to a web service, creating a connection to a service provider.
- The user’s browser resolves the domain name of the service. Some service providers offer their own domain name resolution servers that use Anycast for low latency DNS resolution.
- The browser connects to the IP address. The provider routes the connection to the nearest server to maximize performance.
In addition to improving speed, Anycast provides a way for service providers to handle failures. If a server goes offline, packets are immediately routed to the next available server, providing an uninterrupted experience for users while allowing administrators to identify and resolve the problem.
Example of Anycast
Say a user wants to connect to a service hosted by MaxCDN. MaxCDN uses a series of Anycast DNS servers which quickly route and resolve the domain name request. Once the user has the service’s IP address, MaxCDN routes each request to that IP address to the closest available location that can respond to the requests. The user sees a speedup not only in the initial domain name lookup, but also for subsequent connections.
MaxCDN also takes advantage of Anycast when performing upgrades and routine maintenance. Datacenters are taken offline by stopping the announcement of its Anycast IP address, which takes it out of the available Anycast pool. Until it’s brought back online, further requests will be seamlessly routed to the next closest data center.
Benefits of Anycast
Anycast offers a wide range of practical benefits for users and enterprises:
- Users have a faster, uninterrupted experience as their connections are seamlessly routed to the server closest to them.
- Enterprises see lower administration costs since Anycast inherently routes around slow and failed nodes.
- Enterprises also see higher customer satisfaction since Anycast prevents users from experiencing slow or unavailable service.
While Anycast can be difficult to implement, it has enormous benefits in performance and reliability. Organizations like OpenDNS rely on Anycast to handle over 50 billion DNS queries on a daily basis while maintaining 100% uptime. For services with growing user bases, having a system that can handle failures quickly and transparently is a no-brainer.
Content delivery networks like MaxCDN use Anycast to deliver content to customers faster.