HTTP/2 – What is it all about?

HTTP/2 – What is it all about?

April 28, 2018 By Jake

If you have not heard about HTTP/2 yet, you need to get out more often! There have been numerous articles about it, listing the pros and cons. So what is HTTP/2?

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.

Ok, so? HTTP/1.1 permits only one request per connection at a time. Your browser would open between 4 to 8 connections at a time. HTTP/2 permits multiple requests and responses on the same connection at the same time.

Why HTTP1 is slow
Think of it this way. There is only a 1 lane road between you and work. At each end of the road, there is a guy standing with one of those stop signs. They only allow one car down the road at a time. When the car reaches the other end, then another car is sent down the road. The 2 guys decide who goes next and from which end on a first come basis.

Now replace that road with a 4 lane road with 2 lanes going in each direction. That is HTTP/2.

Why HTTP2 is faster
Then on top of it, the data in HTTP/2 is binary which is more efficient than the textual data sent by HTTP/1. Add to that the headers are now compressed (information about the data being sent). Let’s not stop there.

Let’s get rid of the 2 guys controlling entry to the road so the lighter, faster cars can get on the road and get to work faster.

Now before, when you arrived at work, you had to wait for your assistant to get there with your schedule (the scripts and CSS) for the day. Now, your assistant with the schedule is at work before you arrive. This is the push that HTTP/2 can do.

Now the one lane road to work with traffic controllers enforcing first come first serve; is now a 4 lane bidirectional highway with no traffic controllers (Multiplexed and piped).

Your car was upgraded with more horsepower (binary data and compressed headers). And to top it off you can choose to have everything you need to get your work done waiting for you when you arrive (server push).

This is what HTTP/2 does. The increase in speed will vary from system to system, but usually, data arrives 10x faster.

What do you need to get this amazing protocol? First off it is a secure only connection so you will need to get an SSL certificate.

Your server and browser need to support the protocol. So you may need to upgrade your server and/or download the most recent version of your browser.

It must cost a fortune to do these upgrades, right? No, all the server upgrades, your browser upgrade, and the SSL from Letsencrypt is FREE.

So why does my host say it is not available to me yet? Is this in future releases of my server’s operating system?

It is available now and has been for some time now. The problem here is the upgrades to the server.

If you are in a shared environment, there are other users, who for some reason will not upgrade the website or cms they use. The upgrade would break their sites.

The hosting company chooses not to upgrade the server for fear of losing customers who have not updated.

So essentially, if you have been diligent in keeping WordPress and it’s plugins up to date, you get punished by your neighbors on the server. Welcome to shared hosting.

Fortunately, there are hosting companies, that will at no charge, move your account to one of their shared servers that meets the requirements and most likely has HTTP/2 already enabled.

The hosting package may run a few dollars more, but that is understandable. Servers configured with the needed tools will consume slightly more resources. The hosts can not put as many accounts on the newer server.

If you are on a VPS, dedicated, or a VM in the cloud, you should be able to enable HTTP/2 or upgrade your server to the requirements, assuming you keep your CMS (WordPress) up to date.

Now that you have enabled HTTP/2 what is next. Remember all of those hours you spent optimizing your site so could get a higher page speed ranking? Get rid of most of them. In fact, some of them may be counterproductive:

  • Concentrating many images into one is now counterproductive.
  • Concentrating JavaScript files into one is counterproductive.
  • Concentrating CSS into one single file is also counterproductive.
  • Inlining CSS and JavaScrpt is counterproductive.

You still want to:

  • Minify your CSS
  • Minify your JavaScript
  • Use a CDN (most CDNs have already implemented HTTP/2)

Now as a general rule of thumb it is better to have multiple smaller CSS and JavaScript files. Also if one changes only the changed file needs to be refreshed in the client’s browser.

One problem, however, the speed tests that are out there do not test the site using HTTP/2 nor give advice on HTTP/2.   They test the site as if it is on HTTP/1.  Google Lighthouse does test on HTTP/2.  You can search Google for online sites that test the site using HTTP/2.

If you are unsure if your site is already utilizing HTTP/2 you can test it here.