Remember how it was in the old days, when you wanted to ring up an old neighbor? You had to scour through the phone directory looking for their contact number since you only knew the name. The internet still works in pretty much similar fashion.
You enter a URL in your browser’s address bar or when the search engine redirects a click you made on a particular search result to a URL, the internet has a Domain Name System (DNS) to sort things out. This DNS finds the corresponding website’s IP address and gets you the page or resource you were looking for. For every resource that you need from the internet, your browser must perform a DNS lookup at least once for each domain that supplies you with that resource.
This process of DNS lookup however has a toll on a website’s loading speed. On an average, it takes around 20 to 120 milliseconds for resolving an IP address to a given hostname by the DNS. Your browser is made to wait until this request is completed. However there are ways by which you can speed up this process and hence improve your website’s loading time. Here are a few tips to keep in mind.
Trying alternate DNS servers
Most website owners rely on their ISP provided DNS systems to perform the resolution but you can always try other popular DNS servers such as OpenDNS and the DNS service offered by Google. These DNS services may be faster than your ISP’s DNS service depending on geographical location and can have a positive say in your website’s loading speed.
Go for URL paths rather than hostnames
Most websites face the scenario when multiple properties need to be hosted on the same domain and in such cases they usually place them in different hostnames. Developers can easily assign these properties to URL paths rather than separate hostnames. For example when you have a test site to be hosted, go for hosting on www.yoursite.com/test rather than going for test.yoursite.com. There will not be any additional DNS lookup time needed for users in this case and thus save valuable loading time. Besides there is an added advantage for your browser as it is allowed to reuse TCP connections a lot more than usual. Thus round trip times of service requests are reduced as well since DNS cache hit rates are higher.
Critical path components should be served in the same hostname of the main document
Critical path components i.e. the resources as well as code that form the initial view of a page should have minimal DNS lookups if loading time is to be optimized. External JavaScript files in particular, which are loaded in the head or initial document body, could be hosted in the same host as the main document. This is because most web browsers prevent other downloads as well as content rendering while JavaScript files are being downloaded, parsed as well as being executed. If there is a DNS lookup associated with this initial action, then further delays would be experienced by other components and the whole page faces more load time. So unless it is technically necessary to have these files served in different hostnames, refer from doing so.
Making the choice with resources
Tiny things on your website which might sound very immaterial to your site’s context can be avoided so that it does not create another DNS lookup request. You can analyze your existing site to see which components create DNS lookup requests and make decisions on avoiding them considering priorities i.e. the component or loading speed. A simple tool to help you check DNS lookup requests can be found here. Use it to find resources that could be avoided without impacting your website’s purpose but at the same time improve its loading speed.
In today’s fast paced internet driven economy, even a millisecond makes an impact. So being able to cut out DNS lookup time in your website would reflect on its loading time considerably. So here comes the big question. How do you create state of the art websites that boosts your business interests online while adhering to best development and hosting practices? The answer is just a click away. Visit our website to know how we can help you create the fastest and most reliable consumer targeting websites for your business.