For 3.5 years, we have been able to use the HTTP protocol, which is marked with the number 2. In the network you can find a lot of information that encourages its use. However, we will also find opinions undermining the advantages of the new solution. Where did these doubts come from? In the following article we will try to think about the advantages and disadvantages of HTTP/2, whether raised doubts are justified and if it is worth using in your applications.
HTTP/2 what is it?
Let’s start from the beginning. Just for the record, the HTTP protocol is largely responsible for communication at the browser-server level. RFC (collection of technical and organizational documents describing the subject) for version 1.1 was officially published in June 1999. HTTP/2 is not a new hypertext communication protocol – it is a newer version of the HTTP/1.1 until now used and is compatible with it. Based on this compatibility, we have previously used methods (GET, POST, PATCH, etc.), well-known status codes of responses (200, 404, 503, etc.) and all semantics left unchanged. This means that the appropriate reconfiguration of the server and minor changes in the application will allow us to go as smoothly as possible to use the new version of the protocol.
What introduces HTTP/2
What changes the new standard introduces and what we get at our disposal. The developers of HTTP/2 prepared it based on the protocol proposed by Google – the SPDY protocol. The main changes introduced by HTTP/2 in relation to HTTP/1.1 are:
· Obligatory encryption
· One permanent connection between the user’s browser and the server, active until leaving the site
· Multiplexing – performing multiple queries to the server at once (you can simultaneously download html, js, css, photos, etc.)
· “Push” notifications
· Prioritization – the server has the ability to give higher priority to selected resources
· Binary HTTP/2 protocol – unlike the HTTP/1.1 version which sent commands as TEXT
· Better compression – the size of HTTP headers has been reduced
HTTP/2 is supported by all new browsers as well as the most popular server software (Apache, nginx, etc.), so it can be relatively easily implemented in your application.
Why introducing HTTP/2 is a good idea
In my opinion, the implementation of HTTP/2 is a good idea for several reasons. The most important thing is that our applications should start to load much faster due to one permanent connection between the browser and the server, as well as parallel loading of resources. This should be particularly noticeable in pages rich in js files, styles and images. Of course, so far we’ve dealt with this in a better or worse way, merging and minifying files accordingly. However, it is worth using the possibilities that HTTP/2 gives in this respect.
Using HTTP/2 will also make applications much safer, because the protocol enforces the use of encryption. Caring for the safety of users of our applications, in today’s time should be a standard. The other feature does not introduce spectacular changes anymore, but if you get them additionally with HTTP/2 enabled, why not use them.
When introducing HTTP/2 may not be a good idea
Now maybe a bit about the doubts that may arise. The pages load faster, it’s true. However, in some cases – especially where there is a lot of network traffic – it can be associated with increased server load. Today’s machines are definitely better than those used a few years ago, but you should keep this in mind and monitor whether the introduction of the new version of the HTTP protocol did not have a different effect than expected.
There are also situations in which we do not require encryption enabled, and we even care about disabling it, for example in multimedia streaming services. HTTP/2 obliges us to use encryption. In such special cases, use HTTP/2 will not be the best solution.
Analyzing articles in the network, you can also find opinions of specialists, indicating that the protocol lacked many changes that could be expected with the new version. For example, this approach is presented by Poul-Henning Kamp in the article. He suggests that the new version should expect better architecture, greater privacy protection, less equipment load. Kamp indicates that HTTP / 2 architecture looks weak, inconsistent and too complex, violates layer separation and is generally unfinished. Perhaps these comments are correct, but the most important for the user is whether the application will work simply faster.
Summary
The HTTP/2 protocol is not a breakthrough change, but you can expect that by implementing it in your applications you will feel the difference. For sure it will force us to take care of encryption, which already seems to be a strong advantage. The cost of implementation is usually not large. It requires you to reconfigure the application to use encryption, the appropriate setting of the web server – to force HTTP/2 usage on it, and if you do not have it yet, purchase the ssl certificate. In my opinion, it’s worth trying HTTP/2 to enjoy a faster and more secure application.
Leave A Comment