Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load files from one CDN or multiple CDNS

On a typical webpage I load the following, all from CDNs:

  • jQuery
  • Angular
  • Bootstrap
  • Icomoon
  • a few Angular plugins

Is it better to load these from 1 CDN (if possible), or from different CDNs? Are there best practices for this, or does it not make a difference?

like image 490
Jimmery Avatar asked Sep 04 '17 14:09

Jimmery


People also ask

Can you use multiple CDNs?

Multi-CDNs work by selectively routing traffic over different CDNs in the network. The specific criteria around what routing decisions get made varies between multi-CDN implementations. Common multi-CDN strategies include: Static DNS– With this approach, static DNS entries are configured for each CDN in the multi-CDN.

Should I use CDN or local for production?

CDNs deliver faster loading speeds for readers. A CDN can store content in different formats, which can contribute to faster loading for different users. Because this content is readily available, it is pushed to users faster than would be the case in a local website server.

Is it good practice to use CDN?

It is still beneficial to use a CDN, and it is still for your users' benefit, but the benefit is in reduced latency with geo-located servers, not in general performance due to a hot cache hit.


1 Answers

In terms of using one or multiple CDN, it wouldn't be an issue depending on how many components you are downloading from the same hostname, according to this article from Yahoo UI Team, HTTP/1.1 suggests that browsers should limit parallel downloads to two per hostname. Therefore, using multiple CDN sources, it is, different hostnames should be a good practice.

Maybe in case of using related components just to avoid accidentally version mismatch like angular and angular-router for example, you might want to use the same CDN, but, if the download per hostname increases it would create loading leaks the same way (at least for browsers that follows the spec suggestion).

Using a CDN is definitely a good practice to increase loading performance of your web site. However, you should consider using the more popular CDNs you can find, it would increase the chances you get a cached version of the files you are using from a different site that uses the same file, which would increase even more the loading performance of the website.

As @JeffPuckett pointed out in the comments, browsers have a higher limit of simultaneous download per server/proxy today's days:

Firefox 2:  2 Firefox 3+: 6 Opera 9.26: 4 Opera 12:   6 Safari 3:   4 Safari 5:   6 IE 7:       2 IE 8:       6 IE 10:      8 Chrome:     6 

Ref.: https://stackoverflow.com/a/985704/4488121

like image 124
lenilsondc Avatar answered Sep 25 '22 14:09

lenilsondc