Pages Menu

Posted by on Nov 1, 2011 in Development | 2 comments

JQuery: Using the right CDN

I was reading an article called 6,953 reasons why I still let Google host jQuery for me – which is a scentific experiment to find out which CDN is used by the world’s top sites for JQuery.

Knowing which CDNs are popular is really important. For instance, let’s say you’ve decided to choose Microsoft to host your JQuery CDN.

The whole point of CDNs is that by the time they get to your site, hopefully the user has already picked up the JQuery file (or any other resource) and has it in their cache. This results in a quicker load time on your site, and a better experience.  (oh, and possibly you can decrease your hosting traffic costs).

Common sense dictates that the more sites use the same CDN as you, the more likely it is that by the time they get you they will already have everything they need. For the most popular sites on the web, this is even more true.

So, how many other sites are using the Microsoft CDN? Well, in Sept 2010, only 1 of the top 1000 sites (

According to the research, back in 2010, you need to use the Google CDN, because:

  • 47 of the Alexa top 1,000 include a Google CDN reference.
  • 99 of the Alexa top 2,000 reference jQuery on the Google CDN.
  • 6,953 of the top 200,000 sites include a script reference to some version of jQuery hosted on Google’s CDN

Compelling stuff.

But I was thinking, that’s very US-orientated. For a UK site, with a predominantly UK audience, maybe there’s a variance? Maybe, there’s a secret, commercial, UK-based CDN we don’t know about that everyone in the know is using? Maybe UK sites don’t use CDNs?

So, I tried to re-create the experiment using UK sites. I could only find a good list of the first 100 sites in the UK, from Google. I didn’t want to use Alexa, it’s not great, and it feels to US-based.

I scanned all the sites, counting both how many script tags they had, and how many of those had some reference to “jquery” in the src.

This isn’t totally accurate because I noticed some sites (like the BBC) do some clever version-sniffing before loading locally, but for the most part, it probably is.

All the raw data is available at the end, because it’s very possible I have made some mistakes. If I have, please let me know.

The Results

Only 37 of the top 100 sites have a reference to some sort of JQuery library on their homepage.

Only 4 sites in the 100 reference the Google CDN (,,, And, they all reference different versions!

Almost everyone else hosts their own version of JQuery locally.


This is fairly rubbish news for the rest of us, trying to keep our sites fast. There don’t seem to be many well-pumped CDN resources out there that are being used by the big guys.

Maybe we should start linking to some of the privately hosted libraries of the larger sites, accepting the risk that one day they may move or delete them without notice?

Or maybe, my sample size isn’t big enough? Maybe I need to get a better list, and scale up to 200,000 sites.

I think I might have another look at the Alexa list and see if I can be convinced of its usefulness. If I rerun the tests with better data, I’ll let you know.

Here’s the raw data: Top100Sites-JqueryUse



  1. I have previously been sent a great (if slightly out of date) article which comes to the conclusion that you currently get more benefit from hosting it yourself, since you can combine and minify it with your other static resources and not cause the browser to do a DNS lookup to find the CDN; if it’s on the same domain then the same connection can be used.

    I think.

    Either way, it’s still great for saving bandwidth and giving the end user a version of the file from the closest possible server to them, but this can all be achieved with your own files and a CDN of your own, e.g. Akamai, Rackspace, or Azure.

    Quite interesting stuff. Nice article!

  2. Hi there,

    Thanks for the comment.

    I think one of the big reasons for trying to pick a popular CDN is that you increase the chance of the user already having downloaded the library when they visited another site,before they came to yours. Provided the URLs are identical the browser will notice this and load the file from local cache,which should be much faster.

    Granted, Internet speeds are getting really fast these days,but we have to remember that not everyone is always on the fastest connection all the time. Mobile, Wi-Fi, 3G etc all contribute to slow access speed, and being able to use a cache in these circumstances could really help.

    The other thing I’m not sure about (and would appreciate clarification if anyone knows) is whether there is a limit to synchronous downloads from the same host. So,if I have all my images on my own CDN, would I benefit from having JQuery on an external CDN, because it would allow the browser to synchronously download in a way that might not have been possible if it was hosted on my local CDN?

    In 5 years time I don’t think we’ll have this problem. Either there will be a more established set of core libraries, which the user will pretty nearly always have, or hosting companies will provide automatic pass-through or reverse proxy to their own shared and cached versions so we don’t have to worry about all this stuff.



  1. JQuery - which CDN should you use. Survey Results | Thought Stuff - [...] Which CDN (part 2) 2011 November 2 tags: cdn, jquery by Tom At…

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses cookies to help make this website better. By continuing to use this site we’ll assume you’re OK with that (implied consent).