What is HTTP/2 and what advantages does it have? –

Hosting Mautic QuickStart -50% with support in Spanish
24 hours and free training

Send up to 1,000,000 emails/year. Mautic support in Spanish 24 hours, 365 days

Websites have been evolving, now we see sites that load different types of content, such as images, videos, javascript files, etc., however the HTTP protocollittle had changed, it is not until the arrival of HTTP/2 that we see an important change, mainly in performance, to send requests and receive content.

In this article we will see in more detail what this protocol consists of, the advantages it offers and how to check if your site is using it.

REMINDER Before continuing, I tell you that in you already have HTTP/2 enabled by default on all servers (), so you will not have to configure anything so that you can enjoy its benefits.

What is HTTP/2?

This question involves some concepts that we have to be clear about:

What is a protocol?

In this context, we refer to a communication protocol, which is a set of rules that allow two systems to communicate with each other to transmit information.

What is HTTP?

HTTP = Hypertext Transfer Protocol (Hypertext Transfer Protocol for its acronym in English), is the communication protocol that allows the transfer of information through files, usually HTML, on the Internet.

So what is HTTP2?

HTTP/2 is the new version of HTTP, in the following image we see the different versions of this communication protocol over time.

Characteristics of the HTTP/2 protocol

One of the main improvements of HTTP/2 with respect to previous versions is the speed of communication. To achieve this, the HTTP/2 protocol has the following characteristics:

a single connection

With HTTP 1.x loading any item requires multiple simultaneous TCP connections. In the case of HTTP/2, a single connection is used to serve multiple requests and responses in parallel.

Elimination of redundant information

Another feature is the elimination of redundant information and thus avoid sending repeated data on the same connection, thus achieving lower latency.

multiplexing

With HTTP 1.x the browser sends a request to the server and must wait for the response before sending the next request.

See also  support in external templates

In HTTP/2, multiplexing allows several messages to be sent and received at the same time to optimize communication, improving speed and reducing server overload.

Binary Protocol

It’s just that it’s easier for systems to work with binary protocols, as opposed to a text protocol which is what earlier versions of HTTP used. Binary protocols are also simpler and less error prone.

Server Push Service

They are estimates that the server makes to send messages before the client requests it.

The way to act is to send several responses to a single request, that is, in addition to the original request, the server can send additional resources.

A website is made up of dozens of referenced files and that, thanks to the Server Push service, the server sends after receiving a single request, since it assumes that these other files will also be needed, thus avoiding unnecessary requests.

Header Compression

When a client makes numerous requests to the server, the headers barely change from each other, so a lot of redundant information is sent.

With HTTP/2 the headers undergo compression, which results in better response times. The algorithm used for this is HPACK, which is additionally responsible for eliminating redundant header fields and preventing possible vulnerabilities.

Flow prioritization

Some objects that make up the web are more important than others, so we want the most important objects to have higher priority.

An HTTP message can be broken into multiple fragments, either a client request or a server response. It is important to control the order and delay in which these fragments are transmitted.

To control priority, HTTP/2 allows assigning a weight to each fragment (between 1 and 256)

Advantages of using the HTTP/2 protocol

Looking at the above features, we can see that HTTP/2 offers many advantages, some of the main ones are:

Faster loading speed

Unlike previous versions, where the requests are sequential, that is to say that a request has to be completed to send the next one, in the case of HTTP/2 this problem is solved with Multiplexing. This improves the loading speed between 40% and 50%.

See also  alt tag on images

Improvement of web positioning

Although at the moment Google’s algorithms do not penalize the use of previous versions of HTTP, what is known is that they reward sites that have a good loading speed, therefore we can deduce that HTTP/2 is positive for SEO of a website.

In addition, it has been confirmed that as long as the server allows it.

Load prioritization

Before HTTP/2, the files on a website had to be loaded in a certain order, which obviously does not offer a good user experience. However with HTTP/2 all requests are sent over one connection and it is the browser that decides the priority of each file.

Less bandwidth consumption

HTTP/2 compresses the repetitive headers and eliminates redundant information, therefore the data transfer is much less and therefore there is a saving in bandwidth consumption.

Immediate Presentation

With HTTP/2, the server can send unrequested data on its own initiative, assuming that the user will require that data in a future request.

SPDY and HTTP/2

In 2010 Google released the SPDY protocol as a proposal to improve the requests and responses of the HTTP protocol.

It focuses on reducing latency via TCP, as well as compression among other features.

HTTP/2 is based on SPDY, and adds additional improvements, so Google announced that it will drop support for SPDY in favor of adopting HTTP/2

Comparison HTTP1.1 SPDY and HTTP/2

In the following table we see a comparison between the different protocols.

HTTP1.x SPDY HTTP2 No need for SSL, but recommended SSL required No need for SSL, but recommended Slow encryption Fast encryption Very fast encryption One connection per request Multiple requests per TCP connection Multiple requests per TCP connection No header compression Header compression Improved header compression No stream prioritization Basic stream prioritization Improved mechanisms for stream prioritization

The website dynamically displays element loads using both HTTP1.1 and HTTP/2

HTTPS and HTTP/2

HTTPS is a way of encrypting HTTP protocol communications, it basically wraps messages in an encrypted format using SSL/TLS.

See also  remove 'linkedin' icon and design an article

Both, both HTTPS and HTTP/2 complement each other, it is currently recommended to use HTTPS since, in addition to the security advantages, it is also considered by search engines to give
a good score to your site.

Check that your website uses HTTP2

As I had already told you on , all servers already have the HTTP2 protocol enabled by default. However, it also depends on your browser that supports this protocol.

In it you can check the different versions of browsers that support HTTP2. Current browsers already support HTTP/2.

A simple way to check if your website is using HTTP/2 is to use your browser’s code inspector. To open the code inspector you can use:

  • On Mac and Linux: Cmd + Option + i
  • On Windows: Ctrl + Shift + i

You will see that a section will appear at the bottom, from there locate the network tab and then load the website you want to check in the address bar of your browser, something similar to the following image will appear where you can see a protocol column .

If this column does not appear, you may have to enable it. To do this, all you have to do is position the cursor in one of the columns and with the alternate button of the mouse, display the pop-up menu and then enable the column called protocol.

conclusion

Technologies evolve to improve the user experience when browsing the internet, part of this evolution has to do with the speed with which the browser communicates with the server.

The characteristics of HTTP/2 to improve communication speed, such as multiplication, elimination of redundant information, header compression, etc. they represent a major change from the HTTP protocol.

Help us improve our content by sharing your opinion

WordPress technical support at and regular speaker at Meetups and WordCamps in America.

Loading Facebook Comments ...
Loading Disqus Comments ...