Pre-Resolve DNS

PageSpeed Service was turned off on August 3rd, 2015. Please see Turndown Information for PageSpeed Service.

Objective

Reduce DNS lookup time by pre-resolving at the browser.

Description

DNS resolution time varies from <1ms for locally cached results, to hundreds of milliseconds due to the cascading nature of DNS. This can contribute significantly towards total page load time. This filter reduces DNS lookup time by providing hints to the browser at the beginning of the HTML, which allows the browser to pre-resolve DNS for resources on the page.

Operation

This filter inserts the tag <link rel="dns-prefetch"> (or <link rel="prefetch"> for IE9) in the HEAD section, for all domains present in the HTML document. If the Flush Resources Early rewriter is turned on, this information will also be flushed early.

Example

The example below shows the HTML before rewriting:

<html>
  <head>
  </head>
  <body>
    <img src="www.domain1.com/image1.jpeg">
    <script src="www.domain2.com/script1.js">
  </body>
</html>

and after rewriting:

<html>
  <head>
    <link rel="dns-prefetch" href="//www.domain1.com">
    <link rel="dns-prefetch" href="//www.domain2.com">
  </head>
  <body>
    <img src="www.domain1.com/image1.jpeg">
    <script src="www.domain2.com/script1.js">
  </body>
</html>

Limitations

This rewriter will be applied only on Firefox 3.5+, Chrome, Safari 5+ and IE 9+.

Risks

This rewriter is considered minimal risk.