I recently wrote an article about what anycast is and how it is tied to network performance. Today let’s take a closer look at how anycast can be used to speed up individual aspects of a website or application loading process including DNS queries and HTTP requests.
Whenever a client or end user types an URL into the address bar of a browser, they first query a DNS server. Essentially what a DNS lookup does is to translate the website address from human-readable website names to the correct machine-readable IP address for that website. These IP addresses are then returned to the end user who can in turn connect to the website web server using the IP address and fetch the website content.
The speed at which DNS queries are sent, received and resolved is one aspect which determines the performance and speed of web services and applications. Traditionally DNS lookups are handled by DNS resolvers or name servers at the client ISPs. These resolvers query the authoritative domain for the website, get the IP, return it to the client and also cache it for future use. However, these DNS name servers are often sparsely distributed. They tend to be quiet far away from the end user. This greater distance results in longer DNS lookup times which leads to slower websites.
Managed DNS providers use anycast DNS to geographically distribute replicas of a DNS name server. These replicas or instances of a DNS server advertise the same hostname/IP address by utilizing the Border Gateway Protocol (BGP). BGP routes internet traffic over network route with the least number of network hops. Therefore, DNS Queries are handled by the nearest DNS name server.
Anycast DNS results in lower network latency and quicker DNS query responses. This ultimately lead to quicker page load times and an improved end user experience.
The second important stage in loading a website involves fetching the actual website content from the server to the end user. This stage also has major implications for the performance of online applications. Small delays in fetching the website content can result in long page load times, degraded performance and slow applications. Anycast can also be used to speed up this process by leveraging multiple instances of a server to advertise the same IP address.
Anycast allows multiple, globally deployed servers providing the same service, to advertise the same IP address.
Once the DNS name server resolves the URL address into the corresponding IP address it is returned to the client router. On an anycast network this IP address however, is advertised by multiple geographically distributed servers simultaneously. BGP, which is the standardized routing protocol of the internet, then routes requests for the website content to the nearest server location.
Using BGP anycast for HTTP requests results in much quicker content delivery by geographically distributing multiple servers and serving clients from the nearest server.
Anycast at Datapath.io
Datapath.io combines both anycast DNS and BGP Anycast into one service to maximize availability, resilience, scalability and robustness while also reducing network latency for AWS based web services and applications.
Datapath.io allows service providers to replicate DNS name servers by code within an anycast cloud. DNS queries are then routed to the nearest anycast cloud region which results in much quicker DNS responses. Multiple AWS regions hosting instances of the same website also advertise the same IP address. This then allows http requests to be routed to the nearest AWS region through anycast.