HTTP/1.1 v/s HTTP/2 Protocol

Vinay Chaturvedi
2 min readNov 2, 2020

HTTP/2 improved on HTTP/1.1 in a number of ways that allowed for speedier content delivery and improved user experience, including:

Binary protocols –

Binary protocols consume less bandwidth, are more efficiently parsed and are less error-prone than the textual protocols used by HTTP/1.1. Additionally, they can better handle elements such as whitespace, capitalization and line endings. The latest HTTP version(HTTP/2) has evolved significantly in terms of capabilities and attributes such as transforming from a text protocol to a binary protocol. HTTP1.x used to process text commands to complete request-response cycles. HTTP/2 will use binary commands (in 1s and 0s) to execute the same tasks. This attribute eases complications with framing and simplifies implementation of commands that were confusingly intermixed due to commands containing text and optional spaces.
Browsers using HTTP/2 implementation will convert the same text commands into binary before transmitting it over the network.

Benefits of using Binary Protocols are:

  1. Low overhead in parsing data — a critical value proposition in HTTP/2 vs HTTP1.
  2. Less prone to errors.
  3. Lighter network footprint.
  4. Effective network resource utilization.
  5. Eliminating security concerns associated with the textual nature of HTTP1.x such as response splitting attacks.
  6. Enables other capabilities of the HTTP/2 including compression, multiplexing, prioritization, flow control and effective handling of TLS.
  7. Compact representation of commands for easier processing and implementation.
  8. Efficient and robust in terms of processing of data between client and server.
  9. Reduced network latency and improved throughput.

Multiplexing –

HTTP/2 is multiplexed, i.e., it can initiate multiple requests in parallel over a single TCP connection. As a result, web pages containing several elements are delivered over one TCP connection. These capabilities solve the head-of-line blocking problem in HTTP/1.1, in which a packet at the front of the line blocks others from being transmitted.

Header Compreession —

HTTP/2 uses header compression to reduce the overhead caused by TCP’s slow-start mechanism.
Server push — HTTP/2 servers push likely-to-be-used resources into a browser’s cache, even before they’re requested. This allows browsers to display content without additional request cycles.
Server push allows the server to send additional cacheable information to the client that isn’t requested but is anticipated in future requests. For example, if the client requests for the resource X and it is understood that the resource Y is referenced with the requested file, the server can choose to push Y along with X instead of waiting for an appropriate client request.

Benefits of using Header Compression are:
1. The client saves pushed resources in the cache.
2. The client can reuse these cached resources across different pages.
3. The server can multiplex pushed resources along with originally requested information within the same TCP connection.
4. The server can prioritize pushed resources — a key performance differentiator in HTTP/2 vs HTTP1.
5. The client can decline pushed resources to maintain an effective repository of cached resources or disable Server Push entirely.
6. The client can also limit the number of pushed streams multiplexed concurrently.

Increased security –

Web browsers only support HTTP/2 via encrypted connections, increasing user and application security.

--

--