jQuery’s Content Delivery Network: You Got Served! (2024)

Posted on January 14, 2014 by Dave Methvin

jQuery’s Content Delivery Network: You Got Served! (1)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:

#File nameHits
(billion)
Size
(terabytes)
1jquery-latest.js6.36404.65
2jquery-1.9.1.min.js5.93193.96
3jquery-1.7.2.min.js4.95154.50
4jquery-latest.min.js4.45116.08
5/ui/1.10.3/jquery-ui.js4.18484.58
6jquery-1.9.1.js2.45178.54
7jquery-1.10.1.min.js2.2771.62
8jquery-1.7.1.min.js2.2678.05
9jquery-1.4.2.min.js2.0739.80
10/ui/1.10.3/themes/smoothness/jquery-ui.css1.559.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 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.

  1. jQuery’s Content Delivery Network: You Got Served! (2)Roger on January 14, 2014 at 2:56 pm said:

    Those numbers are insane! Do people run without caching?

    I’ve found the jQuery CDN is relatively unknown and most people are still using Google and MSFT CDN endpoints. It’s hard to believe the jQuery CDN numbers are so high given that there.

  2. jQuery’s Content Delivery Network: You Got Served! (3)Justin Dorfman on January 14, 2014 at 5:28 pm said:

    @Roger I can confirm the numbers are indeed real. It makes me wonder how many requests Google and Microsoft handle. I really wish they were more transparent with that data.

  3. jQuery’s Content Delivery Network: You Got Served! (4)John on January 15, 2014 at 12:19 pm said:

    What’s the advantage of using the code.jquery.com CDN instead of Google’s CDN? A significant downside is that code.jquery.com’s SSL configuration is currently insecure. According to https://www.ssllabs.com/ssltest/analyze.html?d=code.jquery.com it is supporting anonymous (insecure) cipher suites, resulting in a grade of F. On the other hand, Google’s CDN domain gets a grade of A: https://www.ssllabs.com/ssltest/analyze.html?d=ajax.googleapis.com

    The EFF has written extensively on the importance of (actually secure) https connections, and is publicly keeping track of progress (see https://www.eff.org/deeplinks/2013/11/encrypt-web-report-whos-doing-what for example).

  4. jQuery’s Content Delivery Network: You Got Served! (5)Justin Dorfman on January 16, 2014 at 1:05 pm said:

    @John Thanks for bringing this to our attention. I will be talking to our engineers today to see how we can fix this.

  5. jQuery’s Content Delivery Network: You Got Served! (6)Matt on January 17, 2014 at 6:35 am said:

    I’ve been running some performance testing on gtmetrix.com
    It has a few advisories regarding using code.jquery.com hosted resources

    it asks for :
    Specify a Vary: Accept-Encoding header
    The following publicly cacheable, compressible resources should have a “Vary: Accept-Encoding” header;

    Is this configurable by me in my htaccess, would you need to make the changes?
    I’ve checked the asp.net hosted version and that does not give a vary accept advisory on gtmetrix

    And Minify JavaScript
    Minifying the following JavaScript resources could reduce their size by 87B (1% reduction)

    I know it’s under only a few bytes, but doesn’t every byte count, particularly when serving a large volume of data from various sources

    Thanks

  6. jQuery’s Content Delivery Network: You Got Served! (7)John on January 18, 2014 at 12:38 am said:

    @Justin Sure thing, hope the SSL gets fixed. Should we keep an eye on the comments here for updates?

  7. jQuery’s Content Delivery Network: You Got Served! (8)gkumar on January 18, 2014 at 1:00 am said:

    Hi,
    Instead for server 404.65 TB of jquery data, Why can’t it be servers thru web browsers iteslf ?
    Why don’t we load all the popular js f/w bundled inside bowser and the html file refer it locally?

    Is it not possible; un necessary wasting 404.65 TB of bandwitdth !!!

  8. jQuery’s Content Delivery Network: You Got Served! (9)Justin Dorfman on January 20, 2014 at 12:45 pm said:

    @Matt I will talk to the jQuery infrastructure team about the Accept-Encoding header. It is a very simple fix that I wrote about last year (http://j.mp/1fRJMDJ).

    @John Yes we will update this thread as well as our blog. We are testing the new ciphers this week to make sure performance isn’t hindered in any way.

  9. jQuery’s Content Delivery Network: You Got Served! (10)Justin Dorfman on January 20, 2014 at 1:47 pm said:

    @Matt worked with the infrastructure team and “Vary: Accept-Encoding” header is now available on all assets.

    curl -I code.jquery.com/jquery-1.10.2.min.js
    HTTP/1.1 200 OK
    Date: Mon, 20 Jan 2014 18:47:22 GMT
    [clipped]
    Vary: Accept-Encoding

  10. jQuery’s Content Delivery Network: You Got Served! (11)Justin Dorfman on January 20, 2014 at 8:03 pm said:

    @John we updated our ciphers and now are getting A’s across the board: https://www.ssllabs.com/ssltest/analyze.html?d=code.jquery.com

    Again thank you for letting us know.

  11. jQuery’s Content Delivery Network: You Got Served! (12)John on January 21, 2014 at 7:18 pm said:

    Great news, thanks for the update, @Justin! Wonderful how quickly this was fixed.

  12. jQuery’s Content Delivery Network: You Got Served! (13)Matt on January 22, 2014 at 8:51 am said:

    @justin

    Thanks to both you and the infrastructure team for the update. It works perfectly.

    Was there any thoughts on additional minification?
    I think it’s to do with the comment tags on line 1 and 2

  13. jQuery’s Content Delivery Network: You Got Served! (14)Chris Ueland on January 23, 2014 at 1:30 am said:

    John & Matt-

    we’d like to send you guys some swag. Can you hit me up via on twitter DM? @ChrisUeland

    Thanks!
    -Chris

  14. jQuery’s Content Delivery Network: You Got Served! (15)Justin Dorfman on January 24, 2014 at 5:31 pm said:

    @Matt we just host the files that are given to us. I assume you are talking about this line:

    `/*! jQuery v2.1.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */`

    That should stay IMO to give the authors credit for their work as well as state the license agreement.

  15. jQuery’s Content Delivery Network: You Got Served! (16)dmethvin on January 24, 2014 at 5:34 pm said:

    @Matt, the copyright notice should stay. It’s not a lot of bytes.

  16. jQuery’s Content Delivery Network: You Got Served! (17)Matt on January 28, 2014 at 8:43 am said:

    @justin and @dmethvin
    Hey, sorry I meant can it all be merged to one line, rather removed?

    Thanks

  17. jQuery’s Content Delivery Network: You Got Served! (18)dmethvin on January 28, 2014 at 1:41 pm said:

    I suppose it could be, but it’s only using one extra character.

  18. jQuery’s Content Delivery Network: You Got Served! (19)PhistucK on February 1, 2014 at 1:18 pm said:

    The numbers seem to indicate not enough caching is happening. Really, they are too huge to be true, something is off or wrong here.

jQuery’s Content Delivery Network: You Got Served! (2024)
Top Articles
Latest Posts
Article information

Author: Aron Pacocha

Last Updated:

Views: 6255

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Aron Pacocha

Birthday: 1999-08-12

Address: 3808 Moen Corner, Gorczanyport, FL 67364-2074

Phone: +393457723392

Job: Retail Consultant

Hobby: Jewelry making, Cooking, Gaming, Reading, Juggling, Cabaret, Origami

Introduction: My name is Aron Pacocha, I am a happy, tasty, innocent, proud, talented, courageous, magnificent person who loves writing and wants to share my knowledge and understanding with you.