When browsing the internet there is an exchange between client and server, that is, the user’s web browser sends a request for access to a web server, and it responds by sending the requested content. This data exchange is done through the hypertext protocol, also known as the Internet Protocol (HTTP).
With the passage of time and the evolution of the internet, the communication needs between client and server have been changing, being now much more demanding. For this reason, the HTTP protocol has been changing its versions to adapt to the needs of each moment, until reaching the current version HTTP2.
Next, we will see what the HTTP2 protocol is, what are its most important characteristics, and how it can be implemented.
What is HTTP2?
HTTP2 is the new version of the HTTP internet protocol ( Hypertext Transfer Protocol ) through which browsers, web servers communicate and other network devices. This version is intended to solve many of the problems of Internet browsing and access, where users access the network from a wide variety of devices (computers, mobile phones, tablets, smart TVs …), the number of users who use The internet has increased notably, and the size of the files or packages that are exchanged is increasing.
Among many of the advantages provided by the new hypertext transfer protocol, we can highlight the increase in the transfer speed between client and server.
Over time the HTTP protocol has varied in different versions:
- The year 1991. HTTP 0.9.
- The year 1996. HTTP 1.0.
- The year 2001. HTTP 1.1.
- The year 2016. HTTP 2.0.
HTTP2 VS HTTP 1.1
HTTP2 is an update of HTTP 1.1 so it retains many of its characteristics, providing new functions that adapt it to the current communication and transfer needs in networks and the Internet.
HTTP2 VS SPDY
SPDY is a protocol developed by Google in 2010 with the aim of improving the HTTP protocol to have better performance in requests and responses between browsers and web servers. It was focused on reducing latency through TCP and on compressing the information sent.
HTTP2 is based on SPDY, implementing new improvements, so Google itself has abandoned SPDY in favor of HTTP2.
HTTP2 main features
With HTTP2 the operation will be the same, a user makes the request for access from their browser, and the webserver will respond to that request through the new protocol, although with a series of differences or nuances.
A single connection
When establishing a connection between client and server through the HTTP 1.x protocol, several TCP connections are required simultaneously. Now, with HTTP2 only a single connection is necessary to be able to make multiple requests and receive multiple responses (as it is done in parallel).
Deletion of redundant information
The client, when sending requests to the server, no longer needs to wait for a response before sending a new request. With multiplexing, HTTP2 allows several messages to be sent and received at the same time, which achieves optimization of the transfer, improving many important factors such as speed, and avoiding common HTTP problems such as overload of the servers.
Server Push Service
The HTTP2 server push service avoids many unnecessary requests from the client. When a request is made, the server itself sends the files requested in it, but it also sends other files that it considers necessary to display the content, preventing the browser from making new requests for it.
This feature of HTTP2 is the key to free web servers from a lot of work, considerably reducing the number of requests they receive.
The requests made by a client to a server usually contain the same header, so that information is constantly sent repeatedly (redundant information).
HTTP2 solves this problem by compressing the headers with the HPACK algorithm, which In addition to reducing the size of the headers, it eliminates redundant data and helps prevent possible vulnerabilities (security component).
In the responses sent by a web server, there are components that are more important than others, so it is interesting that these take precedence. HTTP2 assigns a priority to each fragment that is sent in a response, thus prioritizing the data received by the client in order of importance.
Transfers in HTTP are made in text format, now happening in HTTP2 to be done in binary format, which reduces errors and allows much faster and efficient processing of the exchanged data.
What are the benefits of using the HTTP2 protocol
When using the Internet protocol in its HTTP2 version, a series of very interesting benefits are produced, among which we can highlight:
1. Improve loading speed
The main advantage of the HTTP2 protocol, especially at the user level, is that the loading speed of web pages is increased.
As we saw previously, many of the characteristics of HTTP2 have a direct impact on web speed, such as header compression, multiplexing or prioritization of the transmitted fragments, causing less time to be lost in the transfer and that the content of the webs reaches the browser before.
2. Increase performance on mobile devices
Today users massively use mobile devices such as smartphones and tablets to surf the internet and make online purchases. The new HTTP2 improves performance on these devices by being able to decrypt new (more complex) coding languages more quickly and efficiently.
3. Decrease in internet costs
In normal Internet browsing, the information does not pass directly from client to web server, but passes through a series of intermediaries or intermediate servers. This has an economic cost that is reduced with the HTTP2 protocol since the data and requests that are transferred and made are reduced.
The end result is that Internet providers see their costs lowered, being able to offer faster access rates at a lower cost for the user.
4. Increased security
One of the issues that most concerns users, companies and governments is the security of information transmitted over the internet. The HTTP2 protocol includes mechanisms to increase network security, mainly in two aspects:
- It is based on binary code (ones and zeros) instead of text like HTTP, which allows protecting the exchanged data in a more efficient and secure way.
- HTTP2 adds a security layer TSL1.2 that improves the encryption of personal and sensitive data.
How to implement HTTP2?
HTTP2 is backward compatible with HTTP in relation to applications and web content, so it will not affect the web browsing that the user experiences, except in a notable improvement in performance.
The web browser must be compatible with HTTP2 to be able to use this transfer protocol, something that is not a problem since the latest version of the main web browsers already are (Edge, Opera, Firefox, Chrome or Safari, for example).
As for the servers, it is necessary to carry out a series of implementations and technical configurations to be able to work with the HTTP2 protocol, something that most web servers already have today.