I've recently spent more time using H2O over nginx, mainly because of its more complete support of HTTP 2 (push, cache-aware push, ..) but also out of the box support for brotli compression and mruby (think lua landscape for nginx). Even though nginx made it easier to build and ship third party modules separately, I feel like the module community (as well as distro maintainers/packagers) haven't followed suit. There's obviously pre-baked packages like openresty which has lua world, but then there's no brotli.
My web dev company now has a few small clients on h2o for the same reasons. It gives us a chance to try h2o out without any downfall. Still very early but loving it.
The nginx brotli module is very easy to build, I usually build my openresty with brotli and nchan as add in modules and have never encountered any issues.
Just a heads up, we tried to enable H2 with haproxy 1.8.3 last week and had to roll it back because of a Firefox bug. I believe it's this one, which doesn't seem to be getting much attention: https://bugzilla.mozilla.org/show_bug.cgi?id=1427256
On that bug, it looks like the reporter has yet to give an update detailing what the bug actually is (the connection header is a mislead). Their update on Dec 30th says "I'm still working closely together with Willy from Haproxy to determine the actual root cause of http2 failures in Haproxy which only seems to affect Firefox". Without information on the actual fault, it seems like there's little the Firefox developers can do. It could easily be a Haproxy bug.
Please correct me if I'm wrong in anything I say here. I haven't had any real-world deployment experiences with HTTP 2.0.
Every time I've tried looking into it, I've found it underwhelming. Infrastructure support and tooling is still heavily lacking as far as I can tell. To really take advantage of server push it seems like you'd need to have really good build tools available.
Don't you risk sending useless data with server push? How do you handle cached resources? Just because a view depends on some resources, it doesn't mean you always need to send em down to the client.
Having server push doesn't always mean you should avoid bundling and minifying resources. Won't a gzipped bundle typically produce a smaller payload?
Maybe I'm totally wrong or I've misunderstood something, but the general impression I've gotten is that the benefits of server push are a bit overstated. Does anyone have links to resources which discusses these issues in depth?
Most of the discussion surrounding H2 PUSH is concentrated on the single use case of static assets. It's true that this one is difficult, but there are other use cases.
For example, say you had a chart on your page that is generated with JavaScript. That JavaScript makes an API call to get data. You can go ahead and push this data when the page is requested. Since it's (usually) dynamic you don't have to worry about caching nearly as much.
This type of thing is extremely common, but when it comes to H2 everyone is focused on the hardest thing.
> When enabled, H2O maintains a fingerprint of the web browser cache, and cancels server-push suggested by the handlers if the client is known to be in possession of the content. The fingerprint is stored in a cookie...
That sounds interesting solution.
Actually it looks like this tool along with nginx pagespeed would work well and require no changing in build tools.
Nginx pagespeed supports parsing and optimizing the html (and linked resources), including inserting prelink headers. Which will now get pushed. It requires no change in build process.
> Won't a gzipped bundle typically produce a smaller payload?
With http2 it's better to unbundle these days as the best reason for bundling was to not create new tcp connections which require ramp up time to be useful. Now with http2 the same tcp connection is used but multiplexed. So the main reason for bundling goes away. As to it producing smaller payloads, it might be the case but not that much smaller that it's worth it since it's the same tcp connection. Better to have it in unbundled then it gets parsed and processed in chunked streams of files. The client is able to use and process the files as they come in without having to load the whole bundle and process at once. Making the site a bit more responsive.
I think, but could be completely wrong, that browsers can reject a pushed resource at the start. Since the "connection" cost for each resource is minimal, this wouldn't be too much of a problem. Someone confirm or deny this.
I think (not sure if this has been agreed as best practice) that you can use cookies to decide which content to push. This should work in most cases - set a cookie that lasts as long as your users' cache, and don't do server push if that cookie exists.
I upgraded my blog's server a few months ago and got HTTP/2 automatically. I didn't change any architecture (still one CSS and one JS files, no pushing), and it definitely feels faster, because (I think) of the multiplexing and the TCP and TLS overheads on the extra connections are gone.
I'm skeptical of not bundling resources "because HTTP/2". I think it's still a good idea to keep good HTTP/1 performance for the 10%-20% of traffic that doesn't support HTTP/2. Even when everyone supports HTTP/2, if you're loading a bunch of other data from the same domain (like images), I'm doubtful that the improvement from unbundling resources would be noticeable.
They might want to consider using clang nullability annotations (_Nullable etc) when compiling on clang. Can use a macro so it becomes a noop when the compiler does not support it. The static analyser would then get a lot of more information to work with, and it also serves as a kind of documentation.
For those interested, I wrote a lengthy blogpost about HTTP/2 a few years ago, detailing the architectural/infrastructure changes needed to support it for your endusers: https://ma.ttias.be/architecting-websites-http2-era/
Are you going to be able to push stuff from your application if using Nginx as a proxy? For example, a dynamic view that includes a css file hosted by nginx.
So you send down some headers in your response which tells the proxy server resources it should push. Pretty elegant, and fails gracefully. I believe this is the same mechanism as other http2 servers.
This doesn't seem to have a level of "cache-aware server push" that h2o (awesome http/2 server) has. Is there any info on how Nginx deals with cached server push?
been testing Nginx 1.13.9 via master branch with my Centmin Mod Nginx stack and HTTP/2 push testing by setting up cache aware HTTP/2 push via conditional preload link resource hints headers which only show up when a cookie is absent https://community.centminmod.com/threads/hurray-http-2-serve...
As more software is adding support for HTTP/2 server push, I hope they'll start supporting a higher-level, implementation-agnostic, declarative way of specifying resources to push, which operates at a layer higher than server config directives.
Google has a dead-simple JSON format [1] for this from 2015.
Most servers just read the preload headers from the backend and use that as a push. That won't work with "HTTP 103 Early Hints" (Since it needs to know what to push before the backend responds), but for now a preload header is a good compromise between ease-of-use and good-enough.
No, new features don't usually get backported to the stable branch.
It will ship with 1.13.9 (mainline) in 6 hours (at the time of writing).
For stable branch, you need to wait until the 1.13 milestone is completed, which according to their roadmap (https://trac.nginx.org/nginx/milestone/1.13) will be completed in 8 weeks.
[+] [-] jbergstroem|8 years ago|reply
[+] [-] youngtaff|8 years ago|reply
[+] [-] sureaboutthis|8 years ago|reply
[+] [-] SahAssar|8 years ago|reply
[+] [-] vbtechguy|8 years ago|reply
[+] [-] linsomniac|8 years ago|reply
[+] [-] ghusbands|8 years ago|reply
[+] [-] x25519|8 years ago|reply
Source: https://bugzilla.mozilla.org/show_bug.cgi?id=1427256#c7
[+] [-] kolme|8 years ago|reply
http://www.wiktorzychla.com/2017/06/http2-keep-alive-and-saf...
[+] [-] TheAceOfHearts|8 years ago|reply
Every time I've tried looking into it, I've found it underwhelming. Infrastructure support and tooling is still heavily lacking as far as I can tell. To really take advantage of server push it seems like you'd need to have really good build tools available.
Don't you risk sending useless data with server push? How do you handle cached resources? Just because a view depends on some resources, it doesn't mean you always need to send em down to the client.
Having server push doesn't always mean you should avoid bundling and minifying resources. Won't a gzipped bundle typically produce a smaller payload?
Maybe I'm totally wrong or I've misunderstood something, but the general impression I've gotten is that the benefits of server push are a bit overstated. Does anyone have links to resources which discusses these issues in depth?
[+] [-] Touche|8 years ago|reply
For example, say you had a chart on your page that is generated with JavaScript. That JavaScript makes an API call to get data. You can go ahead and push this data when the page is requested. Since it's (usually) dynamic you don't have to worry about caching nearly as much.
This type of thing is extremely common, but when it comes to H2 everyone is focused on the hardest thing.
[+] [-] dalore|8 years ago|reply
> When enabled, H2O maintains a fingerprint of the web browser cache, and cancels server-push suggested by the handlers if the client is known to be in possession of the content. The fingerprint is stored in a cookie...
That sounds interesting solution.
Actually it looks like this tool along with nginx pagespeed would work well and require no changing in build tools.
Nginx pagespeed supports parsing and optimizing the html (and linked resources), including inserting prelink headers. Which will now get pushed. It requires no change in build process.
> Won't a gzipped bundle typically produce a smaller payload?
With http2 it's better to unbundle these days as the best reason for bundling was to not create new tcp connections which require ramp up time to be useful. Now with http2 the same tcp connection is used but multiplexed. So the main reason for bundling goes away. As to it producing smaller payloads, it might be the case but not that much smaller that it's worth it since it's the same tcp connection. Better to have it in unbundled then it gets parsed and processed in chunked streams of files. The client is able to use and process the files as they come in without having to load the whole bundle and process at once. Making the site a bit more responsive.
[+] [-] bfred_it|8 years ago|reply
[+] [-] vertex-four|8 years ago|reply
[+] [-] poyu|8 years ago|reply
The point of server to push is to _preload_ content, and reduce the amount of requests, not to reduce total download size.
[+] [-] theandrewbailey|8 years ago|reply
I'm skeptical of not bundling resources "because HTTP/2". I think it's still a good idea to keep good HTTP/1 performance for the 10%-20% of traffic that doesn't support HTTP/2. Even when everyone supports HTTP/2, if you're loading a bunch of other data from the same domain (like images), I'm doubtful that the improvement from unbundling resources would be noticeable.
[+] [-] poyu|8 years ago|reply
Rules of Thumb for HTTP/2 Push
https://docs.google.com/document/d/1K0NykTXBbbbTlv60t5MyJvXj...
[+] [-] carlosvega|8 years ago|reply
https://www.youtube.com/watch?v=0yzJAKknE_k
[+] [-] smartbit|8 years ago|reply
Follow up talk Revisiting HTTP/2 given Jan 31, 2018 https://www.youtube.com/watch?v=wR1gF5Lhcq0 & slides https://www.slideshare.net/Fastly/revisiting-http2-87148462
[+] [-] x25519|8 years ago|reply
[+] [-] jchb|8 years ago|reply
[+] [-] pgjones|8 years ago|reply
(I am the Quart author, thought this would be interesting and relevant).
[+] [-] drcongo|8 years ago|reply
[+] [-] Mojah|8 years ago|reply
[+] [-] ubercow|8 years ago|reply
Are you going to be able to push stuff from your application if using Nginx as a proxy? For example, a dynamic view that includes a css file hosted by nginx.
[+] [-] rictic|8 years ago|reply
> Also, preload links from the Link response headers, as described in https://www.w3.org/TR/preload/#server-push-http-2, can be pushed, if enabled with the "http2_push_preload" directive.
So you send down some headers in your response which tells the proxy server resources it should push. Pretty elegant, and fails gracefully. I believe this is the same mechanism as other http2 servers.
[+] [-] spiderfarmer|8 years ago|reply
[+] [-] mozumder|8 years ago|reply
[+] [-] vbtechguy|8 years ago|reply
works so far but still waiting on bug fix https://trac.nginx.org/nginx/ticket/1478 as Nginx has pushed back 1.13.9 release until next week https://twitter.com/nginx/status/963442197436678144
[+] [-] niftich|8 years ago|reply
Google has a dead-simple JSON format [1] for this from 2015.
[1] https://github.com/GoogleChromeLabs/http2-push-manifest
[+] [-] SahAssar|8 years ago|reply
[+] [-] alwillis|8 years ago|reply
[+] [-] seanwilson|8 years ago|reply
Edit: Oops, I missed out "push" at the end.
[+] [-] crishoj|8 years ago|reply
[+] [-] eicnix|8 years ago|reply
[0] https://docs.google.com/presentation/d/1r7QXGYOLCh4fcUq0jDdD...
[+] [-] ryantownsend|8 years ago|reply
This is specific to H2 Push
[+] [-] therealmarv|8 years ago|reply
[+] [-] moviuro|8 years ago|reply
Server: sure, here's index.html, theme.css, and jquery.js.
Client: hey wait! I didn't ask for... oh, nvm, good call. Now I can display all this without asking you for anything else.
EDIT: See this: https://youtu.be/0yzJAKknE_k?t=30m52s for more details
[+] [-] detaro|8 years ago|reply
Server: "Sure, here is index.html and you'll need style.css as well, so here is a second stream with that"
[+] [-] unknown|8 years ago|reply
[deleted]
[+] [-] unknown|8 years ago|reply
[deleted]
[+] [-] nodesocket|8 years ago|reply
[+] [-] x25519|8 years ago|reply
It will ship with 1.13.9 (mainline) in 6 hours (at the time of writing).
For stable branch, you need to wait until the 1.13 milestone is completed, which according to their roadmap (https://trac.nginx.org/nginx/milestone/1.13) will be completed in 8 weeks.
[+] [-] spectrox|8 years ago|reply
[+] [-] steeve|8 years ago|reply
[+] [-] x25519|8 years ago|reply
Maxim's answer on this issue: https://mailman.nginx.org/pipermail/nginx/2015-December/0494...