January 14th, 2014
In 2013, MaxCDN joined the jQuery Foundation and stepped up to provide Content Delivery Network (CDN) services for the jQuery CDN at code.jquery.com. 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:
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 code.jquery.com 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.