|
I won't go into detail about the others, let's go straight to the topic. When the user enters the domain name and hits the car back, the Windows system calls the DNS client to find the DNS IP configured or automatically assigned by the user, and then the whole resolution process begins. Does DNS resolution, make sense to be faster? Yes, hehe, many small websites have DNS resolution times close to 0.5s, and I have even seen a website that takes 1.2s to parse the results. This is a very surprising statistic, because for the general website open time of more than 8 s, users are about to give up access, and for e-commerce websites, 4s is the limit of user patience. Generally, for optimized small websites, the DNS resolution time can be controlled at about 200MS, while for websites with a bandwidth of about 100M, the DNS resolution time can be controlled at 50-100ms. How to optimize? First of allTake advantage of TTLBecause it is necessary to allow users to get A records directly from the operator's DNS cache as much as possible, so as to ensure the fastest, but also to ensure that when your server has a problem, you need to switch as soon as possible, so this TTL setting also has some situations that need to be comprehensively studied. 1. You must know whether your server has multiple or backups. If there is no backup, when the server goes down, you can only resist, so the longer the TTL time is for you, the better, because the purpose of short TTL is to switch in time when the server has a problem, which is basically not used for websites without backup. Therefore, your TTL setting is as long as possible, of course, it cannot be infinitely long, generally TTL 3600 is enough. 2. If there is a backup or multiple servers, it will happen that the server is down and needs to be switched in time, the shorter the TTL time, the more timely the switching, but the shorter the TTL time, it means that the operator's DNS is often not cached, ordinary users, set TTL 600, if for timely switching, particularly demanding websites, set TTL 120. Secondly, searchHot enough domain name resolvers。 Many websites make their own domain name resolution servers, which is convenient to control themselves, but it is a big mistake, because your domain name resolution server is basically not cached, and every time you ask from the root server, it goes around most of the world before giving the final result, which will naturally be very ineffective. So, look for a domain name resolver that is hot enough. What is hot is that it is visited very often. If it is hot enough, the A record of the domain name resolution server will basically be cached by the DNS of the local operator. How to tell if a domain name resolver is hot enough? In fact, it is also very simple, see if the domain name resolver has enough customers, whether their customer website is popular enough, and whether there are enough people visiting. I also recommend a better way to do it, which is to find a CDN vendor for domain name resolution. Because many of the customers served by CDN manufacturers are very hot and have a large user base, the service effect of these CDN vendors' domain name resolution servers is good. Finally, advanced techniques---Use CNAME skillfully。 Many website owners run many small websites on the same server or servers; Or run a website yourself, but split many second-level domains. In response to these situations, it is seriously necessary to make good use of CNAME, and cname all the domain names or second-level domain names of these small websites to a unified domain name that you define. Then set the TTL for this cname long enough. In this way, the first resolution of the website can be obtained directly from the operator's DNS cache, that is, the record after directly getting the cname. Then, the second cname record, and set a relatively reasonable TTL value. In this way, the second-level domain name is heated in disguise, and the DNS resolution time is maximized by heating the second level and the first level with a sufficiently long caching time. This technique must ensure that the IP obtained by the last A record can serve these original domain names. Example: www.abc.com. 7200 IN CNAME hot.abc.com. hot.abc.com. 600 IN A 127.0.0.1 What is a split domain name? Many websites, when building a website, just apply for and purchase a domain name, and then all content: images, js, css, html, php, etc., are placed under one domain name. Splitting domain names refers to splitting domain names according to different applications. What are the benefits of splitting a domain name? Browsers using IE6 and IE7 kernels will only initiate 2 connections at the same time for the same domain name. Browsers using IE8 kernel can initiate 6 connections at the same time for the same domain name. Is it important? Very important, see the diagram. Use IE6 to open a website with all content under the same domain name
Use IE8 to open a website with all content under the same domain name
What we see is that in the case of IE6, requesting the 7th element, it takes 0.7s, while in the case of IE8, 0.277 starts requesting the 7th element. It can be seen that when there are more concurrent connections, the page will open faster.
From the above data, it can be seen that multiple domain names, whether in the case of IE6 and IE8, splitting the domain name will make the website open faster. The same is true in reality, large websites such as Sina and Taobao, they are all splitting domain names. In addition, it is necessary to correct the misunderstanding of an IT person. Because IT people are generally keen on technology, many people's operating systems and other versions are very new, and they use IE8 or even higher browsers. But in China, so far, the number of users using IE6 and IE7 is still about 80%. So, splitting a domain name can basically reduce your open speed by more than 20%. A simple operation can bring a huge improvement in effect, so why not do it? Of course, some people will definitely ask, splitting the domain name will lead to the problem of not being popular enough and the DNS cache not being able to hold it? This question, please see my last blog post, has given the answer. What is the principle of splitting a domain name? How many are appropriate? Generally, web websites below 50M can keep the domain name at 4 or 5, and too much range will complicate your maintenance and use. For web websites below 100-500M, the domain name is kept at about 8-10. For web websites above 1G, the number of domain names does not matter, keep more than 10, and the specific number is determined according to their own business and management characteristics. What content is placed under the same domain name? Page classes: html, htm, etc Style classes: js, css, etc Images: jpg, png, gif, etc Dynamic classes: php, asp, etc This allocation method will help you further optimize your website in the future, and when you need to look for acceleration tools, you can also choose different acceleration methods.
|