A lot of the web still uses the HTTP1.1 protocol, HTTP1.1 has a new successor which provides many benefits over HTTP 1.1 , this blog post will explain the benefits of HTTP 2.0 so that you can move your webservers over to HTTP 2.0
Benefits of HTTP 2.0
HTTP 2.0 was designed to lower the latency of websites to improve page load speeds. It does this using the below features:
One TCP Connection
HTTP 2.0 uses one TCP connection per domain to transfer resources from your servers to the browser, whereas HTTP 1.0 uses a TCP connection for each resource.
This means that for a simple website having 5 scripts , a couple of images and a css file, HTTP1.1 would open 8 TCP connections to get the resources whereas HTTP 2.0 would use open only one.
To overcome the above multiple TCP connections, you would combine multiple script files together and send it as one request if you where using HTTP 1.1, But if you use HTTP 2.0, you don’t need to do this anymore.
HTTP 2.0 is binary
HTTP 2.0 uses a binary protocols which are more efficient to parse, more compact so HTTP 2.0 use less bandwidth to transfer the same amount of data, and binary is also much less error-prone compared to textual protocols like HTTP/1.0
HTTP 2.0 is multiplexed
HTTP 2.0 requests and responses are multiplexed. This means that
multiple request and response messages can be sent and received at the same time.
HTTP 1.1 is not multiplexed so you send a request for a resource and then wait for the response before requesting a new resource, this can cause issues with a resource blocking other resources from being requested which is not an issue with HTTP 2.0
Header Compression
HTTP 2.0 compresses headers as well as the content of a request/response. This means that we now use less bandwidth to transfer data between server and client leading to quicker page loads.
Server Push
One of the more advanced advantages of HTTP 2.0 is server push where your web server can push resources to your site before being explicitly asked for them.
If you consider a webpage, normally, the browser requests the page, it receives the page from the server, parses the received HTML and then requests the additional resources like the images and scripts found in the HTML. With HTTP 2.0 Server Push, the server can send the additional resources along with the initial HTML page, thereby saving lots of time and loading your website quicker.
Enable HTTP 2.0
You need to configure your webserver to use HTTP 2.0, no changes are required client side. HTTP 2.0 can be enabled in apache webservers using the mod_http2 module , for nginx you can follow this tutorial. Many other web servers also support HTTP 2.0, you can find out how to enable them online.
Check If HTTP2.0 is enabled
Once you have setup your webserver to use HTTP 2.0, the simplest way to check if you site is using HTTP 2.0 is by looking at the network tab.
To do this, on chrome, open a new tab, press F12 , next click on the Network tab, next type in your website url and hit enter, the network tab will record browser requests and will show list the resources being loaded. If the Protocol lists ‘h2’ then the resource is being loaded over HTTP 2.0