Question

I recently came across the following

 http://www.jsdelivr.com

which is a cdn which hosts a number of js files. But I am confused, i was going to use bundling in asp.net mvc to bundle together a number of js files and store it as 1 js file and hosted with my content.

But it appears that i can now download from the CDN above.

Which is recommended, lets say I have 8 js files and I bundle them together into 1 js file, that is actually one call as far as the browser is concerned but to my website.

Or use the CDN but this would be 8 calls (8 js files) but of course hosted via a CDN in the country closest to where you are.

Which is advisable ?

Was it helpful?

Solution

you should evaluate:

1) Would you like to ensure a low latency for your users?

Then it depends on where you customer/users sits. If they have lower latency to jsdelivr.com compared to your server I would recommend you to use their service since it would speed up their load time. But keep in mind that most browsers can only handled some 4-6 parallel downloads, so make sure you make empirical measurements between the two options - your bundled solution might be quicker even if the latency is higher.

2) Would you like to offload you server load?

By refering their server you will reduce the outgoing traffic from you server. If you expect heavy load on you server you might like to use their service to offload both data and CPU load. If you host on EC2 this might be a cost effective solution...

OTHER TIPS

In HTTP/2 you should not minified your external resources. Load all of them indepenly and HTTP/2 will share the same HTTP connection and download all of the files in just one connection. That's the same as bundling.

So, Now, go for JSDelivr and dont bundle the files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top