Reduce DNS lookups to improve website performance (Rule 4)
Believe it or not, website speed is directly related to conversion and revenue. One element that delays the time before a user can interact with a website is DNS lookups. In this article I’ll talk about how to reduce DNS lookups for your website.
Most AKF articles focus on the server-side architecture. In contrast, this article discusses the browser, or client-side software. Both parts need to be their best to improve the user experience.
This article is based on Rule 4 of Scalability Rules by Abbott and Fisher.
Website performance affects revenue
It is important to know that website speed affects conversion rate and conversion rate affects revenue.
For example, Pinterest improved their site speed by 40% which related to an increase of 15% in search engine traffic and signups. The BBC found they lost up to 10% of users for every additional second their site took to load. And AutoAnything.com improved sales 12-13% after improving page load time by 50%.
Website speed does matter; slower pages result in abandonment and unrealized revenue.
How Browsers Work
Let’s review at a high-level how browsers work. To start, a user requests a website by typing or selecting a webpage to visit. The browser then does three jobs:
- It figures out which server to talk to (this is called DNS Lookup - I’ll go deeper on this later).
- It contacts the correct server for the website information.
- It gathers any additional resources necessary to display the website.
The resources used to display a website are basically a bunch of files with relevant data. Common examples include:
- HTML files - Used for the structure of a webpage.
- CSS files - Used for styling a webpage and making the site pretty.
- Images - Well, we are a visual people.
Websites can also use lots of other files to customize user experiences. To run correctly, the browser needs to download or access all the files used by the website.
Where DNS Comes In
To find where a file lives on the internet, the computer first contacts the Domain Name System (DNS). This DNS is an important part of the internet. It allows the translation of a domain name (such as google.com) to an IP Address (such as 220.127.116.11).
The DNS can be thought of as an address book for computers on the internet. It is what sends requests for google.com to Google’s servers and requests to other domains to other servers.
Before a browser can draw anything, it must lookup all the domain names of all the resources a website uses.
To illustrate the time spent, Chrome developer tools show the steps over time a browser takes to load a webpage. In the following image, the circled line is the time it took to do a DNS lookup on one of its resources for a webpage. You can see from the chart that the DNS lookup accounts for 27% of the total time to load the resource.
The website also loaded resources from 65 other domains that required additional look ups. All of this “looking up addresses” will impact a user’s perception of the speed of the site.
How can I tell if my site needs improvement?
To see if your site needs improvement, check out GTMetrix.com. Their site gives a general grade (0-100%) related to the performance of a webpage. It is built on the YSlow and PageSpeed industry standard open source software. If you go to the YSlow page, one category is “Reduce DNS lookups.” Here you will discover the list of servers the site is doing a DNS lookup for.
As a general rule, the fewer DNS lookups the better. In practice, this rule needs to be balanced with the concept of maximum simultaneous connections. We’ll talk more about that in the next article. In short, it deals with the number of simultaneous connections a browser can make to request data. The more simultaneous requests that are possible, the faster the speed of the site.
For now, we don’t want to reduce DNS lookup too much, but we do want to reduce it enough to increase the speed of our site. The faster our site loads, the more our users stay with us.
The most common way to reduce DNS lookups is to combine resources into fewer domains.
When a developer first adds a library or a package to a website, the address for the resource typically refers to the resource’s original server. Many resources can legally be moved and served from other computers. This is the simplest way to reduce the effect of DNS lookups.
- Website speed affects conversion and conversion affects site revenue.
- Too many DNS lookups can cause unnecessary delay for a site to load.
- Serving resources from fewer domains reduces DNS lookups.
- But don’t take it too far. Browsers are designed to handle simultaneous connections, which also improves a site speed.
Need to get your site or company running better?
Give us a call. We are here to help.