Computer >> Computer tutorials >  >> Networking >> Networking

What is HTTP/2 and What Does it Do?

In the last 20 years, the World Wide Web has dramatically evolved. All the improved web technologies require better and faster solutions and protocols for communication and file transfer than the current ones (HTTP) which are reaching their technological limits.

What is HTTP/2 and What Does it Do?

What is HTTP/2?

HTTP/2 is the newest version of Hypertext Transport Protocol (HTTP) – the underlying protocol used by the World Wide Web. It was initially approved in February 2015. That is almost 20 years after the original HTTP. HTTP/2 reduces load times and brings vast improvements in communication between servers and browsers. Majority of the browsers already added HTTP/2, and it didn’t change many things from users’ perspective. That is the main reason why many of us haven’t read or heard of it yet.

What Does HTTP/2 Do?

As a successor of HTTP, HTTP/2 focuses on improving all the characteristics of HTTP. In order to maintain backward-compatibility with the older protocol, it keeps most of the functionality of HTTP. However, it introduces some drastic improvements.

Both HTTP or HTTP/2 define:

  • Which actions web browsers and servers need to take in response to different commands.
  • How every bit of information is transferred from one to another computer through the web.
  • How messages are created, formatted and transmitted.

In other words, HTTP and HTTP/2 sets the standards for how web content is delivered to your computer, with the difference that HTTP/2 is making all things faster than its predecessor. Here you can see what does HTTP/2 do in details.

Multiplexed Streams

Bi-directional series of text format frames sent through the HTTP/2 protocol between one server and client are called “streams.” HTTP is capable of transmitting only one of these “streams” at a time. After the stream is sent there is a time delay between the next stream transmission.

HTTP/2 establishes a new binary framing layer that directly solves the problem with transmitting “streams” one by one. It allows clients and servers to disintegrate the HTTP/2 payload into tiny, independent and easy-manageable interleaved frame sequences. All this information is reassembled once is received at the other end. This protocol enables the exchange of multiple, concurrently open, and independent bi-directional sequences with no latency between successive streams.

Benefits:

  • The parallel multiplexed requests and responses don’t block each other.
  • A single TCP connection can ensure effective network resource utilization even when transmitting multiple data streams.
  • Faster web performance, reduced latency, and better search engine results.
  • Reduced CapEx and OpEx in running network and IT resources.

What is HTTP/2 and What Does it Do?

HTTP/2 Server Push and Cache Push

This is a capability that allows servers to send additional cacheable info to clients. That info isn’t requested but is anticipated for future requests. If the client requests one resource A and it is known that another resource B is referenced with the requested one, the server can push B along with A instead of waiting for another client request. Then the client saves the pushed resource B into the cache for future use. This feature saves a whole request-respond round-trip process and reduces network latency. Google originally introduced Server Push in SPDY protocol.

Another improvement in HTTP/2 is Cache Push. This proactively updates or invalidates the client’s cache. This gives an ability to servers to identify possible push-able resources that clients actually don’t want.

Benefits:

  • Clients can decline pushed resources in order to maintain an efficient repository of cached resources (or even disable Server Push entirely).
  • Clients can limit the number of pushed streams multiplexed concurrently.
  • Servers can prioritize pushed resources. This is a key in the performance difference between HTTP/2 and HTTP.
  • Servers can multiplex pushed resources along with client’s requested information within the same TCP connection.
  • Clients can use the cached resources across different pages.
  • Clients save pushed resources in the cache memory.

Binary Protocols

HTTP/2 has significantly improved capabilities when transforming text protocol to a binary protocol. While HTTP used to process text commands to execute request-response cycles, HTTP/2 relies on binary commands. That shortens the time (to 1s and 0s) for executing the same tasks.

Browsers with HTTP/2 support will convert the text commands into binary code before transmitting it over the network. However, the binary framing layer is not backward compatible with HTTP servers and clients.

Benefits:

  • Preventing security concerns associated with the textual nature of HTTP (ex. Response splitting attacks).
  • Enables HTTP/2 capabilities like compression, prioritization, multiplexing, effective handling of TLS, and flow control.
  • Compact representation of commands allowing easier implementation and processing.
  • Robust and effective data processing between clients and servers.
  • Improved throughput and reduced network latency.
  • Fewer chances for errors when compared with HTTP.
  • Highly efficient network resource utilization.
  • Low overhead in parsing data.
  • Lighter network footprint.

What is HTTP/2 and What Does it Do?

Stream Prioritization

HTTP/2 allows clients to provide preferences to particular data streams. The servers are not bound to follow these clients’ instructions, but this mechanism allows servers to optimize network resource allocation based on user requirements.

Stream Prioritization works with Weight and Dependencies assigned to each stream. Despite the fact that all streams are inherently dependent on each other except, they have a weight assigned between 1 and 256. Stream prioritization mechanisms are still a topic of debating. However, when Stream Prioritization is combined with the HTTP/2 capability of processing multiple data streams in a single TCP connection, can lead to a simultaneous arrival of different-priority server requests.

Benefits:

  • Reduced negative effects of network latency concerns.
  • Improved user experience and page-load speed.
  • Optimization in data communication between servers and clients.
  • Highly effective network resource utilization.
  • Reduced delivery-time for primary content requests.

Stateful Header Compression

When users browse media-rich-content websites, using HTTP, clients push multiple near-identical header frames. This is the case because each client request must include as much information as the server requires to perform the requested operation. This process leads to latency and unnecessary resources consumption.

HTTP/2 includes the ability to compress a large number of redundant header frames. It relies on HPACK specification as a secure and simple approach to header compression. Clients and servers maintain a list of headers used in previous client-server requests. This directly addresses the concerns with redundant header frames.

Benefits:

  • Encodes commonly used headers and large headers. That eliminates the need to for sending entire header frames. The individual size of each stream shrinks significantly.
  • Preventing security attacks such as CRIME exploring data streams with compressed headers.
  • Efficient utilization of multiplexing mechanisms.
  • Efficient stream prioritization.
  • Reduced resource overhead.

What is HTTP/2 and What Does it Do?

Real-World Benefits of HTTP/2

HTTP/2 is focused on maximizing the potential of technology, to meet future needs and expectations. Here are the real-world benefits of using HTTP/2.

Web Performace and Mobile Web Performance – HTTP/2 has abilities to send and receive more data in one client-server communication cycle. It works well to reduce latency in accessing internet services on mobile data networks and networks with limited bandwidth per user.

Cheaper High-Speed Internet – HTTP/2 increases the effectiveness of data communication. That allows internet providers to shrink overall expenses while maintaining the standards of high-speed internet.

Security – HTTP/2 is not vulnerable to the threats targeting text-based application layer protocols. Furthermore, it uses “Security by Obscurity” approach to protect sensitive data transmission between clients and servers.

Expansive Reach – HTTP/2 advantages reduce internet outcomes for providers. That will lead to broader internet coverage on a worldwide level.

Media-Rich Web Experience – The technology features and advantages that HTTP/2 brings into the World Wide Web provide an infrastructure capable of delivering media-rich content at faster page-load speeds.

Wrap Up

HTTP/2 is relatively new protocol, but the support for it continually grows. Nowadays, most internet browsers support HTTP/2 (Microsoft Edge, Google Chrome, Safari, Firefox, Chrome for Android). Many web servers include HTTP/2 native support (Apache HTTP Server, Tomcat, NGINX). Without a doubt, HTTP/2 is the WWW protocol of the future.