4 ms·
The fallback technique does nothing to mitigate the "It can connect but loading takes forever" case surely.
by points 16y ago
The fallback technique does nothing to mitigate the "It can connect but loading takes forever" case surely.
- Encosia 16y agoYou're correct. That fallback technique mitigates the majority of failure cases though (NoScript, overbearing firewall, blocked regions, etc). The CDN itself being slowly-down is vanishingly rare.
- points 16y agoI don't know, anecdotal evidence here, but the majority of cases I see pages taking a long time to load due to 3rd party js etc, it's waiting for actual data, rather than anything else. The OP said: "and I noticed the render time of my site (and a few others) jump up anywhere between 5x and 100x." Which would indeed suggest that it did load, but at significantly reduced speeds.
- Encosia 16y agoThese highly-available, distributed CDNs hosting static content don't have the same failure characteristics as something like an advertising script or Twitter widget. Where the latter do often hang the page (frustratingly), the popular CDNs that host jQuery aren't prone to that under any but the rarest of circumstances. Maybe unrelated, but you'd be surprised how often the "Waiting for domain.com..." in your browser's status bar is misleading. Interactions between externally referenced scripts, images, and scripts that use document.write can produce "interesting" results in most browsers.
- techiferous 16y ago"The CDN itself being slowly-down is vanishingly rare." Based on...? It happened to me once a few months ago. It was down for hours. The negative impact was very real and painful and in my opinion outweighed the other advantages of hosting using Google's CDN.
- Encosia 16y agoPingdom tested Google, Microsoft, and Edgecast's jQuery CDNs every minute for a couple weeks and found all of them averaged between 100-150ms to download jQuery[1]. Google's was actually the slowest of those, averaging a turtle's pace of ~130ms from all of Pingdom's datacenters. They're all so close that the Google CDN's overwhelming caching advantage should be preferable though. More anecdotally, I've been running a few Pingdom type tests myself for a longer period, using uptime tools on few of my servers and mon.itor.us. Except for that brief outage the morning of May 14, 2009[2], I haven't monitored a net-wide outage or even a 250+ ms slowdown. I'd be genuinely interested in any concrete data to the contrary. [1] http://royal.pingdom.com/2010/05/11/cdn-performance-downloading-jquery-from-google-microsoft-and-edgecast-cdns/ http://royal.pingdom.com/2010/05/11/cdn-performance-download... [2] http://www.zdnet.com/blog/btl/cloudy-day-google-falters-packets-lost-in-key-cities/18064 http://www.zdnet.com/blog/btl/cloudy-day-google-falters-pack...
- techiferous 16y agoJune 18th, 2010 was when Google's jQuery went down for me (and many other people).
- sounddust 16y agoI've thought to myself, "I wish there was a timeout attribute on the <script> tag," about once every few months for the past 10 years. Is there any good reason you can't manually specify how long you want the browser to wait for an external file to load?
- blasdel 16y agoYou can at least control the degree of blocking in the latest Webkit: http://webkit.org/blog/1395/running-scripts-in-webkit/ http://webkit.org/blog/1395/running-scripts-in-webkit/
- eli 16y agoI believe FFox 3.6 supports async attribute as well
- stellar678 16y agoThere's no reason you couldn't code this up in JavaScript: load jquery from google - onload, set flag jquery_loaded settimeout load_locally_if_not_flag 5sec
- toolate 16y agoDon't forget that JavaScript is blocking. You'd need to load the jQuery from Google dynamically by inserting script tags. By the time you've added that, timeouts and fallbacks the amount of inline JS would make hosting jQuery on a CDN pointless.