Today, we all strive for faster and more efficient online experiences. HTTP/2 plays a crucial role in this. While HTTP/1.1 has served us well, it has limitations such as slow page loading and inefficient resource usage. This is why HTTP/2 was developed.
HTTP/2 represents the next step in the evolution of the HTTP protocol. It is designed to significantly improve website performance through smart optimizations and efficient data transmission. By leveraging advanced techniques like multiplexing, HTTP/2 enables websites to achieve noticeably faster loading times and a smoother user experience.
When a modern website is requested by a browser, dozens of requests (on average, around 80) are sent to the web server to display the site on your screen. Each of these requests requires a TCP connection to facilitate data transfer.
With HTTP/1.1, multiple requests can be initiated simultaneously, depending on the browser. However, a potential issue arises: one request might not start until another has completed. This phenomenon can be compared to a queue in a store, where a customer with a complex question causes others to wait until their issue is resolved. This is known as head-of-line blocking.
In HTTP/2, all requests are combined and sent to the browser over a single connection. Using the queue analogy, the customer with the complex question is served while other customers are also helped simultaneously. This process is called multiplexing.
When loading a website, all files—such as HTML, CSS, JavaScript, images, and so on—are downloaded. The order in which these files load is critical. For example, if a CSS file loads too late, the website might appear without proper styling. Similarly, delayed JavaScript loading could cause certain functions to malfunction.
In HTTP/1.1, file priority is determined using head-of-line blocking. In HTTP/2, this becomes unnecessary because all requests are processed through a single connection, and modern browsers can assign priorities to different file types. This makes the order of incoming requests irrelevant.
When files are requested from a web server, additional information about the files is transmitted via HTTP headers.
In HTTP/1.1, each HTTP header requires a separate connection. In HTTP/2, all HTTP headers are compressed (using HPACK) and transmitted over a single connection. Additionally, HTTP/2 headers are binary rather than textual, as they are in HTTP/1.1. This reduces the likelihood of errors and results in faster loading times.
In HTTP/1.1, files are only loaded when the browser specifically requests them from the web server. HTTP/2, however, allows for proactive loading of files, even without explicit requests. This means that if you visit another webpage requiring certain files, they are already loaded and can be displayed immediately, without needing a new connection.
All modern browsers support HTTP/2. Here’s a quick list of the most common browsers and their supported versions:
Although it is increasingly important to use SSL in general, it is not technically mandatory for HTTP/2.
In practice, however, the situation is more complex. Leading browsers like Google Chrome and Mozilla Firefox (together accounting for a global market share of 72%) require TLS (SSL) for HTTP/2. As such, SSL has effectively become a non-negotiable standard—and rightly so.