Tell HN: Catalog of JavaScript libraries and CSS resources hosted on public CDNs
cdncatalog.com
cdncatalog.com
Assuming this is true, why would someone use the Google API Loader javascript call ("google.load") instead of linking to the file directly? Linking directly allows the browser to use its cache, while using google.load needs to make an external call to Google, bypassing a big benefit of the caching.
It depends on the CDN and what cache information it returns. I'm not going through all the links and verifying that they all return correctly. I do recall Yahoo's YUI documentation page promising the use of far-future Expires which means that the browser very likely never even hits the CDN, but nothing stops the CDN from using E-Tags instead, which is still pretty fast but does manifest as a hit on the CDN they could track. That said, it's entirely possible that every link there uses far-future Expires.
Personally, I'd just grab the file and use far-future Expires myself. If you've got a web application that uses code that way, odds are this is not going to be your bottleneck anyhow; far-future Expires just as thoroughly fails to hit your server as it fails to hit the CDN.
Content-Type: text/javascript; charset=UTF-8
Last-Modified: Tue, 09 Feb 2010 23:05:02 GMT
Date: Mon, 01 Mar 2010 00:09:20 GMT
Expires: Mon, 28 Feb 2011 21:55:22 GMT
Cache-Control: public, max-age=31536000
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
Server: sffe
Content-Encoding: gzip
X-XSS-Protection: 0
200 OK
It looks like Google is setting an expires for 1 year in the future, meaning (I believe) that the browser will use the cached copy. So, by using these libraries, you have a decent chance that a brand new visitor will arrive with a warm cache, thereby speeding up that initial page load (and first impression!) a tiny fraction.If I'm signed in, doing monetary transactions, I don't want to deal with any other domain but the primary.
All using a CDN for JS libraries does is have the same exact code get to the user faster and not eat your bandwith. Unless the CDN threw some extra code in, which someone would eventually notice (seriously marring the company's reputation), it doesn't send any info to the company hosting the code.
But it is a good point. You should make sure you really trust the company hosting the code for you.
Edit: Oh, right. When I read the comment I was thinking more of it letting them steal all of the info on the page, or something, which would be doable if they inserted extra code.
Stealing info from the page is still possible. It would be hard to crowd-source the detection of such things if they were either: 1) randomly inserted into <1% of all requests; 2) they were targeted at specific IPs/IP ranges; or 3) they were targeted at requests coming from specific sites.
I always assumed that the additional client side DNS lookup
would eliminate the increased bandwidth advantage that the
CDNs have
CDNs offer a bit more than bandwidth advantage.
First, if you have visited a site which used one of these CDNs already it most likely means that your browser won't even send a request for the resource (if CDN sets expire time into the future).
Second, even if this will be the first request for a resource it helps to work around the "connections per hostname" limitation in browsers. Let's say your browser allows 4 connections you will be able to fetch four resources in parallel.
Using CDN (with a different hostname) allows you to circumvent that. Then your are limited only by total number of connections browser allows and those numbers differ by order of magnitude: 2(IE7) to 6 (IE8, lates FF and Chrome versions) connections per hostname vs. 20 (Opera) to 60 (IE, Safari, Chrome) total connections.Check out http://www.browserscope.org/ — it may give some ideas why Chrome is so fast :)
http://yuiblog.com/blog/2007/04/11/performance-research-part...
Disclaimer: I work for Y!
That is the only time it has happened, but this is what makes me fear being fully dependent on these CDNs. So be advised: add a fallback mechanism.
I think that Google and others(Microsoft,Yahoo) should give free access for more public libraries. So we can all benefit from that.
Edit: I assume the plan is to keep this list updated with the latest version of each lib. (?)