What’s
CDN?
This question can be answered in five steps
1. HTML file citation
HTML file header (also in file, file end) often has other file references, such as CSS and JS references.
2. System resource references
In a website project, there are often many js and css references in the page. Those who have been in contact with development projects will generally understand that most of the script references in the interface are not as concise as in the first step, and may even be more quoted. Many, this way of combining resource files and business codes in one pot is suitable for small systems (concurrency, bandwidth, storage space, resources, etc.) where the application server pressure is not too great. The advantages of this method are labor-saving in development, labor-saving in publishing, low server requirements, low cost, and no specific public network access requirements. Many small, internal-use website systems often take this form of placing resource files.
3. What should I do if the system visits become higher and the speed becomes slow?
How to do? Optimize system deployment. How to optimize? There are many optimization methods, such as read-write separation, load balancing, and three days and three nights. Specific to the scope of this question, that is the separation of resource servers and application servers. The crude way of understanding is that the application is installed on the application server (one or cluster), and the resource is deployed on the resource server (single or cluster). At this time, the references of js and css need to be changed to absolute URLs, pointing to the corresponding Resource server.
4. Network optimization
The access speed of the website is based on only one point, that is, the speed at which the content contained in the page is transferred to the user’s computer. No matter how well the server is set up, it is perfect. If there is a relatively slow link between the user and the server, the overall speed will also be affected. The pull is very bad. Imagine you make a website for your company that runs on the company's intranet. Everything is running well, the distributed deployment has been set up, and everything is perfect. Later, your company operated well and opened a very distant branch (don’t ask why it’s so far away, and then ask for menopause), and your intranet was also connected at the same time (yes, that’s the kind of direct connection with several network cables) Just connect two local area networks into one local area network black technology). But because there are too many line nodes too far, the branch office accesses the company's system very slowly. At this time, you are worried. What can I do? If that doesn't work, just deploy a set of content caches at the branch office, and synchronize the content, so that at least the website access speed of the branch office can be improved a lot, and you can also be promoted and paid. Immediately afterwards, because of your outstanding performance, your company has expanded very strongly, and you have established branches all over the country, and you start to worry again. It is not possible to have a set for every branch. It is too tiring. If you want to go, then divide it into one set in East China, one set in North China, one set in Northeast China, and then set up some distribution servers, access the access address, and then jump to the nearest content cache server to read the content, OK, It's time for promotion and salary increase again~ Yes, here, you have completed the construction of a simple CDN.
Advantages of using
CDN Browsers need to connect to the server when downloading files such as css, js, and pictures from the server, and most browsers limit the number of concurrent connections for downloading files to the same domain name to 4, which means that if you want to download the fifth One file must wait for one of the first four files to be loaded. If the first four files are large, the fifth file will have to wait a long time, and the loading speed of the entire web page is limited by this. With CDN, you can load files through different domain names, which greatly increases the number of concurrent connections for downloading files.
Library files such as jQuery are now widely used. If the browser of the user who visits your website has already loaded jQuery through the same CDN as yours before visiting another website, since the jQuery file has been cached, there is no need to download it again. Up.
Maybe your website host performance is very good, but it should not have higher capacity and scalability than big companies such as Google, Microsoft and Yahoo. The CDN they provide has better availability, lower network latency and packet loss rate. .
CDN can provide a local data center so that users who are far away from the main server of your website can download files nearby and quickly.
Allows you to connect to a specific version of css file or js library file, you can request the latest version according to your needs.
Many commercial paid CDNs can provide usage reports, which can be used as a supplement to your own website analysis reports.
CDN can distribute load, save bandwidth, improve the performance of your website, and reduce the cost of hosting your website. It is usually free.
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.