Before jumping straight in to the topic let us have a quick look on 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 for all the Domain Name Systems connecting to it. The browser have to do it for each and every DNS resources, your site is receiving from. So more the DNS resources connecting to your site, more the browser have to look up and thus more is the DNS lookup time.
If your site is using the social buttons( Twitter, Facebook etc), affiliate programs, adsense and many more then while downloading your webpage the browser have to lookup for all the external DNS resources who 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 host-name. And the browser cannot download anything from the host until the look ups completes.
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 an average it will take 500-600 millisecond 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.
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 linking to our site?
- Go to GTMetrix and have the domain analysis for your website.
- Click on the Reduce DNS lookups and check it yourself what are the external resources which 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 which are linking 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 reduce DNS lookups score will increase to 80.
Though I need to reinstall, as I need it.
If you are running adsense ads on your blog then there will be adsense scripts which 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 as:
- Leveraging browser cache
- Including a CDN network and correspondingly changing the nameserver.
- Improving Time to first byte
- Installing an image optimizer to reduce the bytes
- Removing query strings from static resources
Or you can check the conglomerate of website speed posts which includes all the factors which effects the page speed.
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.