DNS or domain name system is the way the internet makes sense of website names and connects users to the correct web server. The time it takes for DNS queries to be sent, resolved and received has a huge impact on the speed of a website or application.
DNS also plays its part in failover and load balancing. DNS failover allows DNS queries to be re-routed among a set of servers, in the event of a server failure. DNS load balancing architectures distribute traffic over multiple servers.
Optimizing DNS queries for the quickest response times, high availability and failover is essential to ensuring a great end user experience.
What is DNS
The first thing to understand about the Internet is that it doesn’t understand English (despite everything AI enthusiasts tell you). That is why we have DNS servers. DNS servers translate plain English website names into machine readable IP-addresses. Once the website names are translated into IP addresses they can then be returned to the user browser. The user’s browser then uses the IP address to query the website server and receive the content.
Why DNS Optimization matters?
DNS matters because it takes time for DNS queries to travel across the network to the DNS resolver and back again. The time required translates into load times for websites and applications.
In the early days of the Internet, websites were stand-alone entities. Everything was hosted on one web server and was served from that web server to the end user. Not so anymore.
The lifeblood of today’s websites is third party scripts. Third party scripts range from ones that call ads to marketing and analytics scripts. All these scripts are essentially mini websites hiding inside your website and each one has to be queried and resolved.
To put this in perspective consider that on average every website has 75 third party scripts. This means that the client browser has to resolve 75 domain names. This takes time and feeds into the time it takes for your website to load.
Therefore, optimizing DNS queries for faster response time is essential to ensuring a fast browsing experience. Following are some tips to ensure that your DNS infrastructure is optimized for blazing fast response times.
Time to live (TTL)
TTL is the time that you allow the IP address to be cached. TTL presents a catch 22 situation. Setting low TTLs can lead to slower performance because the client has to go up to the resolver or the authoritative domain to get the IP. Higher TTLs side step this issue but create different problems. Longer TTLs can lead to situations where a server goes down and is no longer available but since the IP is cached, the client goes to the server that is down.
Setting TTLs is a trade off between having faster DNS resolving and aiming for maximum availability.
Another way of optimizing DNS server performance is to use anycast. Anycast allows multiple geographically distributed DNS nameservers to advertise the same IP address. DNS queries can then be served by any one of a number of anycasted DNS servers. This lowers DNS response times and in turn improves performance.
DNS Load Balancing
Anycast DNS can also be used for DNS load balancing. Popular websites that get hundreds of thousands of hits every hour usually distribute the load over many DNS servers. This ensures that no one server has too much load at one time.
Anycast can also be used for DNS failover. It allows automatic and predictable switching between servers, in the event of failures. If a server goes down, DNS queries can be re-routed to redundant servers without any disruption. Datapath.io’s anycast DNS architecture reduces failover times to less than 10 seconds and ensures that sessions are not lost.
Download the anycast whitepaper to learn more.