What is Anycast?
Anycast, also known as IP Anycast, is a networking technique that allows for multiple machines to share the same IP address. Based on the location of the user request, the routers sends it to the machine in the network that is closest. This is beneficial since, among other things, it reduces latency and increases redundancy. If a particular data center were to go offline, an Anycasted IP would choose the best path for users and automatically redirect them the next closest data center. The following outlines some of the pros and cons that are associated with configuring Anycast.
- Speed. Traffic going to an Anycast node will be routed to the nearest node thus reducing latency between the client and the node itself. This ensures that speeds will be optimized no matter where the client is requesting information from.
- Redundancy. Anycast improves redundancy by placing multiple servers across the globe using the same IP. This allows for traffic to be rerouted to the next nearest server in the case that one server fails or goes offline.
- DDoS mitigation. DDoS attacks are caused by botnets which can generate so much traffic they overwhelm a typical Unicast machine. The benefit of having an Anycast configuration in this situation is that each server is able to “absorb” a portion of the attack resulting in less strain on the server overall.
- Load balancing. Load balancing can be utilized in the case that there are multiple nodes all within the same geographic distance from the request. This takes some of the resource requirements off of a singular node and disperses them across multiple nodes.
- Difficult to Implement. Implementing IP Anycast is a complex endeavour that requires additional hardware, reliable upstream providers, and proper traffic routing.
Border Gateway Protocol and Autonomous Systems
Border Gateway Protocol (BGP) and Autonomous Systems (AS) are integral parts in the way IP Anycast functions. The BGP exchanges routing and reachability information between AS. It makes routing decisions based on paths, policies, and rule sets which is a key component of what IP Anycast offers. Within BGP routing there are multiple routes for the same IP address which are pointing to different locations.
An Autonomous System is a single or collection of networks all administered by the same administrator. Autonomous Systems each have a unique ASN, or Autonomous System Number, for use in BGP routing since each ASN identifies each network on the internet.
How Does Anycast Work?
As previously mentioned, Anycast directs user requests to the nearest node in order to reduce page latency. It does this by following these steps.
- Multiple service instances announce they share the same IP address.
When the user’s browser makes a request, the router receives that request and simply chooses the route with the shortest distance to the nearest server based on the AS path.
Using Unicast, which will be explained in the following section, the path would only lead to one destination no matter the distance. Using Anycast, the route is optimized due to it always selecting the best path. In the case that a server is down, the BGP will simply find the next best path and route the request there.
Other Addressing Methods
Other addressing methodologies exist as well for routing user requests to a particular network end point, the most popular of which being, Unicast and Multicast.
Most of the Internet today uses this method. Unicast restricts an IP address to be associated to only one particular node in a network. This is known as a one-to-one association. Although much of the internet uses this method, it is sub-optimal due to the restrictions of only being able to associate an IP address with one node.
Known as a one-to-many association. Multicast allows for a request from a sender to be routed to various selected endpoints simultaneously. This allows for a client to download a file in chunks from multiple hosts at the same time (useful for streaming audio or video). Multicast is often confused with Anycast, however the main difference is that Anycast routes the sender to one specific node even though multiple nodes are available for use.
It is clear that Anycast is a powerful technique for, among other things, reducing page latency and mitigating attacks. Although it is a complex endeavour to implement, the payoff is vast for both the users and the service providers alike.
KeyCDN is happy to offer Anycast to help improve the overall efficiency of services to our customers.