Michel
Michel

Reputation: 726

Is it better to use one or two CDN?

In my ASP.NET MVC application, I reference three scripts from my local /Scripts directory.

<script src="/Scripts/jquery-1.7.2.min.js"></script>
<script src="/Scripts/jquery.validate.min.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.min.js"></script>

I would now use a CDN to load them.

Is it preferable to mix two CDN and use Google for jQuery and Microsoft for jQuery Validate? This way, both could be done in parallel?

Or is it useless and it's easier to depend on a single CDN?

Upvotes: 1

Views: 553

Answers (2)

Guffa
Guffa

Reputation: 700262

It's true that the scripts could be loaded in parallel, but on the other hand it causes another domain lookup, which could actually take longer than loading the two scripts from the same domain.

You are also adding another single point of failure. Both CDNs have to work for your page to work properly. Even if the risk is low for a failure there, it's still a risk.

Upvotes: 3

Richard Neil Ilagan
Richard Neil Ilagan

Reputation: 14747

Why would you want it loaded in parallel? Scripts are naturally blocking in nature, and with good reason, as a there is a good chance that scripts are dependent on other scripts as well. Loading one when its dependency hasn't is most probably fatal. Especially here, since jquery.validate is dependent on jquery.

Upvotes: 1

Related Questions