Reduce DNS resolution time of Domain name increase page load speed new level-dns cache/Pre-read/split domain name

Source: Internet
Author: User
Tags prefetch domain name server domain server ssl connection wordpress performance optimization

We know that when a user visits a website, the domain DNS resolution is the first step, and many people may not care much about DNS resolution time. Stable performance, fast response time DNS domain name resolution service and unstable, slow response DNS domain name resolution time may be 1 seconds, and for the site there are too many domain name resolution requests, this time accumulated is very much.

This article will be shared by optimizing the DNS domain name resolution, reduce DNS resolution time, so that the site in the original speed of access to continue to achieve a new leap. To learn more about website and Server optimization acceleration, try:

1. Speed up installation of Spdy modules on Ssl:nginx and Apache-Reduce SSL connection time to speed up website loading

2, WP acceleration: WordPress performance Optimization Accelerated five methods: Php,mysql optimization and review, picture static file acceleration

3, Google launched the server optimization: Host optimization accelerated mod_pagespeed and Ngx_pagespeed installation use

Reduce DNS resolution time for Domain name increase page load speed to new level-dns cache/Pre-load/multi-domain
I. DNS parsing principle and process of domain name


1. How does DNS come about? DNS is the abbreviation for the domain Name System. On the internet between the domain name and the IP address is one-on (or more to a), the domain name is easy for people to remember, but the machine can only know each other IP address, the conversion between them is called Domain name resolution, domain name resolution needs to be done by a dedicated domain name resolution server, DNS is the server for domain name resolution.


2, the basic process of DNS resolution one: Find the local domain name DNS cache. When a user accesses a domain name through a browser, the browser first looks in its own cache for the IP address of the domain name, such as the computer system Hosts file name corresponding IP, the router cache, and the ISP (Internet service provider) DNS cache.


3, the basic process of DNS resolution two: Through the above DNS query still do not find your domain name corresponding IP address, then you need to enter the root server for query. There are 13 root logical name servers worldwide. The 13 logical root name servers are named "A" to "M" respectively, and the real root server data on January 25, 2014 is 386 units distributed on all continents of the world.


4. Although there is no specific information for each domain name in the root domain server, it stores the address information of the domain name servers that are responsible for resolving each domain (such as COM, NET, org, etc.). The root name server will tell the local DNS server IP of the top-level domain name (such as. com) server in its jurisdiction, so that your domain name query request will go to the appropriate top-level domain name server.


5, the basic process of DNS resolution three: The top-level domain server receives the request to view the zone file record, if none of its jurisdiction in the primary domain name (without any prefix domain name, such as freehao123.com) server IP address to tell the local DNS server. If it is still not found, go to the next level domain name server to find it. Repeat until the correct result is found.


6, find the correct domain name corresponding IP address, the local name server to save the returned results to the cache for the next use, while the results are fed back to the client, the client through this IP address and the Web server to establish a link. Your browser will then visit the website normally. It is an example of Google.com, which explains the entire process of DNS parsing when a user accesses Google.

Second, the browser to load the basic process of Web pages


1, from the browser address bar to start the request link, the browser through the DNS resolution to the IP address of the domain name map, after successful browser to this IP address to obtain a connection, after a successful connection, the browser side will request header information through the HTTP protocol to this IP address server initiated the request, The server waits for processing after accepting the request.


2, the browser load display HTML order is: from top to bottom, the order of rendering is also from top to bottom, download and rendering are simultaneous. If you encounter semantic explanatory tags embedded in the file (JS script, the CSS download process will enable a separate connection to download, and after the download, parsing, parsing, stop the page all the down element of the download.


3. What causes the page to load too slowly? The browser can parse the HTML file in parallel while downloading the CSS resource, but once a reference to the script file is found, you must wait for the script file to finish downloading and execute before parsing continues. Content download time mainly depends on user bandwidth, server bandwidth, file size, number of files, etc.


Third, reasonable use of DNS TTL value to increase the cache hit rate of the domain name

1. When a DNS server uses recursion or iteration to process client queries, they will discover and gain significant information about the DNS namespace. The information is then cached by the server. Caching provides an accelerated performance approach to subsequent queries for DNS resolution of popular names, while significantly reducing DNS-related query traffic on the network.


2, TTL (time-to-live) is a domain name resolution record on the DNS server cache time. When the information is cached, the time-to-live (TTL) value applies to all cached RRs. As long as the TTL of the cached RR does not expire, the DNS server can continue caching and use the RR again to answer queries from clients that match those RRs.


3. Increase the TTL value appropriately to allow DNS server to cache the domain name longer and increase the cache hit ratio. TTL generally defaults to one hour, and can be set to one day or even more than one week according to the actual situation. Of course, if your domain name's IP often changes, then the TTL should not be too large, otherwise the DNS server will temporarily be unable to obtain a new correct IP address.


Iv. Rational use of Dns-prefetch to allow DNS pre-read

1, from the browser to load the Web page process can be seen, the request of the Web page can be multi-tasking at the same time, for the Web page has multiple DNS requests, you can let the browser in the background first to use the DNS request to complete silently, so that when the user opens a new Web page, you can save the DNS query time.


2, the Control browser DNS pre-read is Dns-prefetch label, DNS prefetch should be placed in front of the page as far as possible, the format is similar to: <link rel= "Dns-prefetch" href= "/http Cb.baidu.com "/>, many sites use the Baidu Advertising Alliance code, using this can be pre-read DNS.


3, by default, the browser will have an implicit DNS Prefetch, which will be on the page and the current domain name (the domain name that is browsing the Web page) is not in the same domain domain name for pre-acquisition, and cached results, we can use the following label to suppress the implicit DNS Prefetch:<meta http-equiv= "X-dns-prefetch-control" content= "Off" >


4, it is necessary to note that the DNS Prefetch only need to be used when the user first opened the site, there is no need to use DNS Prefetch each page, or duplicate DNS read, but also virtually increase the number of DNS queries, the effect is counterproductive.


Five, DNS domain name resolution split into multiple domain names to increase concurrent download volume

1, generally the content of the Web page will occur when multiple domain name request service, if your website js, CSS, pictures and so on, it is recommended to put these files on different domain names, so that the browser can open a page at the same time to send DNS resolution requests to these domains, Can reduce DNS time to a certain extent.

2, the more content of Web pages, the analysis of the domain name should be as much as possible. For example, HTML, HTM,JS, css,jpg, PNG, gif,php, ASP can all be placed on different domain names. In practical applications, the use of a full-site CDN or a static file CDN can achieve the above effect, and the combination of CSS Sprite used together.


3, CSS Sprite function on the contrary, it is not to increase the domain name request, and reduce the domain name DNS request, mainly used in the picture. It allows you to include all the scattered images of a page in a large image, so that when you visit the page, the loaded picture will not be shown as a picture of the past.


Six, speed up the DNS resolution method summary


1, this article describes the use of DNS cache, DNS pre-read, split domain names to reduce the DNS resolution of the time domain name method, for the general site of the acceleration may not be obvious, but for some of the daily DNS requests to reach more than millions site, the effect of DNS acceleration is obvious. In addition, if you find your site response is too slow, you might as well check the DNS time of the webpage.


2, in addition to the DNS resolution from the website itself to speed up the speed of access, we usually choose the DNS service as far as possible to use those stable and reliable DNS services, such a DNS service response speed and cache rate are very good. If your own site to split a number of two-level domain names, may wish to use CNAME, set a good TTL time, to ensure that the first time the site resolution, can be directly from the operator's DNS cache to get.




Reduce DNS resolution time of Domain name increase page load speed new level-dns cache/Pre-read/split domain name

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.