Google Chrome DNS Lookups

Dot Net Perls

You want to know how DNS lookups for subdomains on your website can affect its performance. Use Google Chrome's about:dns feature to see DNS lookup times. Here we take a look at the about:dns feature in Google Chrome, and discuss what it means about subdomains, with a focus on website performance.

Google Chrome about:dns

Introduction

As a reminder, a subdomain is a DNS domain that is "part of a larger domain." Wikipedia provides the examples "mail.example.com" and "calendar.example.com" as possible subdomains.

Resource page

Subdomains must be fetched from your DNS server separately from the main domain. In this way, they are an entirely different domain. This incurs a performance cost. What I show in the screenshot is Google Chrome's about:dns screen showing the Applicable Prefetch Time (ms) for several subdomains.

Subdomain note. Subdomains require time to fetch them from the DNS server, which Google Chrome prefetches. However, this prefetching is mainly useful for people who have already visited the site.

Resource page

Eliminate requests—favicon.ico

Almost all modern browsers request the file favicon.ico in the top level of every domain. This wastes lots of bandwidth for every visitor. Subdomains just make it worse because the browsers will request favicon.ico for your subdomains separately.

Model subdomain visits

Let's think of a visitor to dotnetperls.com. The visitor arrives from Google and reads an article. Next, she clicks on the link to my subdomain code.dotnetperls.com. The subdomain incurs two more trips over the network for the visitor. The favicon.ico is requested again, and the DNS record is fetched. This slows down the user experience of the pages, and costs me extra because of the extra favicon.ico request.

Programming tip

Avoid HTTP requests

Web performance experts will tell you that minimizing HTTP requests from the browser is often the most important optimization for web pages. Performance expert Andy King writes about this, stating "the more HTTP requests that your pages require, the slower... their response time will be."

Resource page

Does Google Chrome solve DNS slowdowns?

No. However, it helps solve the slowdown for many sites. It isn't perfect, and the favicon.ico must still be fetched. Programs like Fasterfox also do prefetching, but the number of users running Fasterfox is small compared to people running regular browser setups.

Summary

Here we saw that you can avoid subdomains to minimize HTTP requests and reduce response times. This saves you money on bandwidth and makes your pages faster. You can use Google Chrome and its about:dns screen to see DNS statistics for your computer's network. The screenshot I showed above revealed very small times for DNS lookups, but this can vary greatly.