Facebook Pixel tracking for Egon Expert

Website and HTTP/2 protocol?

Performance is key

Need for speed, we all want everything faster & better. The same applies to websites and users expectations. They don't want to wait for the web page to load, they want their user experience (UX) to be smooth, web content to be served without delay. Latency is killing your conversions!

Amazon found every 100ms of latency could cost them 1% in sales. For Google delay of 0.5s when displaying search page results can case 20% of traffic drop.

Speed matters for everyone, for your users and even for Google. Slow loading websites are getting penalise by Googles algorithms which decides how your websites ranks in their search page ranking.

There is no reason for websites to not use HTTP/2. There are too many benefits and effort to enable it by your server admin being so little, is a must to have for modern web development.

Performance being hot topic for Google, it's them who first start working on improvements for HTTP/1.1 protocol called SPDY (prenounced SPeeDY). First new protocol draft has been published on 11th November 2009. Main goal for SPDY was to reduce latecy for web pages. HTTP/2 is a successor of SPDY which now is deprecated and should not be used.

What is HTTP/2?

From Wikipedia:

HTTP/2 (originally named HTTP/2.0) is a major revision of the HTTP network protocol used by the World Wide Web. It was derived from the earlier experimental SPDY protocol, originally developed by Google. HTTP/2 was developed by the Hypertext Transfer Protocol working group httpbis (where bis means "second") of the Internet Engineering Task Force. HTTP/2 is the first new version of HTTP since HTTP 1.1, which was standardized in RFC 2068 in 1997. The Working Group presented HTTP/2 to IESG for consideration as a Proposed Standard in December 2014, and IESG approved it to publish as Proposed Standard on February 17, 2015. The HTTP/2 specification was published as RFC 7540 in May 2015.

According to W3Techs, as of July 2018, HTTP/2 is used by 27.8% of all the websites and growing.


Website benefits of HTTP/2

There are two main benefits of HTTP/2 protocol:

  • decreased latency and improved page load
  • increased security (enabling TLS support is highly advisable and pretty much enforced by modern web browsers if HTTP/2 is in use)

Beow image, greatly shows how multiplexing works in HTTP/2, where single TCP connection can be used to serve multiple content. In HTTP/1.1 single connection per resource has to be in use adding extra overhead due to TCP round-trips.


HTTP/2, from web development perspective

  • binary protocol, opposed to HTTP/1.1 which is text-based

    Data is exchange in binary format, which is more "machine-friendly" which, in general means better performance

  • multiplexing

    Multiple resources can be requested via single TCP connection

  • headers compression

    Large amount of data can be included in HEADERS

  • using server push

    Server can decide which resources (images, css, js) browser may require and can "push" them to client, without them being requested. There is a potenial risk of overloading client with data it may no need.

How to enable HTTP/2 protocol

All major web servers now supports HTTP/2 out-of-the-box but some features may be available from certain versions only.

nginx supports HTTP/2 since version 1.9.5. htpp2_push from version 1.13.9. For Ubuntu this is availble from 18.04 LTS as version 1.14.0 (if you planning to upgrade from 16.04 LTS you may need to wait till end of July 2018 s direct upgrade is not yet available). Debian will package that version (or higher 1.13.12) with upcoming Debian 10 aka Buster.

Apache supports HTTP/2 as mod_http2 since version 2.4.17. H2PUSH is available from version 2.4.18.


To enable HTTP/2 on Apache web server

  • enable mod_http2 module
  • add that either to server config (for global support) or into selected VHost configs
Protocols h2 http/1.1


To enable HTTP/2 on your nginx web server, add that into your "server" configuration:

listen 443 ssl http2;

Useful links:

Updated 7th July 2018 by Egon Expert Team

Posted in Web Development on Jul 07, 2018