Principles and methods of DNS optimization

Source: Internet
Author: User
Tags prefetch requires resource domain name server browser cache domain server

And the whole wpo is actually to the browser (browser) load and parsing (parse) the process of some of the consumption behavior optimization, and load and parse throughout the browser work in the process of entanglement and interaction.

Much of the discussion in this text is about the ability of the FE to reach out or agree on ways to quickly push tech to help.

OK, we slowly take a look at the process of the browser's work.

First of all, we first the whole browser how to find a site simple work –dns query:

First, when the user in the browser's address bar to the Web site's URL (such as: Alibaba.com), then the browser will first through the domain name to locate IP (DNS) to find where to obtain resources, at this time, the browser will be followed by the following search:

1. Browser Caching:

The browser will first in its own cache to find there is no corresponding domain name –ip match, if good luck, here you can directly try to access resources, if the luck of the average go down.

2. System cache:

There is no hit in the browser cache, and the browser tells the operating system: "Hey, I didn't find it in my own pocket, I might have lost it, I have to go see you." And then, a system process (?) Fetch the DNS cache in the system to query, repeat the previous luck judgment ...

3. Router Caching:

Come here, luck is really not very good ah, operating system also have no way, that how to do it, to route to see it ... Repeat the Luck judgment ...

4. ISP DNS Caching:

All right, I don't know if it's good luck or bad luck, no nonsense, go to the ISP (network provider) of the DNS cache server to look for, in general, the ISP end of the cache can be found in the corresponding cache records, should not be so back, or ... Your ISP has enough food ...

5. Recursive search ...

The most helpless situation occurred, in the absence of a way to hit the DNS cache, the ISP's DNS server began recursion from the root domain server, in order from the. com top-level domain server to Alibaba's domain name server, and no longer found ... Well, do you think the website you are going to really exist openly ...?

To emphasize that, not only for the first domain name access to the site need to do such a query work, in the page of resources referenced in the domain name resolution as there will be such a series of work. The most obvious is to enable a new domain name to do static resource storage services, basically the above 1–5 steps have to walk several times. To leave records for the new domain name on each DNS cache server.

On this topic, a similar system-level solution to DNS is not controlled by FE, and we can have some small tips to do something with DNS.

Well, the first one. DNS-related optimizations:

General Practice: The complexity of DNS resolution determines that improper use of multiple domain names to obtain resources can cause unnecessary performance overhead. In Wpo, a lot of the optimization work is very artistic, in both DNS and HTTP optimization is to see this magical artistry:

DNS optimization, of course, is to cause the DNS query cost as little as possible, while in the HTTP optimization strategy, there is an optimization measures to avoid the single domain name of the number of connections under the fault of multiple channels of resources to download, implementation details will be introduced in detail, here is simply to mention, Static resource multi-domain name service can bypass browser single domain name loading resources, the number of parallel connection limit, DNS optimization requires us as few domain name resolution, HTTP optimization requires us to use a multiple domain name services, how to make two optimization practices can be better implementation? [Todo]

Graceful demotion: In some modern browsers (Google Chrome, Firefox 3.5+), has been able to support DNS prefetching, how to prefetch it? That is, when the browser loads the Web page, the domain name in the href attribute in the Web page is parsed (1-5 steps above), and the result is cached in the browser, and when the user clicks on the link, the current DNS resolution is consumed. Pass this consumption process onto the browsing process that the user cannot perceive.

First, modern browsers have supported and turned on the DNS prefetch function by default. Of course, you can also manage this function through the configuration of the browser:

With firefox3.5+ you can do this: the browser defaults to open the DNS prefetch function under the HTTP protocol, the default shutdown HTTPS protocol DNS prefetch function, through the About:config Network.dns.disablePrefetch and Network.dns.disablePrefetchFromHTTPS < two options to control the prefetching capabilities under both protocols.

The Chrome Management DNS Prefetch method is temporarily missing.

Second, you can use meta information to inform the browser, I this page to do DNS prefetch:

Third, you can use the LINK tag to force prefetching of DNS:

[Todo DEMO]

Note : More wonderful tutorials Please pay attention to the triple computer tutorial section, triple Computer office group: 189034526 welcome you to join

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.