Last week I updated the backend NGINX web servers to support HTTP/2. Now to find out how much difference it makes.
NGINX first supported HTTP/2 with it's 1.9.5 mainline release back in September 2015 after a alpha patch release in August. At time of writing, the stable version of NGINX is 1.8.1 and does not yet support HTTP/2.
Adding HTTP/2 support was very simple, just one extra word, as noted in the above blog or within the module's documentation.
Firefox 45.0.1 will be used to perform the tests. Firefox is preferable over browsers as it is possible to toggle on and off HTTP/2 and SPDY through the about:config page. To do this, set the value of 'security.ssl.enable_alpn' and 'network.http.spdy.enabled.http2' to false
I will be running the tests on my Lenovo X220
- Intel i7-2640M
- 16GB RAM
- Windows 10 64-bit
Internet is currently a 100/12 megabit cable connection provided by Telstra
To find out quickly a page runs, the built-in Network Developer Tools (CTRL + Shift + Q) in Firefox is able to provide page statistics. On this page, clicking the stats in the bottom right corner will bring up a speed test with and without cache. I will be using this 20 times and get an average number. After each run I will clear all browsing data in Firefox and restart the browser. Nothing scientific happening here :P
Roughly a half-second increase in speed on the home page. Currently this site is being optimised for HTTP/1.1 with techniques such as file concatenation by combining multiple CSS and JS files together. This can hurt performance in HTTP/2 and is not considered a best practice. This practice is favourable in HTTP/1.1 as the browser is only able to open one connection at any time and received sequentially.HTTP/2 allows each request to the server to use its own TCP connection, known as multiplexing, and allows each request to be received in parallel resulting in a dramatic performance gain.
Images from CloudFlare https://www.cloudflare.com/http2/what-is-http2/: