Before jumping straight into the topic let us have a quick look at the terminologies to understand why to reduce DNS lookups.
WHAT ARE DNS LOOKUPS?
DNS stands for domain name system which should be connected to an IP address to be found by the web browser.
When a webpage is requested the browser must look up all the Domain Name Systems connecting to it. The browser has to do it for each and every DNS resource, your site is receiving.
So the more the DNS resources connect to your site, the more the browser has to look up and thus more the DNS lookup time.
If your site is using social buttons (Twitter, Facebook, etc), affiliate programs, AdSense, and many more then while downloading your webpage the browser has to lookup for all the external DNS resources that have been connected to your site.
So a feature-rich webpage takes longer to load as there are more DNS to lookup for.
HOW DOES IT AFFECT WEBSITE SPEED?
According to Yahoo, it takes 20-120 milliseconds for a browser to look up the IP address for a hostname. And the browser cannot download anything from the host until the lookups are complete.
For a single request to the DNS server to fetch the referenced script it takes about 100 milliseconds. So what about when there are 5-6 requests. On average, it will take 500-600 milliseconds just for DNS lookups.
This entire process of DNS lookups can slow down your site considerably if the number to look up is more. So you need to decide which are the ones important for your site. A simple webpage can take additional seconds to download if it is rich in features.
HOW TO REDUCE DNS LOOKUPS?
By reducing DNS lookups you can also reduce the simultaneous downloads in the browser and thus decrease the page load time.
To Reduce DNS lookups we will have to remove the external websites which are linking to our site.
How to find the external site resources which are linked to our site?
- Go to GTMetrix and have the domain analysis for your website.
- Click on the Reduce DNS lookups and check yourself what external resources are delaying your site load.
3. When you click on the down arrow you will get something like this.
These are the external site resources that are linked to my site.
But is it possible to remove all the external sites?
Let us look at the above example. There we can see the sites which are linking:
- Google Apis- Used for fonts
- Mailmunch- This is where I keep my email list
- Analytics- Useful to collect my site data
- Cloudflare- My CDN network and so on.
So I cannot remove any of the external website resources which are linking to my site as they are damn important to me.
If I uninstall my Mailmunch then my reduced DNS lookup score will increase to 80.
Though I need to reinstall it, as I need it.
If you are running AdSense ads on your blog then there will be Adsense scripts that are hosted on third-party locations.
If you are having social buttons then that will also affect the page speed.
It is up to you to decide what is important for your site. You can omit a number of unimportant applications to reduce DNS lookups and increase your site speed.
You should not worry much about DNS lookups (until it is too poor) as there will be external sites where it is necessary to get the resources from. If you want to increase the website speed then focus on the other elements:
- Leveraging browser cache
- Including a Cloudflare CDN network and correspondingly changing the nameserver.
- Improving Time to the first byte
- Installing an image optimizer to reduce the bytes
- Removing query strings from static resources
If you check the GT Metrix result picture shown above, you will find that my ‘use cookie-free domains’ is having Grade F(25).
If you are done with reducing DNS lookups then let us check how to use cookie-free domains and improve website speed.