Front-End optimization: DNS pre-parsing improves page speed

Source: Internet
Author: User
Tags prefetch browser cache

In the Web experience, we often encounter this situation, that is, in the call Baidu Alliance, Google Alliance and the current page is located outside the domain name of the domain file will encounter the request delay very serious situation. So is there a way to solve this kind of request serious delay phenomenon?

In general, the reason for this delay is not the other site bandwidth or load reasons, then what is the cause of this situation. The assumption is that DNS is a problem because DNS resolution speed is probably the biggest cause of resource latency. The following code (used for DNS pre-parsing) was added to the header of the page:

<meta http-equiv= "X-dns-prefetch-control" content= "on"/><link rel= "Dns-prefetch" href= "/HTTP/ Bdimg.share.baidu.com "/><link rel=" Dns-prefetch "href=" http://nsclick.baidu.com "/><link rel=" Dns-prefetch "href=" http://hm.baidu.com "/><link rel=" Dns-prefetch "href=" http://eiv.baidu.com "/>

The effect is very good (test browser for IE8), and then open other pages when the Baidu share button loading significantly improved!

Let's take a brief look at Dns-prefetch:

DNS as the foundation of the Internet Protocol, the speed of its resolution seems easy to be overlooked by site optimization personnel. Most new browsers are now optimized for DNS resolution, and a typical DNS resolution takes 20-120 milliseconds, reducing the time and frequency of DNS resolution is a good way to optimize. DNS prefetching is the domain name that has this attribute does not need the user clicks the link to parse in the background, but the domain name resolution and the content loading is the serial network operation, therefore this way can reduce the user's wait time, enhances the user experience.

Browser to the site for the first time domain DNS resolution lookup process is:

Browser Cache-System Cache-Router cache-isp DNS Cache-Recursive search

Chrome built-in DNS prefetching technology, Firefox 3.5 also introduced this feature, because Chrome and Firefox 3.5 itself to the DNS pre-resolution of the corresponding optimization settings, So one of the bad effects of setting up DNS pre-resolution is that it may reduce the user experience of Google Chrome and Firefox 3.5 browsers.

Pre-resolved implementations:

1. Use meta information to inform the browser, the current page to do DNS pre-resolution: <meta http-equiv= "X-dns-prefetch-control" content= "on"/>2. Use the link tag in the page header to force DNS pre-parsing: <link rel= "Dns-prefetch" href= "http://bdimg.share.baidu.com"/>

Note: Dns-prefetch need to use caution, multi-page repeated DNS pre-resolution will increase the number of repeated DNS queries.

Ps:dns pre-parsing is mainly used for site front-end page optimization, in the role of SEO blue has not been verified, but as a part of the enhanced user experience rel= "Dns-prefetch" may be worth the time to discover.

Front-End optimization: DNS pre-parsing improves page speed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.