Website Performance: Avoiding DNS Lookups

Website Performance: Taxonomy of Tips introduced a classification scheme to help us organize the many performance tips found on the Internet.  Today’s article continues the discussion of the journey-from-the-client-to-the-servercategory by examining what DNS lookups do to that journey.

DNS Lookups Are Automatic

When the user’s browser requests a web page from the server, it first asks the domain name system (DNS) to map the domain name to an IP address. Depending on caching, remoteness, and other factors, this lookup process can perform poorly. Since every component on the web page goes through the same lookup process, DNS performance can become an important consideration.

For example, if your DNS entries are set to expire immediately, if you are dealing with a sub-sub-sub-etc-domain, and if your authoritative DNS server is on a slow connection, the lookup process can perform so poorly that either the browser or the user gives up.

In a more realistic case, the lookup process can have a significant impact on overall performance, which makes our website seem slow.

This process cannot be avoided because accessing an Internet host requires an IP address. The only reason we can use domain names at all on the Internet is because the DNS provides a mapping from domain name to IP address.

How to Avoid the DNS

The next two paragraphs do not apply to servers that use dynamic or shared IP addresses.

We can avoid the DNS if we use IP addresses instead of domain names. If we can access web pages and components by IP address, there is no need to resolve a domain name, so we skip DNS lookup completely. This can have a significant impact on performance.

As we discovered in Cookies Don’t Taste So Good accessing web pages by IP address suppresses the transmission of cookies. If the page we are accessing relies on cookies, it cannot be accessed by IP address. Since images, scripts, and style sheets don’t use cookies, though, there is nothing stopping us from accessing them this way.

banner-seo-4

DNS Performance

If the preceding tip won’t work, proper configuration of the domain’s authoritative DNS server and proper registration of the domain information within that server are both essential. Many companies now outsource this function to an infrastructure solution provider (e.g., UltraDNS, OpenDNS), but larger companies still trend toward providing their own authoritative DNS servers. Based on his survey, Simon Waters concludes that “many organizations who run their DNS servers themselves would be better advised not to.”

Google, like many others, recommends DNS caching, reducing the physical distance from the client to the DNS server, guarding against attacks, mapped or hashed load balancing, and not reducing TTL values too far. However, in DNS Performance and the Effectiveness of Caching, Jung, Sit, Balakrishnan, & Morris suggest that “client latency is not as dependent on aggressive caching as is commonly believed.” Regardless of what the average case may be, what really counts is the performance of the web services under our control. The only way to know for sure if caching affects our website’s performance is to try it and measure it with the Monitis Free Page Load Testing Tool.

Whether hosting or outsourcing our DNS server, we are still responsible for making sure it and its entries are configured for acceptable performance. Considering that we operate in the highly-dynamic Internet environment, DNS performance should be monitored on a regular basis. This is not as scary or time consuming as it sounds. A Monitis monitor can keep an eye on things for us and let us know if DNS performance is not up to snuff.

Serve Needed-Now Components From One Host

Since serving from multiple hosts requires multiple DNS lookups, all needed-now components (i.e., those that make the page immmediately visible and useable) should be served from a single host. This will result in one DNS lookup rather than several.

Reverse DNS Lookups

Most web servers do reverse DNS lookups by default, but this time-consuming step is not required. Reconfigure the web server not to do this.

References

Best Practices for Speeding Up Your Web Site by Yahoo’s Exceptional Performance Team.  Published by Yahoo at developer.yahoo.com/performance/rules.html.  Accessed 2012.01.13.

DNS Performance and the Effectiveness of Caching by Jaeyeon Jung, Emil Sit, Hari Balakrishnan, Member, IEEE, and Robert Morris. Published by Massachusetts Institute of Technology at nms.lcs.mit.edu/papers/dns-ton2002.pdf. Accessed 2012.01.24.

Have You Monitored Your DNS Performance Lately? by Simon Waters. Published 2002.09.12 by CircleID at circleid.com/posts/have_you_monitored_your_dns_performance_lately. Accessed 2012.02.03.

High Performance Web Sites – 14 Rules for Faster-Loading Web Sites by Steve Souders.  Published by Steve Souders at SteveSouders.com/hpws/rules.php.  Accessed 2012.01.13.

Minimize Request Overhead. Published by Google at http://code.google.com/speed/page-speed/docs/request.html.  Accessed 2012.01.21.

Minimize Round-Trip Times.  Published by Google at code.google.com/speed/page-speed/docs/rtt.html.  Accessed 2012.01.13.

Monitis Free Page Load Testing Tool.  Published by Monitis at pageload.monitis.com.  Accessed 2012.01.13.

Monitis Transaction Monitoring.  Published by Monitis at portal.monitis.com/index.php/products/transactions-monitoring.  Accessed 2012.01.13.

Top Ten Web Performance Tuning Tips by Patrick Killelea.  Published 2002.06.27 by O’Reilly at OReilly.com/pub/a/javascript/2002/06/27/web_tuning.html.  Accessed 2012.01.13.

Web Performance Best Practices.  Published by Google at code.google.com/speed/page-speed/docs/rules_intro.html.  Accessed 2012.01.13.

Website Performance: Taxonomy of Tips by Warren Gaebel.  Published 2011.12.29 by Monitis at blog.mon.itor.us/2011/12/website-performance-taxonomy-of-tips.  Accessed 2012.01.13.

Try Monitis For Free.  A 15-day free trial.  Your opportunity to see how easy it is to use the Monitis cloud-based monitoring system.  Credit card not required.  Accessed 2012.01.13.

The Monitis Exchange at GitHub.  This is the official repository for scripts, plugins, and SDKs that make it a breeze to use the Monitis system to its full potential.  Accessed 2012.01.13.

You might also like