What is HTTP/2: How It Works and What It Means for the Web?

In 2015, a new version of the HTTP network protocol — HTTP/2 was approved. Now, it is becoming more and more popular: the protocol already supports the Apache and Nginx web servers, Chrome, Firefox, Opera, Edge, and Safari browsers, as well as mobile devices.

The number of HTTP/2 services and sites is constantly growing. In the near future, the Internet is waiting for the transition to a new protocol, which accelerates the website download.

Let’s find out how this will affect the site building, SEO, and other aspects.

What is HTTP/2?

http 2
HTTP 2

The HTTP/1.1 protocol has been used since 1999 and over time has acquired one significant problem. Modern sites, in contrast to what was popular in 1999, use a lot of different elements: JavaScript scripts, CSS styles, and sometimes also flash animation. When you transfer all of them, the browser and the server create several connections.

The HTTP/2 protocol significantly speeds up the websites speed due to the following features:

  • Connections: multiple requests can be sent via a single TCP connection, and responses can be received in any order. There is no need to keep multiple TCP connections.
  • Thread priorities: the client can set the server priorities — what kind of resources are more important to him than others.
  • Header compression: the size of the HTTP header can be reduced.
  • Push-sending the data from the server side: the server can send to the client the data that has not yet been requested, for example, based on data about the next page the users are going to open.

The HTTP 2 protocol development was based on the SPDY protocol, developed by Google. But Google has already announced that it will refuse further SPDY support to a more promising HTTP/2.


Read: 🚩Why is your WordPress site slow and how to speed it up?


Key features of HTTP/2

  • Multiplexing
  • Server Push
  • Header Compression
  • Stream Prioritization
  • Flow Control

Difference between HTTP and HTTP 2

The changes which have been made to the first protocol do not require many alterations in the way the applications work. Although, there is an advantage for new applications which will work on enhanced speed. The key differences between the two protocols have been compared below:

FeatureHTTPHTTP2
SyntaxHigh-level syntax is the sameHigh-level syntax is the same
Data FramingModified data framingEnhanced data framing
QueriesLimited queriesMore queries
Server ResponsivenessLimited responsivenessEnhanced responsiveness
Efficient WebsitesMinimized requestsEnhanced efficiency
Head-of-line BlockingPresent in HTTPOvercome in HTTP2
MultiplexingNot presentPresent
Header CompressionNot presentPresent
Request PrioritizationNot presentPresent
Difference between HTTP and HTTP/2

Below is a good visual representation of the basic difference between HTTP/1 and HTTP/2.

nginx http/2
nginx http/2

Pros and Cons of HTTP/2

Pros

  • Improved page load speed
  • Better use of network resources
  • Increased user experience
  • Better compatibility with modern web technologies

Cons

  • The protocol is said to be inconsistent and complex
  • Violates the principle of protocol layering
  • Comes with a heavy encryption cost
  • Not compatible with certain devices like routers
  • Lacks opportunistic encryption

Why did the world need HTTP/2?

  • HTTP was first described in 1991 and its latest version, HTTP/1.1, was approved in 1999 and is still in use today.
  • Website sizes have grown significantly over the years, leading to slow loading times and limitations on the number of simultaneous connections using HTTP/1.1.
  • Temporary solutions such as optimizing website load have been implemented, but they only offer a short-term solution.
  • Google engineers began work on improving the protocol in 2009, leading to the creation of the SPDY protocol, which is faster and supported by most browsers but requires server-side support.
  • HTTP/2 is based on SPDY and is backward compatible with HTTP/1.1. There is no immediate need to upgrade, but eventually, sites may load slower on the older protocol.

Is HTTP/2 really faster?

HttpWatch Experts performed several tests and found a serious acceleration with HTTP 2.

The screenshot below shows the download speed of the page using HTTP / 1.1:

http 2 ss1
Http 2 SS1

And on this screenshot — the result of using HTTP  2:

http 2 ss2
HTTP 2 ss2

Download speed increased by 23%. HttpWatch experts also note that the technology is not yet fully optimized, and expect a real acceleration of up to 30%.


Why HTTP/2 works faster?

  • Multiple requests sent within the same connection in HTTP/2 (multiplexing) lead to faster loading of static elements
  • Compression of HTTP headers in HTTP/2 reduces the amount of data between the server and browser, freeing up resources
  • Improved security with encrypted connections for HTTP/2 support by trendsetting browsers (Google Chrome, Mozilla Firefox)
  • Prioritization order changes in HTTP/2 with prioritization being a desirable method for proper multiplexing functioning
  • Lack of prioritization configuration in HTTP/2 can lead to reduced speed as resources that can be loaded later will take a separate strip and a part of the power.

Why is it important to speed up the website page loading?

  • HTTP 2 support is not a direct ranking factor for Google
  • Download speed is a significant ranking factor for Google
  • HTTP/2 can positively impact website speed and positively affect ranking due to behavioral factors
  • Faster pages have a lower failure rate and may result in increased user engagement
  • Google Bot will soon support HTTP/2
  • HTTP 2 may become a ranking factor in the future as search engines change algorithms.

The benefits for web developers

HTTP 2 allows you to get rid of old tricks, designed to speed up the page loading without HTTP/2. We list the:

  • Domain-sharding or using multiple related domains to download files to enable more TCP connections establishing.
  • Sprites of pictures — combining pictures in one file to reduce the number of requests. However, such a file must first be completely loaded to be displayed. In addition, processing large files consumes more memory.
  • Combine the CSS and JavaScript files, which is also done to reduce the number of requests, and also increase memory usage.
  • Inline inclusion or putting CSS and JavaScript, and sometimes even pictures inside the HTML file, to reduce the number of connections. At the same time, the page is not displayed until the entire file is loaded.
  • Domains without cookie files: Download images, CSS, and JavaScript from another domain where cookies are not used.

How to implement HTTP 2?

To implement HTTP 2, you need to follow these steps:

  • Check Server Support: Make sure your server software supports HTTP 2. Popular server software like Apache, Nginx, and IIS has built-in support for HTTP 2.
  • Enable HTTP 2: Once you have confirmed that your server supports HTTP 2, you will need to enable it. The method for enabling HTTP 2 varies depending on the server software you are using.
  • Use HTTPS: HTTP 2 requires a secure connection using HTTPS, so you need to have an SSL certificate installed on your server.
  • Update Your Code: If you are using a library or framework that handles HTTP connections, make sure it supports HTTP 2. Some libraries may require updates to work with HTTP 2.
  • Test Your Site: After making the necessary changes, test your site to make sure it works with HTTP 2. Check the browser console for any errors or warnings.
  • Monitor Performance: Regularly monitor the performance of your site to ensure that it is running smoothly with HTTP 2.
  • Consider Performance Optimizations: Implementing HTTP 2 will improve the performance of your site, but there may still be opportunities for further optimization. For example, combining images into sprites, compressing images, and reducing the number of HTTP requests can further improve performance.

Conclusion

HTTP 2 is backward compatible with HTTP 1.1 and does not require migration. However, as web servers and browsers adopt HTTP 2, site optimization techniques may need to be updated to avoid slowing down the website.


Read: 🚩A Complete Guide on HTTP to HTTPS Migration in WordPress


Merging images into sprites improves compression and reduces data download while avoiding the use of Data URI for embedding images can improve caching. Domain sharding is no longer necessary in HTTP 2, as it allows direct requests for resources and can reduce performance by creating additional connections.

Frequently Asked Questions

What is HTTP2 used for?

HTTP2 is a protocol used to transfer data over the internet, improving the speed and security of delivering web content such as pages, images, and videos from a server to a browser. It offers faster page loading and increased efficiency compared to its predecessor, HTTP 1.1, by allowing multiple requests to be sent and received at the same time.

What is the difference between HTTP and HTTP2?

HTTP2 is an updated version of HTTP that is faster and more efficient than its predecessor. It uses a single connection to load multiple resources, whereas in HTTP multiple connections were required. HTTP2 also provides data compression and prioritization, leading to faster page loading times for users.

Why http2 is not widely used?

HTTP2 is not widely used due to compatibility and implementation issues. Some old devices and software do not support HTTP2 and it requires a dedicated server and SSL certificate for implementation.

Leave a Reply

Your email address will not be published. Required fields are marked *