HTTP vs HTTP2, use HTTP2 connection or not - benefits and support
Not so long ago, a new version of the protocol appeared, which is intended to replace the previous ones. This version is called HTTP2, or rather HTTP / 2 - before that, HTTP / 1.1 and SPDY were mainly used. Accordingly, the option " use HTTP / 2 connection " or with a similar name appeared on many hosting - and many people ask whether to enable it or not.
HTTP Version History
First, let's take a quick look at the previous protocols. HTTP protocol version history:
- HTTP / 0.9 (1990 - 1992) - the first available version of the protocol, contained general rules and regulations for accessing resources on the network;
- HTTP / 1.0 (1996) - continued development of the protocol, many new features and components were added;
- HTTP / 1.1 (1999) - the most popular version of the protocol, persistent connection mode has been added, you can send multiple requests in one connection. With the advent of this version, it became possible to quite simply organize virtual hosting, since the client now has to send data about the hostname;
- SPDY (2012) - revision of the HTTP protocol from Google, which allowed to increase the connection speed. Replaced some parts of the HTTP protocol - connection management and data transfer formats;
- HTTP / 2 (2015) is the latest version of the protocol discussed in this article.
The emergence of a new version of the HTTP protocol was necessary, even despite all attempts to improve the old versions. This was dictated by modern requirements and realities of the Internet. Old versions and modifications were only attempts to adapt to such modern requirements. Therefore, a new version of the protocol was developed - HTTP / 2, which takes into account all the needs of users, browsers, networks, etc.
Quite a lot of discussions and articles appeared on various sites and forums on the question - is it worth using HTTP / 2 or not. Also, as mentioned above, many users ask about the new option in the hosting settings "use HTTP / 2 connection" - to enable it or not. To answer this question, a lot of research has been done by different users to understand what the use of HTTP / 2 actually does.
Benefits of HTTP / 2
HTTP / 2 is a binary protocol, unlike previous versions. This means that data now takes up less space and is processed faster. According to the test results, if properly configured, sites loaded via HTTP / 2 open much faster. Except loading speed HTTP / 2 offers a number of new features that were previously needed. Let's take a look at the benefits of HTTP / 2 :
- automatic encrypt all data ;
- prioritizing requests;
- header compression;
- multiplexing requests - loading multiple elements in parallel, using a single connection;
- support for active PUSH notifications from the server side;
- fix the problem of blocking "head-of-line" protocols HTTP 1.0 / 1.1 and others.
HTTP / 2 support
As for supporting the new version of the protocol, there are no special problems with this - all modern browsers and servers support it. How do I know if a site is running over HTTP / 2 ? This can be done using special sites or, better, on your own - using the developer console in the browser. The picture above just showed how to check the site protocol.
Open a console (usually press F12), go to the "network" tab and refresh the open site. Then the values will appear, right click to show the "protocol" column. This column will indicate the protocol used for each resource on the page, the h2 value is HTTP / 2 . Some resources can be downloaded through one protocol, others through another - the choice of the protocol is made by the browser automatically, to improve the performance of the connection. In this simple way, you can check HTTP / 2 - whether it is in use or not.
Many servers automatically analyze the possibility of using a new protocol for each visitor and transmit data using HTTP / 2, so there is no need to enable this option yourself. In other cases, you can enable HTTP / 2 in the hosting settings or by configuring your server. Accordingly, when developing, you need to take into account the capabilities of the new protocol to build more efficient projects.
Thus, it is up to everyone to enable HTTP / 2 or not , but using the new version of the protocol is more desirable. Sooner or later, it will replace outdated versions, which is already happening quite actively in the present tense.
Latest articles
- 03.04.24IT / Уроки PHP Уроки простыми словами. Урок 3. Все операторы PHP с примерами, с выводом работы кода на экран.
- 02.04.24IT / Уроки PHP Уроки простыми словами. Урок 2. Типы данных в PHP с примерами.
- 02.04.24IT / Уроки PHP Уроки простыми словами. Урок 1. Коротко о языке веб-программирования PHP. Основы синтаксиса.
- 09.11.23IT / Database Errors when migrating from MySQL 5.6 to 5.7 and how to fix them - database dump import failed with an error or INSERT does not work. Disabling STRICT_TRANS_TABLES strict mode or using IGNORE
- 08.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes