Home
/
Website Help
/
What is HTTP/2? - Beginner Guide

What is HTTP/2? - Beginner Guide

HTTP/2 revolutionizes the web by making better use of network resources. Version 2.0 is a major revision of the HTTP protocol, which is the backbone of the World Wide Web. Thanks to the improvements and optimizations it brings about, it enhances the performance and efficiency of the internet.

In this article, we’ll dive into HTTP/2 and explore its fundamentals, evolution, features, and benefits. So, let’s embark on this journey and uncover the power of HTTP/2 together.

What is a protocol?

A network protocol is a set of rules and conventions that define how data is formatted, transmitted, received, and processed within a computer network. It serves as a framework that allows different devices and systems within a network to communicate with each other, regardless of their underlying hardware, software, or architectures.

Examples of other protocols are FTP, SFTP, SSH, SMTP etc.

The HTTP/2 protocol makes the internet faster and more efficient by compressing information and executing multiple requests simultaneously, which reduces load speed.

This means websites load quicker, and you can access content faster.

Additionally, with HTTP version 2.0, servers send you the resources you need before you ask for them, like images or files. All of these improvements work together for faster web performance and a silky-smooth online experience.

According to RFC-7540 by the Internet Engineering Task Force (IETF), HTTP/2 enables more efficient use of network resources and reduces network latency perception by

  • introducing header field compression
  • allowing multiple concurrent exchanges on the same connection
  • allowing flow control and stream prioritization
  • introducing unsolicited push of representations from servers to clients.

The Evolution of HTTP

Infographic displaying the HTTP protocol evolvement over the years

Hypertext Transfer Protocol (HTTP) is a network protocol for communication on the web introduced in 1991. The initial version of HTTP was a simple protocol for retrieving HTML documents. It didn’t include response headers or support for status codes.

With the expanding needs of modern websites and internet users, the IETF HTTP working group released the next version of HTTP/1.0. It included support for different types of content, such as images and video files, and introduced additional methods like POST and HEAD.

Released in 1997, HTTP/1.1 became the most widely used version of HTTP. It brought significant enhancements, including the introduction of persistent connections, chunked transfer encoding, and support for virtual hosting. It also introduced new methods like PUT, PATCH, OPTIONS, and DELETE. However, it still had limitations in terms of performance and latency.

While other protocols were updated over time, HTTP/1.1 remained the standard for web communications for almost 16 years. During that time, the web environment continued to evolve, and the use of HTTP/1.1 started developing speed and security issues. Therefore, Google investigated these issues and created the SPDY protocol as an experimental alternative.

The Need for HTTP/2

Infographic depicting how HTTP 1.1 handles requests

The rise of mobile devices, increased usage of rich media content, and demand for faster and more efficient web experiences entailed the development of a new protocol.

HTTP/1.1 had certain limitations that hindered performance, such as its inability to handle concurrent client requests efficiently.

HTTP/1.1 processes each request and response sequentially, leading to potential delays. Additionally, each request requires a new TCP connection to the server, causing unnecessary network traffic by the multiple TCP connections. Also, with each HTTP 1.1 request, the headers are sent along with the payload, resulting in redundant data transfers.

These limitations led to the need for a more advanced and optimized protocol. Standardized in May 2015, HTTP/2 was adopted as a major revision of the HTTP protocol that incorporates many improvements introduced in SPDY.

Infographic depicting how HTTP 2 handles requests (multiplexing)

It is a binary protocol that allows the multiplexing of multiple parallel requests over a single TCP connection, resulting in fewer TCP connections overall. HTTP/2 also introduces a header field compression mechanism, push technology, and other optimizations to enhance the performance, security, and efficiency of web communication.

Key Features of HTTP/2

HTTP/2 introduces several features that address the limitations of HTTP/1.1 and enhance the performance of web communication.

Server Push

One of the notable features of HTTP/2 is server push. With it, the server can proactively send resources to satisfy the client’s future requests. This feature reduces the number of round trips required between both – the client and server, resulting in faster page load speed.

Infographic showing how the server push feature of HTTP2 works

As the infographic above shows, upon a single client request, the server pushes 2 assets – the index.html along with styles.css. Thanks to that preemptive push of website assets, HTTP/2 facilitates and speeds up page rendering.

Multiplexing

HTTP/2 uses multiplexing to allow multiple concurrent requests and responses over a single TCP connection. Unlike HTTP/1.1, where each request had to wait for a response before the next request could be sent, HTTP/2 enables parallelism. Thereby improving overall efficiency.

With multiplexing, requests, and responses are divided into smaller units called frames. These frames are then interleaved and sent in a non-blocking manner. This means that if one request is delayed due to network congestion, other requests can continue to be processed.

Multiplexing also eliminates the issue of head-of-line blocking, where one slow request can delay the delivery of subsequent HTTP requests. As a result, this feature helps reduce latency and promotes increased customer satisfaction.

Flow control and Stream Prioritization

HTTP/2 introduces the concept of stream prioritization, which allows the client to assign priority levels to different resources. This, along with flow control, ensures that critical resources are fetched first, optimizing the rendering of web pages and providing a better user experience.

Flow control enables the receiver to regulate the data transmission rate by prioritizing specific data streams. It prevents overloading the receiver with more data than it can handle, avoiding congestion and buffer overflow. Flow control operates at the stream level, allowing each stream to have its own flow control window.

The interplay between flow control and stream prioritization is crucial for optimizing the overall performance of the HTTP/2 protocol. Flow control ensures that data is transmitted at a rate that the receiver can handle, while stream prioritization determines the order in which streams are processed, allowing critical resources to be delivered more efficiently.

Header Compression

Infographic depicting the headers compression process

HTTP/2 utilizes a header compression mechanism to reduce the overhead associated with HTTP headers. This compression technique reduces the size of the headers, resulting in lower bandwidth consumption and faster communication between the client and server.

The mechanism uses the HPACK (HTTP/2 Static Table and Huffman Encoding) algorithm to compress headers. HPACK utilizes techniques such as Huffman encoding, indexing, and dynamic table management to minimize the size of headers without losing any critical information.

Binary Protocol

Infographic displaying how the binary formatting in HTTP2 works

While HTTP/1.1 used plain text for communication, HTTP v2 employs a binary protocol, allowing for more efficient parsing and faster data transmission. The binary format reduces the amount of data that needs to be transmitted, improving performance.

In HTTP/2, the data is divided into smaller units called frames, which are binary packets that carry specific types of information. Each frame has a specific format, including a frame header that indicates its type and length. These frames are then sent over a single client-server connection, allowing for concurrent and interleaved communication.

Performance Benefits of HTTP/2

The adoption of HTTP2 brings significant performance benefits. Combining features such as server push, multiplexing, stream prioritization, and header field compression results in faster page load times, reduced latency, and improved web performance. Websites and applications using HTTP/2 often experience better user engagement and increased conversion rates.

Compatibility and Adoption

HTTP2 is designed to be backward-compatible with HTTP/1.1, ensuring that existing web infrastructure can seamlessly transition to the latest protocol. Most modern browsers and servers support HTTP/2, allowing website owners and developers to take advantage of its benefits without major compatibility issues.

How to Start Using HTTP/2?

To enable HTTP/2 on a website, server-side configuration is required. The specific steps for implementation depend on the web server being used. Popular web servers such as Apache and Nginx have built-in support for HTTP v2.

HTTP/2 is available on all SiteGround shared and cloud servers, and you need an SSL certificate for your website in order to take advantage of it.

Additionally, HTTP2 includes a fallback mechanism called HTTP/2 over TLS (HTTP/2 with TLS). This allows clients that don’t support HTTP/2 to fall back to HTTP/1.1 when communicating with servers that support both protocols.

Furthermore, the adoption of HTTP/2 may require some adjustments and considerations. For example, HTTP/2’s encryption requirement (Transport Layer Security) may require server administrators to obtain and install SSL/TLS certificates.

Last but not least, there is also CDN support for HTTP/2. Content Delivery Networks (CDNs) have also embraced HTTP/2, enabling the delivery of content over the protocol. CDNs play a crucial role in accelerating the adoption of HTTP/2 by ensuring that cached and distributed content is served using the latest protocols.

Limitations of HTTP2

While HTTP/2 offers numerous advantages, it is essential to be aware of its limitations. Here, we’ll outline some of them, so read on.

  • Limited browser support. Some legacy systems and older browsers may not fully support HTTP/2, potentially causing compatibility issues.
  • Upgrade Complexity. The upgrade process may require server configuration changes, implementation of new features, and considerations for backward compatibility.
  • Latency and Slow Start. The protocol may face challenges in slow network connections and high-latency environments. The initial connection setup (a.k.a the slow start phase) can introduce latency when establishing new connections.
  • Head-of-Line Blocking. In HTTP/2, multiple requests and responses can be sent concurrently over a single connection. However, if a request is delayed or blocked due to a slow response from the server, it can lead to head-of-line blocking.
  • Higher Server Resource Utilization: HTTP/2 requires more server resources compared to HTTP/1.1 due to the increased complexity of handling multiplexed streams and managing concurrent requests. In certain scenarios, this may result in higher server resource utilization, especially when serving a large number of concurrent requests.

Additionally, certain network configurations and proxies might not handle HTTP/2 traffic correctly, leading to degraded performance.

Despite these limitations, the benefits of HTTP2 outweigh these drawbacks in most cases. It is important for website owners and developers to consider these limitations and ensure proper implementation and testing when adopting HTTP/2 for their websites.

HTTP/2 vs. HTTP/1.1

HTTP/2 is a significant improvement over its predecessor, HTTP/1.1. It addresses the performance bottlenecks of HTTP/1.1 and provides a more efficient and optimized protocol for web communication.

The introduction of features like server push, multiplexing, stream prioritization, header compression, and binary protocol make HTTP/2 the preferred choice for modern web developers.

Conclusion

HTTP/2 is a game-changer for web communication. Its advanced features enhance performance, reduce latency, and improve the user experience. The protocol’s compatibility with existing infrastructure and widespread support make it an ideal choice for website owners and developers looking to optimize their web applications.

FAQs

Is HTTP2 supported by all web browsers?

Most modern web browsers support HTTP/2. However, some older browsers may not fully support it. It is important to check the compatibility of the target audience’s browsers before implementing the protocol.

Can I enable HTTP/2 on my existing website?

Yes, HTTP2 can be enabled on an existing website. Server-side configuration and support are required. Consult the documentation of your web server or hosting provider for specific instructions.

Does HTTP/2 require SSL/TLS encryption?

While HTTP version 2.0 does not strictly require SSL/TLS encryption, most browsers only support it over encrypted connections (HTTPS). It is highly recommended to use SSL/TLS encryption for security and compatibility reasons.

How does HTTP2 improve website performance?

HTTP/2 improves website performance through features such as server-side push, multiplexing, stream prioritization, header compression, and binary protocol. These features reduce latency, increase parallelism, and optimize resource delivery.

Is HTTP/2 beneficial for mobile devices?

Yes, HTTP version 2.0 is beneficial for mobile devices. Its performance enhancements, such as reduced round trips and improved resource delivery, promote faster page load times and a smoother browsing experience on mobile devices.

Share This Article