jQuery’s Content Delivery Network: You Got Served!

January 14th, 2014

MaxCDNIn 2013, MaxCDN joined the jQuery Foundation and stepped up to provide Content Delivery Network (CDN) services for the jQuery CDN at Files can now be requested through both HTTP and HTTPS (SSL) protocols, either to download to your own servers or to use directly on production web sites. MaxCDN’s infrastructure can reliably deliver jQuery files through a worldwide high-speed collection of servers to minimize round-trip time.

Why a CDN is Useful to Developers

The obvious benefit is that the MaxCDN network is much faster than the average server, and geographically distributed so that round-trip times are kept low. Yet there is another subtle benefit. Many web sites simply serve up all their content (HTML, CSS, scripts, images, and other assets) from the same domain. This can create a bottleneck on both the browser and the server. Downloading content from multiple domains, known as domain sharding, can improve performance. Just remember that as with any good thing, going overboard is a bad idea. Some research shows that just two domains may be the sweet spot. Use a tool like WebPageTest to test your site to get the best results.

Why a CDN is Useful to jQuery Projects

jQuery projects serve out a huge number of bytes, especially on days when a project makes a new release. When developers rush to download the latest version, we want to be able to handle the load. GitHub does a great job of supporting our development cycle and working project files, but it is not designed to serve up billions of copies of our production files. Google and Microsoft also provide CDNs, but it can take several days between the time a project makes a release and the time the files appear on those CDNs. Third-party CDNs also have their own rules about which files can be placed on the CDN, for example they don’t post pre-release versions. The jQuery CDN allows us full control over timing and content.

Serving Billions of Files, Trillions of Bytes

We thought we were serving a lot of files, but some statistics from MaxCDN really drive home the point. In the last five months of 2013, the CDN served more than 82 billion files, exceeding 3.6 petabytes. We sent out enough bytes to completely fill 3,269 1-terabyte disk drives! An average day on the CDN has us serving up about 20 terabytes of data.

Here are the ten most popular files requested from the CDN:

# File name Hits
1 jquery-latest.js 6.36 404.65
2 jquery-1.9.1.min.js 5.93 193.96
3 jquery-1.7.2.min.js 4.95 154.50
4 jquery-latest.min.js 4.45 116.08
5 /ui/1.10.3/jquery-ui.js 4.18 484.58
6 jquery-1.9.1.js 2.45 178.54
7 jquery-1.10.1.min.js 2.27 71.62
8 jquery-1.7.1.min.js 2.26 78.05
9 jquery-1.4.2.min.js 2.07 39.80
10 /ui/1.10.3/themes/smoothness/jquery-ui.css 1.55 9.83

There are some encouraging signs here. Some of the most popular files are the minified files, as they should be for a production web site. It’s also encouraging that recent versions of jQuery Core (1.9.1 and 1.10.1) are high up on the list. That means a lot of jQuery developers are keeping up with the features and bug fixes we’ve been adding.

The most commonly requested file is jquery-latest.js, which automatically updates whenever the jQuery Core team releases a new version. Developers should never use jquery-latest.js or jquery-latest.min.js on a production site, it is primarily meant for testing. Similarly, the full jQuery UI build at position 5 is the latest version, but that file may not be a good fit for production sites needing only a few jQuery UI widgets. A minified copy with just the needed widgets can be built on the download builder page.

Counting on the CDN

Thanks to MaxCDN’s contribution, the jQuery Foundation has a content delivery network that offers reliable high-speed access to all of our project files. The files at serve as the official repository for all jQuery project releases. You can either download the file for local use, or reference our domain directly from your own web pages to take advantage of the CDN and domain sharding.