DEV Community

Cover image for HTTP/2: The Protocol That Stopped the Connection Explosion
Anik Sikder
Anik Sikder

Posted on • Originally published at aniksikder.hashnode.dev

HTTP/2: The Protocol That Stopped the Connection Explosion

In the previous article, we explored why HTTP/1.1 eventually became a bottleneck.

The web had evolved from a collection of simple documents into a platform for complex applications.

Browsers were no longer requesting a handful of files.

They were requesting hundreds.

To cope with these growing demands, browser vendors adopted a workaround:

Browser
 ├── TCP Connection 1
 ├── TCP Connection 2
 ├── TCP Connection 3
 ├── TCP Connection 4
 ├── TCP Connection 5
 └── TCP Connection 6
Enter fullscreen mode Exit fullscreen mode

The strategy worked.

Pages loaded faster.

Users were happier.

But underneath the surface, a new problem was emerging.

The web was becoming dependent on opening more and more connections just to maintain acceptable performance.

Engineers realized something important:

The problem wasn't the network. The problem was how HTTP used the network.

HTTP/2 was created to rethink that relationship.


The Fundamental Shift

HTTP/1.1 was built around a relatively simple assumption:

Request
↓
Response
Enter fullscreen mode Exit fullscreen mode

Repeat this process enough times and eventually the page loads.

HTTP/2 challenged that model.

Instead of asking:

How can we create more connections?

It asked:

How can we make a single connection dramatically more efficient?

That single idea shaped the entire protocol.


Why More Connections Were Never the Real Solution

Imagine managing a warehouse.

You receive 1,000 orders per hour.

One approach is to hire more managers.

Another approach is to improve the workflow.

HTTP/1.1 effectively chose the first option.

More traffic?

Open more TCP connections.

Need more resources?

Open even more connections.

The result was increasing overhead:

  • More TCP handshakes

  • More memory allocation

  • More connection state tracking

  • More CPU usage

  • More congestion on busy networks

Performance improved, but efficiency suffered.

HTTP/2 aimed to solve the workflow problem instead.


The Birth of Multiplexing

The most important innovation in HTTP/2 is multiplexing.

To understand why, imagine ordering five items from a warehouse:

1. HTML
2. CSS
3. JavaScript
4. Product Images
5. Fonts
Enter fullscreen mode Exit fullscreen mode

In HTTP/1.1, resources often competed with one another.

In HTTP/2, requests become independent streams.

TCP Connection
│
├── Stream 1 → HTML
├── Stream 2 → CSS
├── Stream 3 → JavaScript
├── Stream 4 → Images
└── Stream 5 → Fonts
Enter fullscreen mode Exit fullscreen mode

All streams share the same connection.

Instead of waiting for one resource to finish before another can progress, data from multiple streams can be interleaved.

This means the server can send:

HTML Chunk
CSS Chunk
Image Chunk
JavaScript Chunk
HTML Chunk
Font Chunk
Image Chunk
Enter fullscreen mode Exit fullscreen mode

The browser reassembles everything correctly.

This seemingly simple change transformed web performance.


What Actually Happens Under the Hood?

Multiplexing is often explained as:

Multiple requests at the same time.

While technically true, it misses the interesting part.

HTTP/2 introduces a concept called frames.

Every request and response is broken into smaller units called frames.

Request
    ↓
 Frames
    ↓
 Stream
    ↓
 Connection
Enter fullscreen mode Exit fullscreen mode

Think of a large book being split into hundreds of pages.

Instead of delivering one complete book at a time, pages from many books can travel together.

Example:

Frame A1
Frame B1
Frame C1
Frame A2
Frame B2
Frame C2
Enter fullscreen mode Exit fullscreen mode

The browser knows which frame belongs to which stream.

This allows continuous utilization of the connection.

Idle time drops dramatically.

Bandwidth utilization improves.


Binary Framing: The Invisible Revolution

One of the biggest architectural changes in HTTP/2 is something users never see.

HTTP/1.1 is text-based.

A request looks like this:

GET /products HTTP/1.1
Host: example.com
Enter fullscreen mode Exit fullscreen mode

Humans can read it.

Computers can read it too.

But computers don't naturally think in text.

They think in binary.

HTTP/2 introduces a binary framing layer.

Instead of transmitting textual messages directly:

HTTP Message
        ↓
Binary Frames
        ↓
TCP
Enter fullscreen mode Exit fullscreen mode

This allows:

  • Faster parsing

  • More predictable processing

  • Reduced protocol complexity

  • Better performance under heavy traffic

The protocol becomes easier for machines to handle efficiently.


Header Compression: Solving a Hidden Cost

As websites grew, headers became surprisingly large.

Consider a modern request:

Cookie: ...
Authorization: ...
User-Agent: ...
Accept-Language: ...
Cache-Control: ...
Enter fullscreen mode Exit fullscreen mode

Many of these values repeat across requests.

In HTTP/1.1, they are often transmitted repeatedly.

This creates waste.

HTTP/2 introduces HPACK.

HPACK maintains a dynamic table of previously transmitted header values.

Instead of sending:

Authorization: Bearer abc123...
Enter fullscreen mode Exit fullscreen mode

Again and again, the client can reference a previously stored value.

Conceptually:

Header Table

#1 Authorization
#2 Cookie
#3 User-Agent
Enter fullscreen mode Exit fullscreen mode

Future requests simply reference the index.

Less data travels over the network.

Latency decreases.

Bandwidth usage improves.


Prioritization: Not All Resources Are Equal

Imagine loading an e-commerce homepage.

Which resource matters first?

Hero Image
Product Grid
Analytics Script
Tracking Pixel
Chat Widget
Enter fullscreen mode Exit fullscreen mode

Clearly not everything has equal importance.

HTTP/2 allows streams to carry priority information.

The browser can effectively say:

Render the visible page first.

Fetch less important resources later.

This improves perceived performance.

Users see content sooner.


Did HTTP/2 Eliminate Head-of-Line Blocking?

This is where things become interesting.

Many developers assume HTTP/2 completely solved Head-of-Line Blocking.

It didn't.

It solved one version of it.

HTTP-level blocking was dramatically reduced through multiplexing.

However, HTTP/2 still runs on TCP.

TCP guarantees ordered delivery.

Consider:

Packet 1
Packet 2
Packet 3
Packet 4
Packet 5
Enter fullscreen mode Exit fullscreen mode

If Packet 3 is lost:

Packet 4 waits
Packet 5 waits
Enter fullscreen mode Exit fullscreen mode

Even if those packets belong to different streams.

The operating system cannot deliver later packets until the missing packet arrives.

This creates TCP-level Head-of-Line Blocking.

HTTP/2 improved the application layer.

But the transport layer still had limitations.


Real-World Impact

HTTP/2 fundamentally changed how modern websites are delivered.

Benefits included:

  • Fewer TCP connections

  • Lower network overhead

  • Better bandwidth utilization

  • Faster page rendering

  • Improved mobile performance

  • Reduced server resource consumption

For large-scale applications serving millions of users, these improvements were substantial.

HTTP/2 became one of the most important protocol upgrades in the history of the web.


The Remaining Problem

HTTP/2 solved many issues that plagued HTTP/1.1.

But one major bottleneck survived.

TCP itself.

As mobile usage exploded and network conditions became less predictable, packet loss became increasingly expensive.

Engineers began asking a new question:

What if the transport layer itself needed to change?

That question eventually led to QUIC.

And QUIC became the foundation of HTTP/3.


Key Takeaways

  • HTTP/2 was designed to eliminate the inefficiencies of HTTP/1.1.

  • Multiplexing allowed multiple streams to share a single connection.

  • Binary framing made communication more machine-efficient.

  • HPACK reduced repetitive header transmission.

  • Stream prioritization improved perceived page performance.

  • HTTP-level Head-of-Line Blocking was largely solved.

  • TCP-level Head-of-Line Blocking remained.

  • That remaining limitation ultimately inspired HTTP/3.

One-Sentence Summary

HTTP/1.1 scaled by opening more connections; HTTP/2 scaled by making a single connection smarter.

Top comments (0)