QUIC – Faster Content Delivery on Layer 4

After HTTP/2, the next come up is QUIC, a new transport network protocol. At the beginning this protocol was designed by Jim Roskind at Google. It was publicly released in 2013 after the implementation and experimentation in 2012. Originally being an acronym for Quick UDP Internet Connections, the Internet Engineering Task Force (IETF) has stated it’s the name of the protocol and not an acronym.

Google has been working for quite some time to speed up network protocols in order to optimize network response times. Now that HTTP/2 has been fulfilling its task of speeding up how HTTP uses TCP and has become the basis for fast TLS connections, QUIC goes one step further by aiming to completely replace TCP.

Before becoming an Internet standard, the mapping of HTTP over QUIC was renamed to HTTP/3 in November 2018 by IETF members after a request by Mark Nottingham, the Chair of the IETF HTTP and QUIC Working Groups. This will be the third major version of the HTTP protocol that allows data to be exchanged on the World Wide Web and will succeed HTTP/2. It will take full advantage of the significant performance benefits that QUIC offers.

.. QUIC and HTTP/3#

Google has found that 75% of all requests are served faster over QUIC and that TCP based websites and content that is streamed will greatly benefit from it. Especially video services like YouTube, where users report 30% fewer rebuffers when watching videos over QUIC. With such big changes it will take time for QUIC to become the most commonly used transfer protocol. At the time of writing this only 2.4% of websites use QUIC.

As a next step, HTTP-over-QUIC has been proposed to the IETF and has been approved as HTTP/3. If the standard establishes itself and other servers implement it, the most frequently used transport network protocol used today, TCP, may be replaced on the web.

Google Chrome Canary is the first browser to support HTTP/3 and since version 7.66 curl also supports it. Support for this new HTTP protocol will be coming later in 2019 to Firefox Nightly. As exerimiation continues and improvements are made you will see the support of HTTP/3 grow.

Summary

How to enable HTTP/2 support in Apache

Ubuntu / Debain

Apache web server distributed in default software repositories of Ubuntu and Debian do not include mod_http2 needed to enable HTTP/2 functionality. You will need to add a third-party package source with latest Apache version that also inludes mod_http2.

    apt-get install software-properties-common python-software-properties
    add-apt-repository ppa:ondrej/apache2
    apt-get update

This will install some utilities (if not installed already) that help us add external PPAs. Secondly, we add the ondrej/apache2 PPA which contains the latest Apache2 builds. Third, we update your systems package information.

    apt-get install apache2
    apachectl -v

This is to upgrade your existing Apache2 version to the latest version. After upgrading, the apachectl -v command will reveal your upgraded Apache version. This will be 2.4.29 or later.

Enable HTTP/2 module

Apache’s HTTP/2 support comes from the mod_http2 module. Enable it from:

a2enmod http2
  apachectl restart

Add HTTP/2 Support

We highly recommend you enable HTTPS support for your web site first. Most web browser simply do not support HTTP/2 over plain text. Besides, there are no excuses to not use HTTPS anymore. HTTP/2 can be enabled site-by-site basis. Locate your web site's Apache virtual host configuration file, and add the following right after the opening <VirtualHost> tag:
  Protocols h2 http/1.1
Overall, your configuration file should look something like this:
<VirtualHost *:443>
  Protocols h2 http/1.1
  ServerAdmin you@your-awesome-site.com
  ServerName your-awesome-site.com
  ...
</VirtualHost>
After the changes, don't forget to reload/restart Apache.
apachectl restart

Push resources

Apache supports HTTP/2 Push feature as well. After enabling Apache HTTP/2, you can add push support simply by setting HTTP Link headers. You can emit them from either/both the Apache configuration file, or from your application.
  Link: </assets/styles.css>;rel=preload, </assets/scripts.css>; rel=preload
Above is an example header that would trigger Apache to push the /assets/styles.css and /assets/scripts.scc files. Refer to your application code on how to emit HTTP headers. If you would like to make Apache add these headers, you can do so like this, using the mod_headers module.
<Location /index.htmll>
  Header add Link "</assets/styles.css>;rel=preload, </assets/scripts.css>; rel=preload"
  Header add Link "</assets/image.jpg>;rel=preload" 

Apache 2.4.27, HTTP/2 not supported in prefork

Starting from Apache 2.4.27, the Apache MPM (Multi-Processing Module) prefork no longer supports HTTP/2. This will be indicated in your Apache error log as follows:
AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
To fix this, select a different MPM: event or worker. We highly recommend you to use the event prefork.
If you are using PHP, it is likely that PHP is integrated to Apache via the mod_php module, which requires the prefork MPM. If you switch out from preform MPM, you will need to use PHP as FastCGI. To switch to php-fpm, you can do as folllwing. Please note that this assumes you have PHP installed from ondrej/php repository on Ubuntu. The PHP package names could be different in other repositories. Change package name and apt-get commands to match your PHP vendor and package manager.
    apachectl stop
    apt-get install php7.1-fpm # Install the php-fpm from your PHP repository. This package name depends on the vendor.
    a2enmod proxy_fcgi setenvif
    a2enconf php7.1-fpm # Again, this depends on your PHP vendor.
    a2dismod php7.1 # This disables mod_php.
    a2dismod mpm_prefork # This disables the prefork MPM. Only one MPM can run at a time.
    a2enmod mpm_event # Enable event MPM. You could also enable mpm_worker.
    apachectl start

HTTP/2 not enabled on older TLS versions

Mozilla Firefox (among other browsers) does not enable HTTP/2 protocol unless the connection is made over TLS 1.2 and using modern cipher suits. This is not a technical limitation, but rather a safety precaution. Make sure your that your site supports TLS 1.2, and modern cipher suits with AES/CHACHA20 with forward-secrecy key exchanges. In turn, Apache does not try to establish an HTTP/2 connection with connections over older cipher configurations either. you can force Apache attempt HTTP/2 upgrade with the following directive, but it will not be as effective because browsers do not support HTTP/2 from their end anyway.
    H2ModernTLSOnly off

https://en.ryte.com/magazine/improve-webpage-load-speed-http-2-beginners-guide

HTTP/2 can significantly improve your website’s page speed because it allows browsers to simultaneously process multiple requests over the same connection. In this article, learn how you can easily improve your site’s load speed with HTTP/2.

..When HTTP was first created, this wasn’t such a big deal. Back then, webpages tended to look like this:

netscape improve webpage load speed improve load speed with HTTP/2 HTTP/2 beginner's guide to improving webpage load speed with HTTP/2

Figure 1: Websites in the age of HTTP/1

That entire webpage consists of two files: the HTML webpage and a single image banner. With dial-up internet speeds being the fastest thing available, website creators couldn’t get very fancy. But with only two files, being limited to downloading one file at a time wasn’t a problem.

Today’s webpages are far more complex. For example:

  • The homepage of amazon.com requires 315 separate requests/files.
  • The homepage of cnn.com triggers 521 separate requests for files.
  • The homepage of ebay.com makes 256 separate requests.

As you can see, it would be very inefficient to download these files one at a time, or even to download 6 at a time. That’s the problem that HTTP/2 fixes.

HTTP/2 allows browsers to simultaneously download multiple files over the same connection. This makes it a lot faster for the user to download all the files needed for a given webpage.

If you’d like a simple (but detailed) explanation of how HTTP/2 works, I recommend An introduction to HTTP/2 for SEOs by Tom Anthony. It’s even got great little illustrations using trucks that help make a intangible concept super-easy to conceptualize and understand:

How HTTP/2 Works, Performance, Pros & Cons and More

HTTP/2 or H2 for short is a major revision of the hyper text transfer protocol that improves the performance of the web. It uses a binary protocol and multiplexing.

In this video I want to go through how HTTP/2 works, its pros and cons and show the performance difference between HTTP 1.1 and HTTP/2

Http/1

request has to wait for a response

And if you used up your connection response you can send anything else.