Dale Bustad

Embrace HTTP/2 Server Push

HTTP/2 is here and it’s supported by all major browsers on mobile and desktop. But, because of its history, the JavaScript ecosystem is not ready to take advantage. That’s a pity, but it is also avoidable.

H2 brings with it a number of features for improving performance: header compression, request multiplexing, shared compression context.

However, I'd like to focus in on one feature in particular, and how it can make a difference for you: server push.

Server push is a protocol-level feature that allows your server to send additional assets to the client in response to a request. Client asks for A, server knows the client needs B and C as well, the client gets A B and C. Strategically used, this will allow your server to short-circuit the back-and-forth “waterfall” of requests.

This technology has a number of significant implications.

It has the potential to improve performance for single-page applications, especially for clients with high-latency connections (like mobile). It will also make obsolete the bundling strategies used by most modern JavaScript tooling. Code delivery strategies that take advantage of server push could match or outperform specialized dead code elimination (“tree-shaking”) from tools like Rollup and Webpack.

HTTP/1.1 has been in use for over twenty years. That's the era of Netscape 2.0, IE 2.0, Lynx 2.5 (for you grey beards), and the last episode of The Fresh Prince of Bel-Air. Let's bring our bundling strategies into the 20th century.

In this talk, I will:

  • Overview HTTP/2 server push and how it works;
  • Walk through an example that contrasts performance of an SPA loaded via HTTP/1.1 vs HTTP/2 with server push;
  • Summarize the state of affairs for HTTP/2 support on the server-side; and
  • Introduce tools and strategies that can help you take advantage of HTTP/2 server push, without sacrificing the power of your current toolset.
Code of Conduct

We are an inclusive, kind community that is constantly growing. Please find our Code of conduct, and try and make your fellow Cascadians (& fellow programmers) feel welcome!