Let Google Host jQuery
If all you want is the link, here it is, or check the Developer library for all of them:
NOTE: This post is only about WHY you should be using Google’s jQuery CDN. This post was inspired by Dave Ward‘s article, “3 Reasons why you should let Google host jQuery for you,” which deep-dives into various implementations too complex to be covered here.
01. Decreased Latency
A CDN distributes your static content across servers in various, diverse physical locations. When a user’s browser resolves the URL for these files, their download will automatically target the closest available server from that diverse network. Here’s a better explaination from MaxCDN.
In the case of Google’s CDN, what this means any users not physically near your server will download jQuery faster than if you force them to download it from your server which could be located anywhere.
There are a handful of CDN services from hosting providers comparable to Google’s, but it’s hard to beat the price of free and the speed of Google!
02. Increased parallelism
To avoid needlessly overloading servers, browsers limit the number of simultaneous connections. Depending on the browser, this limit may be as few as 2 connections per hostname.
Using Google’s jQuery CDN eliminates at least one request to your site, allowing more of your local content to downloaded in parallel. That means a faster website and faster is always better in digital.
03. Better caching
Last, but certainly not least, is if your users have already cached jQuery from Google’s CDN, they don’t have to load it at all!
If you’re hosting jQuery locally then your visitors must download it at least once. Each of your visitors has probably already viewed sites using identical copies of jQuery, but those copies of jQuery are ignored when they visit your site (different hostnames).
However, when a browser sees references to CDN-hosted copies of jQuery (same hostname), it understands all of those references refer to the exact same file. Thus, it skips downloading it entirely.
CDNs, such as Google’s, creates a potent “cross-site caching” effect which all sites using the CDN benefit from. Since Google’s hosted version of jQuery serves the file with headers that attempt to cache the file for up to one year, this effect truly has amazing potential.
The Proof is in the Pudding
According to a recent study, Google will consume 16.5% of all consumer Internet capacity in the United States during 2008. I think it’s fair to say that they know how to efficiently serve up some content.
So, why aren’t you using Google’s CDN?