Thursday, 19 November 2026

HTTP1 vs HTTP2 vs HTTP3 - A Deep Dive

  

Have you ever wondered what makes the World Wide Web work so well? There are many reasons, but a behind-the-scenes hero called HTTP (Hypertext Transfer Protocol) does most of the heavy lifting.

 

Think of HTTP as the common language that your browser and websites use to talk to each other.

 

When it first started, HTTP had a simple job: send plain text web pages. But developers soon figured out it could do much more—like sending photos, videos, and music.

 

In this article, we’ll take a look at how HTTP has grown up over the years, moving from HTTP/1 to the newer HTTP/2 and HTTP/3. We'll see how each version fixed old problems to make the internet faster and safer.

 

By the end, you'll easily understand the differences between these versions, helping you build better and faster websites!

 

1. HTTP/1.1: Reliable, Simple, but Slow

HTTP/1.1 is one of the most important protocols in web architecture. Although HTTP/2 and HTTP/3 have introduced significant performance improvements, HTTP/1.1 is still widely used in legacy applications, internal services, REST APIs, and backend systems.

 

To understand why HTTP/2 was introduced, we first need to understand how HTTP/1.1 communicates, how TCP connections work, and where its performance limitations come from.

 

1.1 What is HTTP/1.1?

HTTP (Hypertext Transfer Protocol) is an application-layer protocol that defines how clients and servers communicate.

 

For example, when you open an e-commerce website:

-       The browser sends an HTTP request to the web server.

-       The server processes the request.

-       The server sends an HTTP response.

-       The browser renders the response.

 

HTTP/1.1 uses a text-based request-response format. A typical HTTP request looks like this:

GET /products/101 HTTP/1.1
Host: example.com
Accept: application/json
User-Agent: Mozilla/5.0
Connection: keep-alive

   

The server responds:

 

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 45

{
  "id": 101,
  "name": "Laptop",
  "price": 75000
}

   

Let's understand the request structure.

Component

Description

GET

HTTP method

/products/101

Resource being requested

HTTP/1.1

HTTP protocol version

Host

Target hostname

Accept

Expected response format

Content-Type

Format of the response body

Content-Length

Size of the response body

 

HTTP/1.1 communicates using readable text headers and a message body.

 

1.2 How does HTTP/1.1 establish communication?

HTTP/1.1 typically uses TCP as its transport protocol. Before exchanging HTTP messages, the client and server establish a TCP connection.

 

Consider a browser accessing https://example.com.

 

The TCP three-way handshake involves:

-       SYN: Client requests a TCP connection.

-       SYN-ACK: Server acknowledges and agrees to establish the connection.

-       ACK: Client acknowledges the server.

 

After establishing the TCP connection, the browser can send HTTP requests.

 

For HTTPS, TLS negotiation also happens before HTTP application data is exchanged (with TLS 1.3, it normally adds one round trip after TCP establishment).

 

This connection setup introduces latency. Imagine a user visiting a website hosted in another country. The network round-trip time might be 150 milliseconds. TCP connection establishment alone can take approximately 150 ms, and TLS negotiation can add another round trip.

 

This is one reason browsers try to reuse existing connections.

 

1.3 Persistent Connections – Keep-Alive

One major improvement introduced by HTTP/1.1 was persistent connections. Let's first understand the problem.

 

HTTP/1.0: Creating a new connection for every request

Imagine a webpage containing:

-       1 HTML document

-       3 CSS files

-       5 JavaScript files

-       10 images

That's 19 resources.

 

With a non-persistent HTTP/1.0 connection, the browser might establish a new TCP connection for every resource.

 

This introduces significant overhead:

-       Repeated TCP handshakes.

-       Repeated TLS handshakes for HTTPS.

-       Additional network round trips.

-       Increased server resource consumption.

 

HTTP/1.1 – Reusing the same TCP connection

HTTP/1.1 introduced persistent connections. Instead of closing the connection after every response, the client and server can keep the connection open and reuse it for subsequent requests.

GET /index.html HTTP/1.1
Host: example.com

Server responds:

HTTP/1.1 200 OK
Content-Length: 1000

The same TCP connection can now be reused:

GET /style.css HTTP/1.1
Host: example.com

   

And again:

 

GET /app.js HTTP/1.1
Host: example.com

Benefits:

-       Reduces TCP connection establishment overhead.

-       Reduces TLS handshake overhead.

-       Improves resource utilization.

-       Reduces latency when loading multiple resources.

 

HTTP/1.1 uses persistent connections by default unless the connection is explicitly closed. Persistent connections do not mean multiple requests are processed simultaneously. That's where the next limitation comes in.

 

1.4 HTTP/1.1 Pipelining – Sending Multiple Requests

HTTP/1.1 also introduced request pipelining. Without pipelining, the client generally follows this sequence:

Client                         Server
  |                               |
  |------ Request 1 ------------->|
  |                               |
  |<----- Response 1 -------------|
  |                               |
  |------ Request 2 ------------->|
  |                               |
  |<----- Response 2 -------------|
  |                               |
  |------ Request 3 ------------->|
  |                               |
  |<----- Response 3 -------------|

   

The client waits for the previous response before sending the next request. This creates unnecessary waiting time.

 

With HTTP/1.1 pipelining

Pipelining allows the client to send multiple requests without waiting for individual responses.

 

Client                         Server
  |                               |
  |------ Request 1 ------------->|
  |------ Request 2 ------------->|
  |------ Request 3 ------------->|
  |                               |
  |<----- Response 1 -------------|
  |<----- Response 2 -------------|
  |<----- Response 3 -------------|

   

This sounds like multiplexing, but it is not.

 

The important limitation: The server must send responses in the same order as the requests.

 

For example:

-       Request 1 takes 5 seconds.

-       Request 2 takes 100 milliseconds.

-       Request 3 takes 200 milliseconds.

 

Even if requests 2 and 3 are ready earlier, their responses cannot overtake response 1 on that connection. This leads us to Head-of-Line Blocking.

 

1.5 Head-of-Line (HOL) Blocking

This is one of the biggest limitations of HTTP/1.1. Head-of-Line Blocking occurs when a delayed request or response prevents subsequent responses from being delivered on the same connection.

 

Consider this example, a browser sends three requests:

Request

Resource

Processing time

Request 1

Large Image

5 seconds

Request 2

User profile

100 ms

Request 3

Notifications

200 ms

 

Suppose the browser uses HTTP/1.1 pipelining. Although the user profile and notifications are ready quickly, their responses must wait behind the large image response. This is application-level Head-of-Line Blocking.

 

How did browsers solve this problem?

Browsers started opening multiple TCP connections to the same domain. Traditionally, browsers commonly used up to 6 parallel connections per origin (the exact limit varies by browser).

 

For example, instead of sending all requests through one connection:

-       Connection 1: HTML and other resources.

-       Connection 2: CSS.

-       Connection 3: JavaScript.

-       Connection 4: Images.

-       Connection 5: Fonts.

-       Connection 6: Other resources.

 

Now, a slow image on connection 1 doesn't necessarily block a user profile request on connection 2.

 

But there is a trade-off:

-       More TCP connections.

-       More memory consumption.

-       More server-side connection management.

-       More TCP and TLS handshake overhead.

-       More congestion-control overhead.

 

HTTP/2 later solved much of this problem through multiplexing.

 

1.6 Header Overhead – No Header Compression

HTTP/1.1 sends headers as plain text with every request. Consider an application making 100 API requests. Each request might contain:

 

GET /api/user/profile HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1Ni...
Accept: application/json
User-Agent: Mozilla/5.0
Content-Type: application/json

   

Notice that many headers remain identical across requests. For example:

 

-       Host

-       Authorization

-       User-Agent

-       Accept

-       Content-Type

 

If the application sends 100 requests, these headers are repeatedly transmitted. This creates unnecessary network overhead.

 

HTTP/1.1 does not define a standard header-compression mechanism. HTTP/2 introduced HPACK header compression to reduce this overhead.

 

This is particularly useful for APIs that repeatedly send large authorization tokens and common headers.

 

1.7 No Request Prioritization

Imagine a browser loading a webpage.

 

It needs:

-       HTML

-       CSS

-       JavaScript

-       Images

-       Fonts

 

Not all resources have equal importance.

 

For example:

-       CSS is important for rendering the page.

-       JavaScript may be needed for page functionality.

-       Large images can potentially load later.

 

HTTP/1.1 does not provide a standardized mechanism to prioritize requests based on resource importance. Browsers can manage scheduling across connections, but the HTTP/1.1 protocol itself does not provide HTTP/2-style stream prioritization.

 

HTTP/2 introduced mechanisms to communicate stream priorities, although modern implementations have evolved beyond the original priority scheme.

 

1.8 No Server Push

In HTTP/1.1, the client must request resources.

 

For example:

-       Browser requests index.html.

-       Server responds with HTML.

-       Browser discovers that it needs style.css.

-       Browser requests style.css.

-       Browser discovers that it needs app.js.

-       Browser requests app.js.

 

This creates additional network round trips. HTTP/2 initially introduced Server Push, allowing servers to proactively send certain resources before receiving explicit requests for them.

 

However, HTTP/2 Server Push was rarely beneficial in practice and has been deprecated in major browser implementations.

 

Today, alternatives such as preload hints and caching are generally preferred.

 

1.9 Chunked Transfer Encoding

HTTP/1.1 introduced chunked transfer encoding. Consider an API that generates a large response dynamically. The server might not know the total response size before starting transmission.

 

Without knowing the content length, how can the server start sending data? HTTP/1.1 solves this through chunked transfer encoding.

 

Example:

 

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/json

5
Hello 
6
World!
0

   

Explanation:

-       7: Next chunk contains 7 bytes.

-       Hello, : First chunk.

-       6: Next chunk contains 6 bytes.

-       World!: Second chunk.

-       0: Indicates the end of the response.

 

The server can start transmitting data without calculating the entire response size upfront.

 

Benefits:

-       Supports streaming responses.

-       Avoids buffering the entire response before transmission.

-       Useful for dynamically generated content.

 

Note that chunked transfer encoding is a message-framing mechanism, not a compression mechanism.

 

1.10 HTTP Caching

HTTP/1.1 also provides caching mechanisms to reduce unnecessary network requests.

 

Imagine a browser downloads a logo:

 

GET /images/logo.png HTTP/1.1
Host: example.com

The server responds:

 

HTTP/1.1 200 OK
Cache-Control: max-age=3600
Content-Type: image/png

The browser can cache the image for one hour. If the user refreshes the page within that period, the browser can reuse the cached image without contacting the server.

 

What happens when the cache expires?

The browser can send a conditional request:

 

GET /images/logo.png HTTP/1.1
Host: example.com
If-None-Match: "abc123"

   

The server checks whether the resource has changed. If it hasn't:

 

HTTP/1.1 304 Not Modified

 

The browser reuses its cached copy. This saves bandwidth and reduces server workload.

 

1.11 Summary: HTTP/1.1 Limitations

Feature

HTTP/1.1 behavior

Limitation

Transport

TCO

TCP connection overhead

Connection

Persistent

Multiple requests aren't multiplexed

Pipelining

Supported

Responses must remain ordered

Multiplexing

Not supported

HOL blocking

Header compression

Not supported

Repeated headers

 

Prioritization

No standardized mechanism

Limited control over resource delivery

Server Push

Not supported

Client must request resources

Caching

Supported

Requires proper cache management

Streaming

Chunked transfer encoding

Message framing overhead

 

 

When is HTTP/1.1 still useful?

HTTP/1.1 is not an obsolete or unreliable protocol. It is still a perfectly valid choice for many applications.

 

Common use cases include:

-       Legacy applications: Existing systems built around HTTP/1.1.

-       Simple REST APIs: Applications with relatively low request concurrency.

-       Internal microservices: Services where HTTP/1.1 performance is sufficient.

-       IoT systems: Devices with simple HTTP client implementations.

-       Compatibility: Environments where HTTP/1.1 is the common denominator.

 

One important clarification: HTTP/1.1 is not inherently less reliable than HTTP/2 or HTTP/3. Reliability is largely provided by the underlying transport and application design.

 

2. HTTP/2: Understanding Multiplexing, Header Compression, and Head-of-Line Blocking

 

2.1 Introduction

HTTP/2 (Hypertext Transfer Protocol Version 2) is a major improvement over HTTP/1.1. It was standardized in 2015 to address performance limitations in HTTP/1.1, particularly when applications need to exchange multiple requests and responses over the network.

 

Modern web applications often make several requests simultaneously.

 

For example, when you open an e-commerce website, the browser might need to:

 

-       Fetch user profile information.

-       Retrieve the list of orders.

-       Load product images.

-       Fetch shopping cart details.

-       Retrieve notifications.

-       Download JavaScript and CSS files.

 

With HTTP/1.1, browsers typically opened multiple TCP connections to improve performance.

 

HTTP/2 introduced a better approach, multiple requests and responses can share a single TCP connection using multiplexing.

 

Let's understand how HTTP/2 works and what problems it solves.         

                 

2.2 HTTP/2: Key Improvements

HTTP/2 introduced several important improvements over HTTP/1.1.

 

a. Multiplexing

Multiplexing is one of the most important features of HTTP/2. In HTTP/1.1, multiple requests often required multiple TCP connections to achieve parallelism.

 

HTTP/2 allows multiple independent streams to share a single TCP connection. Each request and response belongs to a separate stream. Parallelism is achieved using streams and frames. In HTTP/2, each request-response exchange gets its own unique Stream ID.

 

One TCP connection

-       Stream 1, ID: 1: GET /user/profile

-       Stream 2, ID: 3: GET /orders/list

-       Stream 3, ID: 5: GET /notifications/unread

 

Notice that we have three independent streams, but only one TCP connection. Each stream represents an independent request-response exchange.

 

What is a Frame?

Now let's understand frames. Imagine that the server returns a large JSON response for the user profile:

 

{
  "id": 101,
  "name": "John",
  "email": "john@example.com",
  "address": "Bangalore",
  "orders": [...]
}

   

Instead of treating the entire HTTP message as one indivisible unit, HTTP/2 divides it into smaller pieces called frames.

 

For example, a response might be transmitted as:

-       Frame 1: Response headers (HEADERS frame).

-       Frame 2: First part of JSON response (DATA frame).

-       Frame 3: Remaining JSON response (DATA frame).

 

All these frames belong to Stream 1. Similarly, the orders API response will have its own frames belonging to Stream 2.

 

Benefits:

-       Reduces the need for multiple TCP connections.

-       Reduces connection establishment overhead.

-       Allows multiple requests and responses to progress concurrently.

-       Improves network resource utilization.             

 

b. Binary Framing

HTTP/1.1 uses a text-based protocol.

 

For example:

 

GET /users/123 HTTP/1.1
Host: example.com
Accept: application/json

   

HTTP/2 uses a binary framing layer instead of transmitting HTTP messages as plain-text request lines and headers. HTTP/2 breaks messages into smaller units called frames.

 

Some important frame types include:

 

-       HEADERS: Carries HTTP headers.

-       DATA: Carries request or response body data.

-       SETTINGS: Exchanges connection-level configuration.

-       WINDOW_UPDATE: Controls flow control.

-       RST_STREAM: Terminates a stream.

-       GOAWAY: Indicates that a connection is being shut down.

 

Every frame contains information such as its length, type, flags, and stream identifier.

 

Benefits:

-       More efficient protocol parsing.

-       Clear separation of HTTP messages into frames.

-       Supports multiplexing through stream identifiers.

 

Note: Binary framing does not automatically mean that every HTTP/2 message is smaller. Its primary advantage is a structured and efficient framing mechanism. 

 

c. Header Compression (HPACK)

Web applications frequently send the same HTTP headers with multiple requests.

 

For example:

 

Request 1:

-       Host: api.example.com

-       User-Agent: Chrome

-       Authorization: Bearer JWT_TOKEN

-       Accept: application/json

 

Request 2:

-       Host: api.example.com

-       User-Agent: Chrome

-       Authorization: Bearer JWT_TOKEN

-       Accept: application/json

 

Request 3:

-       Host: api.example.com

-       User-Agent: Chrome

-       Authorization: Bearer JWT_TOKEN

-       Accept: application/json

 

Notice that most headers are repeated. Sending the same header information repeatedly consumes additional bandwidth. HTTP/2 introduced HPACK (Header Compression for HTTP/2) to reduce this overhead.

 

HPACK uses techniques such as:

-       Static table: Contains commonly used HTTP header names and values.

-       Dynamic table: Maintains previously transmitted header fields.

-       Huffman encoding: Encodes header strings more compactly.

 

For example, if a header has already been transmitted, subsequent requests can reference its indexed representation instead of transmitting the complete header again.

 

Benefits:

- Reduces repeated header data.

- Saves network bandwidth.

- Particularly useful for applications making frequent API calls.

 

Note: Sensitive headers such as Authorization and Cookie require special care. HPACK does not mean that sensitive values are automatically hidden or encrypted. HTTPS provides encryption.

 

    

d. Server Push

HTTP/2 introduced a feature called Server Push. Normally, the client requests a resource and the server responds.

 

For example:

 

-       Browser requests index.html.

-       Server responds with index.html.

-       Browser discovers that it needs style.css.

-       Browser sends another request for style.css.

 

With HTTP/2 Server Push, the server could proactively send resources such as CSS or JavaScript files before the browser explicitly requests them.

 

This was intended to reduce additional network round trips.

 

However, Server Push had practical limitations, including browser caching and resource prioritization issues. It has been deprecated or disabled in major browsers, so it should not be considered a primary modern HTTP/2 optimization strategy.

                 

e. Stream Prioritization

HTTP/2 allows clients to communicate the relative importance of different streams.

 

For example, when loading a webpage:

 

-       HTML document → High priority.

-       CSS files → High priority.

-       JavaScript files → Medium priority.

-       Large images → Lower priority.

 

This helps servers make better decisions about which resources to process and transmit first. However, the original HTTP/2 priority mechanism was complex, and modern implementations have evolved. Prioritization is not a guarantee that a particular stream will always finish first.  

 

2.3 The Major Problem: HTTP/2 Still Suffers from Head-of-Line Blocking

Although HTTP/2 solves an important limitation of HTTP/1.1, it introduces a different performance challenge.

 

To understand it, let's first understand what Head-of-Line (HOL) Blocking means.

 

a. What is Head-of-Line Blocking?

Head-of-Line Blocking happens when one delayed piece of data prevents other data from being processed, even when that other data has already arrived.

 

HTTP/2 supports multiple streams over a single TCP connection. But HTTP/2 still uses TCP as its transport protocol.

 

TCP guarantees:

-       Reliable delivery.

-       Ordered delivery.

-       Retransmission of lost packets.

 

This ordered delivery creates a problem when a TCP packet is lost.

 

b. Real-World Analogy – The Delivery Truck

Imagine a delivery truck carrying three packages:

 

-       Package A → User Profile

-       Package B → Orders List

-       Package C → Notifications

 

All three packages are travelling in the same truck. Now imagine the truck loses one package on the way. Even if the other packages are ready for delivery, the delivery process gets delayed until the missing package is recovered.

 

The entire delivery process experiences a delay because everything depends on the same delivery mechanism. This is similar to TCP-level Head-of-Line Blocking in HTTP/2.

 

c. Technical Example – HTTP/2 Streams and TCP Packets

Consider three HTTP/2 streams:

 

-       Stream 1 → GET /profile

-       Stream 2 → GET /orders

-       Stream 3 → GET /notifications

 

HTTP/2 divides these streams into smaller frames. These frames are transmitted over TCP.

 

For illustration, imagine the following TCP packet sequence:

 

Packet #1 → Frame belonging to Stream 1

Packet #2 → Frame belonging to Stream 2

Packet #3 → Frame belonging to Stream 3

Packet #4 → Another frame belonging to Stream 1

Packet #5 → Another frame belonging to Stream 2

 

Now suppose Packet #3 gets lost during transmission.

 

What happens?

 

-       Packets #1 and #2 arrive successfully.

-       Packet #3 is lost.

-       Packet #4 and Packet #5 may also arrive at the receiver.

-       However, TCP cannot deliver the later bytes to the application before the missing bytes are recovered.

-       TCP waits for retransmission of Packet #3.

-       HTTP/2 cannot process the later-arriving data until TCP restores the ordered byte stream.

 

The important point: All HTTP/2 streams sharing that TCP connection can experience a delay, even though only one stream's frame was involved in the lost packet. This is called TCP-level Head-of-Line Blocking.

 

d. Where Does This Problem Occur?

TCP-level Head-of-Line Blocking can be particularly noticeable in:

 

-       Mobile networks with unstable connectivity.

-       Congested Wi-Fi networks.

-       Long-distance network connections.

-       Global applications communicating across regions.

-       Applications transferring large amounts of data.

 

Even though HTTP/2 supports multiplexing, a single lost TCP packet can temporarily delay multiple streams.

 

2.4 HTTP/2 vs HTTP/1.1

Let's compare the two protocols.

Feature

HTTP/1.1

HTTP/2

Transport

TCP

TCP

Protocol format

Text-based

Binary framing

Multiplexing

No true multiplexing

Supported

Concurrent requests

Usually multiple TCP connections

Multiple streams on one connection

Header compression

No built-in HPACK

HPACK

Server Push

Not supported

Introduced

Head-of-Line Blocking

Application-level limitations

TCP-level HOL still exists

Stream prioritization

Not built in

Supported, with evolving implementations

 

2.5. HTTP/2 – Real-World Use Cases

HTTP/2 is widely used in modern web infrastructure.

 

a. Content-Heavy Websites

Websites that load multiple images, CSS files, JavaScript files, and other assets can benefit from multiplexing.

 

Examples:

- News websites.

- E-commerce platforms.

- Social media applications.

 

b. Mobile Applications

Mobile applications frequently communicate with backend APIs. For example, a shopping application might simultaneously retrieve:

 

- User information.

- Product details.

- Shopping cart.

- Order history.

- Notifications.

 

HTTP/2 allows these requests to share a single connection.

 

c. Microservices and REST APIs

Modern microservices architectures frequently involve multiple API calls.

 

For example:

 

An API Gateway might communicate with:

- User Service.

- Order Service.

- Payment Service.

- Notification Service.

 

HTTP/2 multiplexing can help reduce connection overhead when multiple requests share a connection. However, whether HTTP/2 is beneficial depends on the client, server, connection reuse, and network conditions.

 

d. Content Delivery Networks (CDNs)

CDN providers such as Cloudflare, Akamai, and Fastly support HTTP/2 to improve content delivery. HTTP/2 helps deliver multiple resources efficiently over persistent connections.

 

It is especially useful for websites with many assets and geographically distributed users.

 

e. Interactive Web Applications

Applications such as chat platforms, collaborative tools, and dashboards frequently make multiple API requests.

 

HTTP/2 can improve the efficiency of these HTTP communications.

 

For continuous bidirectional communication, technologies such as WebSockets or other streaming protocols may also be appropriate.

 

2.6 HTTP/2 – Limitations and Considerations

HTTP/2 offers significant performance improvements, but it is not without limitations.

 

a. TCP Head-of-Line Blocking

All streams sharing a TCP connection can experience delays when TCP packets are lost.

 

b. Implementation Complexity

HTTP/2 introduces streams, frames, flow control, and header compression, making implementations more complex than HTTP/1.1.

 

c. Server Resource Consumption

Managing many concurrent streams requires server-side resources. Connection-level and stream-level flow control also need proper configuration.

 

d. Infrastructure Compatibility

Web servers, reverse proxies, load balancers, and clients must support HTTP/2. Older infrastructure may require upgrades or configuration changes.

 

e. TLS and ALPN

HTTP/2 over HTTPS commonly uses ALPN (Application-Layer Protocol Negotiation). ALPN allows the client and server to negotiate which application protocol to use during the TLS handshake.

 

For example:

 

Client → Supports HTTP/1.1 and HTTP/2

Server → Supports HTTP/1.1 and HTTP/2

Using ALPN, both can negotiate HTTP/2.

 

f. Network Performance

HTTP/2 cannot eliminate network latency, bandwidth limitations, or packet loss. Its actual performance depends on network conditions and application behavior.

 

Note: HTTP/2 support does not inherently require a new TLS certificate. Existing compatible certificates can generally be reused.

 

HTTP/2 was a major step forward in the evolution of HTTP. It’s important features include:

 

-       Multiplexing: Multiple requests and responses share one TCP connection.

-       Binary Framing: HTTP messages are divided into structured binary frames.

-       HPACK: Reduces repeated HTTP header information.

-       Server Push: Introduced proactive resource delivery, although it is no longer widely used.

-       Prioritization: Allows clients to express the relative importance of streams.

-       TCP Head-of-Line Blocking: Packet loss can delay multiple streams sharing the same TCP connection.

 

The key takeaway: HTTP/2 solved HTTP/1.1's application-level request blocking through multiplexing, but TCP-level Head-of-Line Blocking remained. This limitation motivated the development of HTTP/3 using QUIC.

 

3. HTTP/3 – Pioneering the Future of Web Communication

HTTP/3 was standardized in June 2022 through RFC 9114. It represents a significant improvement in how clients and servers communicate over the internet.

 

3.1 Why Do We Need HTTP/3?

To understand HTTP/3, let's revisit the limitations of its predecessors.

 

a. HTTP/1.1: Application-Level Head-of-Line Blocking

HTTP/1.1 processes requests sequentially within a connection when pipelining is not used.

 

Without pipelining (default behavior)

The client sends R1 and waits for its response before sending R2.

Client                  Server
  |                        |
  |------ Request R1 ----->|
  |                        |
  |<----- Response R1 -----|
  |                        |
  |------ Request R2 ----->|
  |                        |
  |<----- Response R2 -----|
  |                        |
  |------ Request R3 ----->|
  |                        |
  |<----- Response R3 -----|

   

Requests and responses are handled sequentially.

 

With pipelining

The client can send multiple requests without waiting for previous responses.

 

Client                  Server
  |                        |
  |------ Request R1 ----->|
  |------ Request R2 ----->|
  |------ Request R3 ----->|
  |                        |
  |<----- Response R1 -----|
  |<----- Response R2 -----|
  |<----- Response R3 -----|

   

HTTP/1.1 requires responses to be returned in the same order as their corresponding requests, even when pipelining is used.

 

For example, if:

-       R1 takes 1 second.

-       R2 takes 200 ms.

-       R3 takes 300 ms.

Even if R2 and R3 are ready earlier, their responses must wait behind R1.

 

This is called Application-Level Head-of-Line Blocking. To overcome this limitation, browsers typically opened multiple TCP connections to the same server.

 

b. HTTP/2 – TCP-Level Head-of-Line Blocking

HTTP/2 introduced multiplexing, allowing multiple streams to share a single TCP connection.

 

For example:

 

-       Stream 1: HTML

-       Stream 2: CSS

-       Stream 3: JavaScript

-       Stream 4: Images

 

These streams can be transmitted concurrently over one TCP connection.

 

However, HTTP/2 still uses TCP. TCP guarantees reliable, ordered delivery of bytes. If a TCP packet is lost, TCP must retransmit it. Meanwhile, subsequent bytes cannot be delivered to the application until the missing data is recovered. This creates TCP-level Head-of-Line blocking.

 

Even if the lost packet belongs to one HTTP/2 stream, it can delay the delivery of data belonging to other streams sharing the same TCP connection.

 

c. HTTP/3: Eliminating TCP-Level Head-of-Line Blocking

HTTP/3 addresses this limitation by replacing TCP with QUIC. QUIC runs over UDP and provides reliable, independently managed streams.

 

If a packet belonging to Stream 1 is lost, QUIC can retransmit the missing data without blocking the delivery of already received data belonging to Stream 2 or Stream 3.

 

This significantly improves performance, especially on networks with packet loss.

 

An important distinction: HTTP/3 does not eliminate every form of Head-of-Line blocking. A stream still needs its own missing data to be recovered before subsequent data in that stream can be delivered. However, packet loss on one stream does not block independent streams.

 

3.2 What Is QUIC?

QUIC stands for Quick UDP Internet Connections. It was initially developed by Google and later standardized by the IETF.

 

QUIC is a modern transport protocol that operates on top of UDP. One important thing to understand is that UDP itself does not guarantee reliable delivery, ordering, or retransmission.

 

QUIC implements these capabilities at the transport layer.

 

It provides:

 

-       Reliable data delivery.

-       Independent streams.

-       Congestion control.

-       Connection establishment.

-       Connection migration.

-       Integrated TLS 1.3 encryption.

 

In simple terms, QUIC combines the reliability features of TCP with modern connection management and encryption, while using UDP as its underlying transport.

 

3.3 HTTP/3 Architecture

Let's understand how HTTP/3 communicates between a client and a server.

 

The protocol stack looks like this:

 

HTTP/1.1 and HTTP/2      

Application Layer: HTTP/1.1 or HTTP/2

Transport Layer: TCP

Security Layer: TLS (typically TLS 1.2 or TLS 1.3)

Network Layer: IP

 

HTTP/3

Application Layer: HTTP/3

Transport Layer: QUIC

Security: TLS 1.3 integrated into QUIC

Underlying transport: UDP

Network Layer: IP

 

Unlike HTTP/1.1 and HTTP/2, HTTP/3 does not use TCP. QUIC handles transport responsibilities over UDP and integrates TLS 1.3 into its handshake.

 

3.4 How Does HTTP/3 Establish a Connection?

One of the biggest advantages of HTTP/3 is faster connection establishment. Let's understand the connection establishment process.

 

Step 1: Client Sends Initial QUIC Packet

The client initiates a connection by sending a QUIC Initial packet to the server over UDP. This packet contains information required to establish a QUIC connection and negotiate cryptographic parameters.

 

Step 2: Server Responds

The server responds with QUIC handshake information. The client and server exchange cryptographic handshake messages using TLS 1.3.

 

Step 3: Secure Connection Established

Once the handshake completes, both sides establish encryption keys and can exchange application data securely. The important point is that QUIC integrates transport and TLS negotiation rather than establishing a TCP connection first and then performing a separate TLS handshake.

 

3.5 1-RTT and 0-RTT Connection Establishment

QUIC supports two important connection establishment modes.

 

1-RTT (One Round Trip Time)

For a new connection, the client and server typically need one round trip to complete the handshake before normal application data can be exchanged.

 

This is faster than the traditional TCP + TLS 1.2 handshake, which generally requires multiple round trips.

 

0-RTT (Zero Round Trip Time)

When a client reconnects to a server and has previously obtained valid session resumption information, it can send certain application data in its initial QUIC flight. This allows application data to be sent without waiting for another handshake round trip.

 

However, 0-RTT data has replay risks. Therefore, applications and servers must carefully restrict which operations are allowed as early data.

 

For example, replay-sensitive operations such as financial transactions should not be blindly accepted as 0-RTT requests.

      

3.6 How Does HTTP/3 Handle Multiple Requests?

HTTP/3 supports multiplexing through QUIC streams. A QUIC connection can contain multiple independent streams.

 

For example, consider a browser loading a website.

 

It needs to download:

-       HTML document.

-       CSS stylesheet.

-       JavaScript file.

-       Multiple images.

 

The browser can initiate multiple HTTP/3 requests over a single QUIC connection. Each request and response is associated with its own QUIC stream.

 

Unlike HTTP/2 over TCP, packet loss affecting one stream does not prevent other streams from delivering their independently received data.

 

Example:

Assume three streams:

-       Stream 1 takes 1 second.

-       Stream 2 takes 200 milliseconds.

-       Stream 3 takes 300 milliseconds.

 

Suppose a packet belonging to Stream 1 is lost.

 

In HTTP/2, because all streams share a TCP connection, TCP-level packet loss can prevent data from all streams from reaching the application until the missing packet is recovered.

 

In HTTP/3, QUIC handles the streams independently. Stream 2 and Stream 3 can continue delivering their available data even while Stream 1 waits for retransmission.

 

This is one of the most important performance improvements introduced by HTTP/3.

 

3.7 Why Does HTTP/3 Use UDP Instead of TCP?

A common question is, if TCP provides reliable communication, why does HTTP/3 use UDP?

 

The answer is that QUIC implements reliability and other transport features itself. UDP is a lightweight transport protocol that does not enforce connection establishment, ordering, or retransmission.

 

This gives QUIC the flexibility to implement these features differently.

 

QUIC provides:

-       Reliable delivery using acknowledgements and retransmissions.

-       Independent stream-level ordering.

-       Congestion control.

-       Connection management.

-       Integrated encryption.

 

Another important advantage is that QUIC operates in user space in many implementations. This makes it easier to evolve and deploy transport improvements without requiring changes to the operating system's TCP implementation.

 

However, UDP is not automatically faster than TCP. The performance improvements come from QUIC's architecture and its handling of streams, handshakes, and connection management.

 

3.8 Connection Migration in HTTP/3

This is another important feature of QUIC. Consider a mobile user browsing a website.

 

Initially, the user is connected through a Wi-Fi network. The client has established a QUIC connection with the server.

 

Now imagine the user moves outside the Wi-Fi coverage area, and the mobile device switches to a cellular network. The device's IP address may change.

 

What happens with TCP?

A traditional TCP connection is identified using a combination of source and destination IP addresses and ports. When the client's IP address changes, the existing TCP connection generally cannot continue using the new network path. A new connection needs to be established.

 

What happens with QUIC?

QUIC uses Connection IDs to identify connections independently of the network address. When the network changes, the client can continue using the existing QUIC connection by sending packets from its new network address.

 

The server can recognize that these packets belong to the existing connection. QUIC uses path validation to verify the new network path before fully migrating the connection.

 

This allows mobile applications to maintain connections more seamlessly when switching between Wi-Fi and cellular networks.

 

3.9 Security in HTTP/3

Security is built into QUIC. Unlike HTTP/1.1 and HTTP/2, where TLS operates as a separate protocol over TCP, QUIC integrates TLS 1.3 into its handshake.

 

Important security features include:

 

-       Encryption of application data

-       Authentication of the server

-       Integrity protection of packets

-       Protection against packet tampering

-       Secure key establishment

 

QUIC encrypts most transport information, including stream data and much of its transport metadata. However, not every packet field is encrypted. Certain information required for packet processing remains visible.

 

HTTP/3 also benefits from TLS 1.3's modern cryptographic design.

 

3.10 Congestion Control in HTTP/3

Congestion control is an important responsibility of any transport protocol. Imagine a client sending data faster than the network can handle. This can cause network congestion, packet loss, and increased latency.

 

TCP implements congestion control to regulate how much data can be transmitted. QUIC also implements congestion control. It tracks acknowledgements, packet loss, and network conditions to determine the appropriate sending rate.

 

QUIC supports congestion control algorithms such as:

 

-       New Reno

-       CUBIC

 

The exact algorithm depends on the QUIC implementation and configuration. An important distinction is that QUIC does not automatically make congestion disappear. It provides mechanisms to manage congestion efficiently.

 

3.11 HTTP/3 Advantages

Let's summarize the major advantages of HTTP/3.

 

a. Reduced Connection Establishment Latency

QUIC combines transport establishment and TLS negotiation, reducing the number of round trips required to establish a secure connection.

 

b. No TCP-Level Head-of-Line Blocking

Independent QUIC streams can make progress without waiting for packet retransmission on unrelated streams.

 

c. Connection Migration

Clients can maintain connections while switching between networks, even when their IP addresses change.

 

d. Built-in Encryption

TLS 1.3 is integrated into QUIC, making encryption a fundamental part of connection establishment.

 

e. Improved Performance on Unreliable Networks

HTTP/3 can perform better on networks with packet loss because loss affecting one stream does not block unrelated streams.

 

f. Easier Transport Evolution

QUIC is commonly implemented in user space, allowing transport protocol improvements to be deployed without depending entirely on operating system TCP updates.

 

3.12 HTTP/3 Drawbacks and Challenges

Although HTTP/3 offers several advantages, it also introduces certain challenges.

 

a. Compatibility

Older browsers, servers, operating systems, proxies, and network infrastructure may not support HTTP/3. Although modern browser and server support is widespread, compatibility still needs to be considered.

 

b. Implementation Complexity

QUIC is more complex than traditional UDP communication because it implements reliability, congestion control, encryption, stream management, and connection migration. This increases implementation and troubleshooting complexity.

 

c. UDP Restrictions

Some corporate firewalls, proxies, and network environments block or restrict UDP traffic. In such situations, clients may fall back to HTTP/2 or HTTP/1.1 over TCP.

 

d. Resource Consumption

QUIC implementations may introduce additional CPU and memory overhead, particularly because of encryption, packet processing, and per-connection state management. The actual resource impact depends on the implementation and workload.

 

e. Operational Visibility

Because QUIC encrypts much of its transport information, traditional network monitoring tools that rely on inspecting TCP headers may have reduced visibility. Monitoring infrastructure needs to support QUIC-aware analysis.

 

f. Performance Is Not Always Better

HTTP/3 is not guaranteed to outperform HTTP/2 in every scenario. For example, on a stable, low-latency network with no packet loss, HTTP/2 may perform similarly or sometimes better depending on the workload and implementation.

 

3.13 HTTP/1.1 vs HTTP/2 vs HTTP/3

Feature

HTTP/1.1

HTTP/2

HTTP/3

Transport

TCP

TCP

UDP via QUIC

Multiplexing

No (in normal usage)

Yes

Yes

Header Compression

No standard compression

HPACK

QPACK

HOL Blocking

Application-level

TCP-level

No cross-stream transport HOL

Connection Setup

TCP handshake

TCP handshake

QUIC handshake

Encryption

Optional TLS

Optional TLS

Mandatory TLS 1.3

Connection Migration

No

No

Yes

Stream Independence

No

Limited by TCP

Yes

Congestion Control

TCP

TCP

QUIC

 

3.14 When Should We Use HTTP/3?

HTTP/3 is particularly beneficial for applications that operate over networks with variable latency, packet loss, or frequent network changes.

 

Examples include:

-       Mobile applications

-       Video streaming platforms

-       E-commerce websites

-       Real-time web applications

-       Large content delivery networks (CDNs)

-       Websites serving users across geographically distributed regions

 

However, HTTP/3 adoption should be based on actual workload characteristics and performance measurements. Most modern deployments support protocol negotiation and fallback mechanisms, allowing clients and servers to use HTTP/3 where available and HTTP/2 or HTTP/1.1 otherwise.

 

Conclusion

HTTP has evolved significantly from HTTP/1.1 to HTTP/3.

 

HTTP/1.1 introduced persistent connections, HTTP/2 introduced multiplexing, and HTTP/3 introduced QUIC to address the transport-level limitations of TCP.

 

The biggest innovation in HTTP/3 is not simply replacing TCP with UDP. It is introducing a modern transport protocol that provides reliable delivery, independent streams, faster connection establishment, connection migration, and integrated encryption.

 

As mobile applications, cloud platforms, APIs, and globally distributed services continue to grow, HTTP/3 provides a strong foundation for efficient and secure web communication.

 

Key takeaway: HTTP/3 uses QUIC over UDP to provide reliable, encrypted, multiplexed communication while avoiding TCP-level Head-of-Line blocking.


You may like

Interview Questions

Calculating initial capacity from expected size and load factor

A Beginner's Guide to UUID Types

Implementing LRU Cache in Java Using HashMap and Doubly Linked List

Private IP Addresses – A Complete Guide

Sticky Sessions in System Design

GeoDNS Routing in System Design: A Beginner-Friendly Guide

No comments:

Post a Comment