In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What are the techniques for optimizing DNS parsing and splitting domain names and making websites open faster? I believe many inexperienced people don't know what to do about this. Therefore, this article summarizes the causes and solutions of the problems. Through this article, I hope you can solve this problem.
Without repeating the rest, let's get to the point by giving full play to the character of the second.
In the whole process of the user opening the website, DNS parsing is the first link. After the user enters the domain name and hits enter, the windows system calls DNS client to find the DNS IP configured or automatically assigned by the user, and then starts the whole parsing process.
DNS parsing, does it make sense to be faster?
There are, hehe, many small websites, DNS parsing time is close to 0.5s, and even I have seen a website, it takes 1.2s to analyze the results. This is a very surprising figure, because users who have been open for more than 8s are about to give up access, while for e-commerce sites, 4s is the limit of user tolerance. In general, for small websites that have been optimized, the DNS parsing time can be controlled around 200MS, while for websites with a bandwidth of about 100m, after optimization, the DNS parsing time can be controlled at 50-100ms.
How to optimize it?
First of all, make good use of TTL, because 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 something goes wrong with your server, you need to switch as soon as possible, so there are some situations that need to be comprehensively studied in this TTL setting.
1. You must know if you have more than one server or backup. If there is no backup, you can only resist when the server goes down, so the longer the TTL time, the better, because the purpose of TTL short is to switch in time when there is a problem with the server, which can not be used for websites without backup. Therefore, your TTL setting is the longer the better, of course, can not be unlimited length, generally set TTL 3600 can be.
2. If there is a backup or multiple servers, it will happen that you need to switch in time due to server downtime. The shorter the TTL time, the more timely the switch, but the shorter the TTL time, which means that the operator DNS is often unable to cache. For general users, you can set it to TTL 6000.If you switch in time, you can set up TTL 120for websites with particularly stringent requirements.
Second, look for a domain name parser that is hot enough. Many websites make their own domain name resolution server, which makes it easy to control, but it's a big mistake, because your domain name resolution server is basically not cached. Every time you ask a circle from the root server, it takes more than half the world to give the final result, which will naturally be very bad. So look for a domain name parser that is hot enough. What is hot? it is that people are visited a lot. If it is hot enough, the A record of the domain name resolution server will basically be cached by the DNS of local operators. How to judge whether the domain name parser is hot enough? In fact, it is also very simple to see if there are enough customers of this domain name parser, whether their customer websites are hot enough, and whether there are enough people to visit them.
Also recommend a better way, that is to find CDN manufacturers to do 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 domain name resolution servers is good.
The last is the advanced technique-using CNAME skillfully. Many website owners operate many small websites on the same one or more servers, or run a website of their own, but split many secondary domain names. In view of these situations, there is a serious need to make good use of CNAME to cname the domain name or secondary domain name of all these small websites to a self-defined unified domain name. Then set the TTL time for this cname to be long enough. In this way, you can ensure that the first parsing of the website can be obtained directly from the operator's DNS cache, that is, the record after cname. Then, the second cname record, and then set a relatively reasonable TTL value. In this way, the second-level domain name is heated in disguise, and the DNS parsing time is optimized by heating the second-level domain name and the first-level cache time long enough. The trick is to make sure that the final A record of the IP 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 buy a domain name, and then all the content: pictures, js, css, html, php, etc., are placed under one domain name.
To split a domain name means to split the domain name according to different applications.
What are the benefits of splitting a domain name?
Browsers using IE6 and IE7 kernels will only initiate two connections for the same domain name at the same time.
Browsers using the IE8 kernel can initiate six connections at the same time for the same domain name.
Is it important?
It's very important. Please look at the diagram.
Use IE6 to open a website where all content is under the same domain name.
Use IE8 to open a website where all content is under the same domain name.
What we see is that in the case of IE6, it takes 0.7s to request the seventh element, while in the case of IE8, 0.277 starts to request the seventh element.
From this we can see that when there are more concurrent connections, the web page will open faster.
As can be seen from the above data, splitting multiple domain names, whether in the case of IE6 and IE8, will make the website open faster.
In reality, this is also the case, Sina, Taobao and other large websites, they are all splitting domain names.
In addition, the misunderstanding of an IT should be corrected. Because IT people are generally keen on technology, many people's operating systems and other versions are very new, using IE8 or above browsers. But across China, so far, the number of users using IE6 and IE7 is still around 80% of IT's shock. Therefore, splitting the domain name can basically reduce your opening speed by more than 20%.
A simple operation can bring a huge effect improvement, why not?
Of course, someone will certainly ask, "if you split a domain name, won't it lead to the problem that the domain name is not hot enough and the DNS cache cannot be cached?" This question, please see my last blog post, has given the answer.
According to what principles should the domain name be split?
What is the appropriate number?
Generally less than 50m web pages, the domain name can be kept at 4 or 5, too much scope will cause your maintenance and use to become complex.
For web sites below 100-500m, the number of domain names remains at about 8-10.
For web sites with more than 1G, the number of domain names does not matter, keep more than 10, and the specific number is determined according to your own business and management characteristics.
What content is put under the same domain name?
Page classes: html, htm, etc.
Style classes: js, css, etc.
Picture category: jpg, png, gif, etc.
Dynamic classes: php, asp, etc.
This allocation method will help you to further optimize your website in the future, and you can also choose different acceleration methods when you need to find acceleration tools.
After reading the above, have you mastered the skills of optimizing DNS parsing and splitting domain names and making the website open faster? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.