-->

Why use CDN(Content Delivery Network‎)? [duplicate

2019-02-25 21:17发布

问题:

This question already has an answer here:

  • What are the advantages and disadvantages of using a content delivery network (CDN)? [closed] 4 answers

I noticed that most of the tutorials online make use of CDN instead of just adding a new file(be it css or jquery) locally and just referencing it in the manner of . I read about it but it still does not make a lot of sense as to why you would use a CDN. Besides for better caching, why would you make use of cdn instead of coding your file locally and just referencing it?

回答1:

It simply Decrease Server Load

As a result, the strategic placement can decrease the server load on interconnects, backbones and public and private peers, which frees up overall capacity and decreases delivery costs. Essentially, the content is spread out across several servers, as opposed to offloading them onto one large server.

Make Faster Content Delivery

Since CDNs place servers as close to a group of users as possible, latency and packet loss are minimized due to a shorter distance traveled. Theoretically, the closer the content is to the user, the faster the delivery. Therefore, users will experience less jitter when streaming, fewer network spikes, and an overall improved streaming quality. Due to the reliability, operators can deliver high quality content with a high level of service, low network server loads, and thus, lower costs.

Additionally, many CDN providers offer TCP acceleration technology which boosts performance, thus improving user experience. Since CDNs decrease latency, the acceleration working in conjunction with an already high-performing network results in explosive content.

100 Percent Availability

Due to the distribution of assets across many regions, CDNs have automatic server availability sensing mechanisms with instant user redirection. As a result, CDN websites experience 100 percent availability, even during massive power outages, hardware issues or network problems.

Increase in the number of Concurrent Users

Strategically placing the servers in a CDN can result in high network backbone capacity, which equates to a significant increase in the number of users accessing the network at a given time. For example, where there is a 100 GB/s network backbone with 2 tb/s capacity, only 100 GB/s can be delivered. However, with a CDN, 10 servers will be available at 10 strategic locations and can then provide a total capacity of 10 x 100 GB/s.

Control of Asset Delivery

Another beneficial feature of CDN technology is that more control of asset delivery and network load is awarded. Operators have the ability to deliver real-time load statistics, optimize capacity per customer, display active regions, indicate which assets are popular, and report viewing details to their customers. These details are extremely important, since usage logs are deactivated once the server source has been added to the CDN.

For more reference: link



回答2:

The cache is one of the reasons: if I use the same jquery file as e.g. google.com does, most of the users visiting my side will not have to load it. Which decreases the loading time of my webpage.

Another reason is the global distribution of the CDN-server. If I want an image here in Germany it would take a longer time to load it from an US server than from a server here in Germany (because of latency).



回答3:

EDIT: oh i wrote in german.... to many mixed languages >.< Here the translation:

Many Projekts/Websites use HTTP/1 but this is a big slow down. HTTP/1.1 is not able to send files parallel and have to send the header/handshake for every single request again. You get huge latency issues, thats the reason browser use up to 6 connection to 1 Host to be able to load 6 files in one go. With CDN you increse the Hosts to each CDN gives you additional 6 connections.

BUT that actually history! HTTP/2 use just 1 connection and is able to keep the stream up and then multiplexed packages. Its spriting/Concating on protocol layer. That mean you are able to send many files parallel(depends now on your bandwith, before the latency blocked this possebility). You even can prio files and create a queue so that unimportant files will be send at last.

With HTTP/2 CDN can actually slow your site down again because you have to send multiple header/handshakes again, mean latency.

For HTTP/2 you need a HTTPS connection but that is recommended anyway