IPv4 addresses come in 4 forms: Unicast, Broadcast, Multicast and Anycast. On the other hand, IPv6 addresses only come in 3 forms: Unicast, Multicast and Anycast. For the purpose of this article, we’ll explain in more detail what is Anycast and how does it work.
The various forms mentioned above are referring to how data is routed to the destination IP addresses. Each form has a different way of being routed to the destination. Unicast is the most basic. When you send data to a Unicast IP address, it just goes from the sender’s machine to the recipient machine that is using that IP address. We will explore Multicast and Broadcast in future articles.
Basic concept of Anycast
Imagine you have a very popular website which attracts web visitors from every continent. If you only have web servers in the United States, e.g. New York data center, then it won’t be surprising that a visitor from Malaysia will experience considerable latency when accessing your web pages. This is due to the fact that the web page data will have to travel through many hops (routers) on the Internet to reach your audience. The more hops, the higher the latency.
Anycast was designed to cater to this sort of scenario. The idea is to have more servers in a geographically dispersed pattern. So, you could have web servers in each country or on each continent. Then you need to apply Anycast routing to these servers.
With Anycast routing, each of those servers is given the same IP address and the one nearest to the web visitor will respond with the data. This way, the latency should be kept to a minimum. What makes it special is that the web visitor does not have to do anything. All of the work is done on the routers via the Border Gateway Protocol (BGP) when the routes are announced. The routers will know which is the shortest distance in terms of number of hops.
Anycast is commonly used in Content Delivery Networks (CDN) which acts as cache for web servers to keep commonly requested items like images via a globally distributed network of servers. When a web visitor visits a web page which uses a CDN, the nearest CDN server will be the one serving up the cached contents.
Benefits of Anycast
The most obvious benefit would be low latency when serving content to your web visitors. Faster load time on your website translates to better conversion in the long run.
When your content is served via Anycast, you have a failover because if the nearest server is unresponsive, the next nearest server can respond. For a popular website, you can’t afford downtime.
Anycast can also alleviate the effects of a distributed denial-of-service attack (DDoS) as the attack load will be distributed among the various servers in the Anycast routing. The more servers you have in your Anycast, the better you’ll be able to withstand such an attack.