Find the most reliable and fast public CDNs
cdnperf.com
cdnperf.com
On their about page they write that they're "grateful to Pingdom for providing access to their data" but I can't find anything more about which and how many places they're measuring from or how they combine measurements from different places.
Disclaimer: I work for Google on mod_pagespeed and ngx_pagespeed, and I sit near the people who handle developers.google.com/speed/libraries/ But I don't know anything about how they serve the hosted library traffic.
Chicago, IL
Copenhagen, Denmark
Washington, DC
Milan, Italy
San Jose, CA
Lisbon, Portugal
Toronto, Canada
Las Vegas 2, NV
Amsterdam 5, Netherlands
Strasbourg 2, France
Charlotte 2, NC
I understand that cdnperf data does not reflect real life performance but with our limited resources this was the best we could do.
If you have suggestions on how to make it better please let us know.
If Facebook or Google would be interested to sponsor us then sure, we can add more locations and do more awesome stuff.
In this case if this data is from Pingdom monitoring locations it's particularly bad for estimating performance for a JS library that's likely loaded by end-users who are not browsing the web from well connected data centers.
Agreed that the look is nice and admittedly in the absence of other data I would probably trust this data.
The data is based on Pingdom, yes. Recently we made sure each CDN is monitored from the same group of servers.
It's probably not ideal. It definitely would be great if we could provide some alternative metrics. Ideas are welcome. :)
Something like (untested):
var i = 0;
var urls = [
"http://cdn.jsdelivr.net/jquery/2.0.3/jquery-2.0.3.min.js",
"http://code.jquery.com/jquery-2.0.3.min.js",
...
];
function measureRemaining() {
if(i >= urls.length) return;
var url = urls[i++];
measureLatency(url, function(latency) {
// TODO: post (url,latency) to back-end
measureRemaining();
});
}
function measureLatency(url,responseFn) {
var script = document.createElement("script");
// Bust through browser cache
script.src = url + "?bust=" + Math.random():
var start = new Date().getTime();
script.onload = function() {
var end = new Date().getTime();
var latency = end - start;
responseFn(latency);
};
document.getElementsByTagName("head")[0].appendChild(script);
}
measureRemaining();
In this way, you'll get actual end-user performance from a (hopefully) large number of different network locations. You will probably want to do this in a separate iframe to avoid changing the behaviour of your webpage.Alternatively you can look at what CDNs are hosting the resources and then just use the existing tools to compare the expected performance of each CDN. Of course this comes with a few caveats:
1/ Performance may be different on a given CDN depending on which "package" the customer has purchased. I know was the case ~1-2 years ago for Akamai.
2/ A CDN may perform well for small objects but not for larger objects, make sure you look at representative benchmarks.
3/ JS CDNs using CDN load balancing services like Cedexis mean more work to find all the CDNs that are being load balanced across (jsDelivr uses Cedexis)
(edit: formatting)
That's not the end of the world as long as the CDN DNS + server connection overhead is reliably better than your own but if you already use a decent CDN that's not a given and it might prove a de-optimization if the resource in question can be delivered in less time than it takes to perform an otherwise unnecessary extra DNS lookup and server connection. For high latency networks that's worth monitoring and reviewing closely as it's often a net-loss.
You probably want to devise a scoring function based on likelihood that the resource is loaded already and cost if it is not and rank your CDN options based on that.
As long as this file is in my cache, my browser won’t request it again for a year, independent what happened to it in the meantime.
> or not suffer service interruption
Preventing that is actually quite easy
<script src="//cdn/jquery.js"></script>
<script>window.jQuery || document.write('<script src="local/jquery.js">\x3C/script>')</script>
(a slightly more complex solution would be needed if the CDN is timing out instead of return an error)I would like to see some hard data about the number of web sites a user visit typically to understand how this is a meaningful argument. As of now, I lean toward thinking these CDNs are just yet another way to track users.
Anyways, I block them all by default, and my browsing works just fine.
And, to answer your question, the benefits are substantial, well-documented, and provable on multiple levels.
First off, a CDN (when working properly) greatly improves the average latency for browsing a site, and in some cases even the bandwidth usage. Additionally, use of a CDN can increase the number of users a site can simultaneously serve. The best CDNs can not only withstand but actively deflect various types of DOS attacks. Some can even serve resources like images and video dynamically optimized for the browsing software or device.
There are many more benefits, and believe it or not, a huge percentage of the Internet's web and media traffic flows through CDN services - bypassing all of them is near-impossible (unless you somehow don't use any of the most popular sites and services)
I'm not saying it hasn't happened before, or that it won't happen again, but the CDNs that it happens to and/or don't handle it with the utmost care and expertise do not survive very long.
This could even prevent man-in-the-middle attacks on scripts that otherwise would never expire anyway like described here: http://thejh.net/written-stuff/want-to-use-my-wifi
I actually even always wondered why the default css applied to elements isn't standardised, so pages not containing reset.css or normalize.css-sheets render differently or how certain Javascript methods differ from browser to browser.
But I guess that is a rather different discussion.
So, different browsers would have different libraries included depending on who made them. Possibly different versions too. It would just be very messy, with little reward.
Using the Extensions API I could even stop the DNS check and inject the Javascript before that which was pretty awesome.
My version would simply just look for cdnjs.cloudflare.com links in the source before rendering but could be applied less strictly to other assets e.g. Google jQuery CDN
(I co-started cdnjs.com a few years ago)
No - release management would be a nightmare on both sides (“Is feature X worth not using the built-in previous version?” “Ooops, new jQuery point release. Time to ship a Firefox update!”) and it offers no advantages over simply using HTTPS to prevent injection attacks and Cache-Control headers to allow saving a properly versioned URL forever.
With that being said, I like the look!
It uses instrumented JavaScript on real user's browsers to check latency.
That seems a better method IMHO.
Unfortunately this is hard to implement with our limited resources.