News for hackers. Stuff that matters.
Re:Gmail, Google Maps and YouTube had outage issues by jjlane on Tuesday September 12, 2017 @11:50AM (#15228276)
Our site was using hosted libraries, google fonts, and google analytics. All of which seemed to be behind captchas, throwing CORS errors, and 503ing since this morning. Swapped out JQuery cdn for now.
Re:Gmail, Google Maps and YouTube had outage issues by kyrra on Tuesday September 12, 2017 @12:25PM (#15228639)
For something like jquery, you can host locally and fallback to it if the CDN fails.

https://stackoverflow.com/a/1014251

Re:Gmail, Google Maps and YouTube had outage issues by lamlam on Tuesday September 12, 2017 @12:45PM (#15228874)
Loading JavaScript libraries synchronously should be avoided if possible, making the above solution not a great one.
Re:Gmail, Google Maps and YouTube had outage issues by reaperducer on Tuesday September 12, 2017 @12:55PM (#15228980)
Until Google goes down. Which makes it a really great one.
Re:Gmail, Google Maps and YouTube had outage issues by kyrra on Tuesday September 12, 2017 @12:49PM (#15228921)
Is there a better/different way to handle this type of fallback?
Re:Gmail, Google Maps and YouTube had outage issues by lamlam on Tuesday September 12, 2017 @01:48PM (#15229493)
Yes. What you should do is use an asynchronous module loader. There are many small standalone ones like loadjs [1]. But the more widely used tools such as webpack also suppprt this as code splitting [2].

In general you want to avoid sync loads of js assets because depending on how the server serving the asset hangs it can cause the webpage to hang as well. For example, if the server responds with a 404 right away then there are no problems. But if the server does not respond and leaves the connection open the browser will just wait the max time.

[1] https://github.com/muicss/loadjs/blob/master/README.md

[2] https://webpack.js.org/guides/code-splitting/

Re:Gmail, Google Maps and YouTube had outage issues by giancarlostoro on Tuesday September 12, 2017 @01:06PM (#15229081)
Surprised Content-MD5 or a similar spec isn't used by the browser to avoid a web where only Google's hosted solution allows for efficient JS file caching. If you know two files are most likely equal by filename and checksum, you should be able to just reload the cached version, if loading the cached file produces too many errors, try downloading the new one or something, instead of forcing everyone to host it all under the same corp (in this case Google). Oh well.
Re:Gmail, Google Maps and YouTube had outage issues by jjlane on Tuesday September 12, 2017 @12:27PM (#15228669)
damn, never thought to do this. thanks for the heads up.
Re:Gmail, Google Maps and YouTube had outage issues by mholt on Tuesday September 12, 2017 @12:18PM (#15228564)
Having the same problem here! Glad it wasn't just me...
Re:Gmail, Google Maps and YouTube had outage issues by ocdtrekkie on Tuesday September 12, 2017 @12:01PM (#15228387)
Is there a good reason to use these things hosted by a third party source? Libraries are tiny, the fonts can be downloaded from Google Fonts and embedded locally, etc. Even the Google Analytics JS script I presume can be stored and run local.

Shouldn't a goal be to mitigate the number of possible failures which can bring down your site by reducing the number of single points of failure?

Re:Gmail, Google Maps and YouTube had outage issues by bcherny on Tuesday September 12, 2017 @12:07PM (#15228450)
2 reasons:

1. If you're still using HTTP 1.x, sharding assets across origins lets the browser load them in parallel (if set up correctly). You can generally load just 6 assets in parallel per origin, and sharding is a way to get around that limit.

2. A library like jQuery is so popular, and is so often served from googles CDN, that chances are a user already has it in their local cache from when they downloaded it on some other site.

That said, yes - the downside is more surface area that might go down.

Re:Gmail, Google Maps and YouTube had outage issues by dchest on Tuesday September 12, 2017 @12:18PM (#15228569)
2. A library like jQuery is so popular, and is so often served from googles CDN, that chances are a user already has it in their local cache from when they downloaded it on some other site.

Which of these versions do you have cached?

3.2.1, 3.2.0, 3.1.1, 3.1.0, 3.0.0, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.4, 2.1.3, 2.1.1, 2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.12.4, 1.12.3, 1.12.2, 1.12.1, 1.12.0, 1.11.3, 1.11.2, 1.11.1, 1.11.0, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7.2, 1.7.1, 1.7.0, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0, 1.5.2, 1.5.1, 1.5.0, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.2, 1.3.1, 1.3.0, 1.2.6, 1.2.3

Re:Gmail, Google Maps and YouTube had outage issues by castis on Tuesday September 12, 2017 @12:21PM (#15228599)
Asking an annoyed rhetorical question doesn't seem productive to the point you're trying to make here.

As an actual answer, it would be variable proportional to the size of the window between releases mentioned here: https://en.wikipedia.org/wiki/JQuery#Release_history

I'm sure a fair amount of people serve jQuery from a local storage. The usefulness that the user might already have it cached is a non-zero point, no matter how insignificant you may think it is.

Re:Gmail, Google Maps and YouTube had outage issues by adventured on Tuesday September 12, 2017 @12:30PM (#15228706)
Just two versions of jQuery, 1.12 and 1.11, represent approximately half of all jQuery versions in use. The top four most common versions (1.12, 1.11, 1.7, 1.8) represent close to 3/4 of all versions of jQuery in use. Version 3.x and 2.x are hardly being used by comparison to those.

That narrows your suggested problem down dramatically.

Re:Gmail, Google Maps and YouTube had outage issues by kerkeslager on Tuesday September 12, 2017 @12:30PM (#15228705)
How many do you need to make this worthwhile?

The ratio of cost of storing a library versus the cost of GETing a library is very low, so the chances of already having a library cached can be very low for the EV to be worthwhile.

Weighing that against the chance of downtime is a bit more complicated, admittedly.

Re:Gmail, Google Maps and YouTube had outage issues by nix0n on Tuesday September 12, 2017 @01:01PM (#15229029)
Looking at just minified versions from googleapis.com, I have 1.12.4, 2.2.4, 1.8.2, 1.10.2, 1.8.1, 1.9.1, and 2.1.1
Re:Gmail, Google Maps and YouTube had outage issues by s_kilk on Tuesday September 12, 2017 @12:31PM (#15228720)
> You can generally load just 6 assets in parallel per origin

This seems to only apply to Chrome, whereas Firefox will happily download everything as fast as possible.

I know this because I fixed a bug recently where chrome was taking so long to download images that other resources on the page were timing out. No problem in Firefox.

Re:Gmail, Google Maps and YouTube had outage issues by lamlam on Tuesday September 12, 2017 @12:48PM (#15228917)
Last I checked all the browsers had limits [1] when it came to HTTP 1.X.

[1] http://blog.olamisan.com/max-parallel-http-connections-in-a-...

Re:Gmail, Google Maps and YouTube had outage issues by s_kilk on Tuesday September 12, 2017 @02:20PM (#15229908)
The limits in Firefox must be really high then, it was almost funny looking at the difference in behaviour between the two browsers in the situation I was testing.
Re:Gmail, Google Maps and YouTube had outage issues by takeda on Tuesday September 12, 2017 @01:31PM (#15229323)
3. Now 1/3 of pages I'm visiting I need to make request to google because someone wanted to use a 5 lines of JS from jQuery.
Re:Gmail, Google Maps and YouTube had outage issues by hungerstrike on Tuesday September 12, 2017 @12:27PM (#15228665)
> If you're still using HTTP 1.x

Not sure why it was phrased that way but...isn't everybody?

I know that HTTP/2 is released and browsers support it, but I'm fairly certain that next to nobody is actually doing anything with it.

Re:Gmail, Google Maps and YouTube had outage issues by bcherny on Tuesday September 12, 2017 @12:59PM (#15229017)
Google, FB, Youtube, Wikipedia, and HN :) use HTTP2.

I also use HTTP2 at work, and on every personal project. It's supported by every browser [1], and comes with a slew of benefits. It's usually trivial to set up, if you want to give it a shot.

[1] http://caniuse.com/#feat=http2

Re:Gmail, Google Maps and YouTube had outage issues by klodolph on Tuesday September 12, 2017 @12:45PM (#15228877)
It's getting rolled out in a lot of places. I think adoption is somewhere around 17% depending on how it's measured. I started using it for my personal website and it was really easy, the only part I missed was setting a cron job to reconfigure the web server whenever cert renewal went through.
Re:Gmail, Google Maps and YouTube had outage issues by wil421 on Tuesday September 12, 2017 @12:05PM (#15228423)
One reason is that by linking to external libraries your browser most likely has them cached. At least it was the case a few years ago when I was doing web dev.
Re:Gmail, Google Maps and YouTube had outage issues by eric_b on Tuesday September 12, 2017 @12:09PM (#15228470)
I see this argument a lot but I don't think it's necessarily a good one. If a third party CDN goes down, your site is down.

A few extra ms in initial download isn't so bad compared to having your site be completely inaccessible for reasons outside your control.

Re:Gmail, Google Maps and YouTube had outage issues by matthberg on Tuesday September 12, 2017 @12:16PM (#15228549)
When a CDN goes down, that is the time to use local backups. The best policy I've seen is using 3rd party CDNs for scripts like jQuery, ie. common, unchanging resources, yet with subresource integrity checks [0] to make sure it's actually what you are asking for (in case the site somehow gets compromised or returns an error). On top of that to cover for failure, you have a fallback locally hosted copy which is loaded only if the CDN version fails.

[0] https://developer.mozilla.org/en-US/docs/Web/Security/Subres...

Re:Gmail, Google Maps and YouTube had outage issues by wil421 on Tuesday September 12, 2017 @12:18PM (#15228572)
Would those resource checks been done at the client or sever? For example the sever pings the CDN at a set interval and if it's down the sites code is modified to included links to local copies.

Or would you do something in the browser to fetch the local one in case of failure?

Re:Gmail, Google Maps and YouTube had outage issues by omni on Tuesday September 12, 2017 @12:16PM (#15228546)
Why doesn't having the resources cached provide a buffer against short-term outages of the CDN?
Re:Gmail, Google Maps and YouTube had outage issues by hobofan on Tuesday September 12, 2017 @12:23PM (#15228612)
Because normal Cache-Control is only aimed at reducing the amount of data transferred. With newer immutable Cache-Control[0], a CDN going down wouldn't have an effect if you have the resources cached.

[0]: https://hacks.mozilla.org/2017/01/using-immutable-caching-to...

Re:Gmail, Google Maps and YouTube had outage issues by nleach on Tuesday September 12, 2017 @12:22PM (#15228602)
The browser still has to make a request to the CDN to get back an HTTP 304. The goal is to avoid downloading a potentially large payload, not be resilient against connectivity issues.
Re:Gmail, Google Maps and YouTube had outage issues by wil421 on Tuesday September 12, 2017 @12:14PM (#15228530)
Self hosting will probably cause more downtime than if you are using a decent CDN. CDN is just one of many points of failure, I would expect there's a fine balancing act where you could achieve benefits of both.
Re:Gmail, Google Maps and YouTube had outage issues by dom0 on Tuesday September 12, 2017 @12:25PM (#15228638)
By definition, if your site is down, you don't need your assets.
Re:Gmail, Google Maps and YouTube had outage issues by jlgaddis on Tuesday September 12, 2017 @12:18PM (#15228571)
Then why are these sites down?
Re:Gmail, Google Maps and YouTube had outage issues by Asmod4n on Tuesday September 12, 2017 @12:10PM (#15228487)
This is most likely never the case, because there are way too many versions of each library.
Re:Gmail, Google Maps and YouTube had outage issues by tregoning on Tuesday September 12, 2017 @12:10PM (#15228489)
Yes, Google can change the logic for auth, analytics, etc at any time and your local outdated copy will be useless, further I believe it's possible that Google returns different JS depending on the browser that's requesting it in order to keep payloads down and performance high.
Re:Gmail, Google Maps and YouTube had outage issues by jjlane on Tuesday September 12, 2017 @12:08PM (#15228460)
Our GA is setup through GTM now, that is why it's not hardcoded into our head. Really the most important gain we get from hosted libraries is caching. Since any user that has hit a google hosted lib, which is pretty widely used and distributed it allows them to access their cached version instead of sending our another request.
Re:Gmail, Google Maps and YouTube had outage issues by sbov on Tuesday September 12, 2017 @12:04PM (#15228416)
IIRC Google Fonts aren't easy to download because they vary by user agent.
Re:Gmail, Google Maps and YouTube had outage issues by vetinari on Tuesday September 12, 2017 @01:01PM (#15229028)
You can download zip archive of ttfs using the customize tab on the fonts site. Or go directly to the source, and get the git repo.