The Bottleneck of HTTP/1
With HTTP/1.1, browsers impose a connection limit per domain. Take Chrome, for instance; the limit is 6 concurrent TCP connections per domain. This means that when a website makes more than 6 requests to the same domain, the remaining requests are queued until an existing connection is freed up.
To handle this, HTTP/1.1 attempted pipelining, a strategy that allows multiple requests to be sent over the same TCP connection without waiting for the corresponding responses. However, the limitation is that the server should send its responses in the same order in which requests are received, which led to head-of-line (HOL) blocking—a slow response could delay all subsequent responses on the same connection.
Due to compatibility issues and poor implementation in servers, pipelining was not widely implemented by browsers and was disabled by default, and HTTP/1.1 instead relied on multiple parallel connections to improve performance.
How HTTP/2 Solves This
With HTTP/2, browsers establish a single TCP connection per domain, over which multiple streams (requests) can be sent concurrently. This eliminates the per-domain connection bottleneck and improves efficiency by allowing unlimited parallel requests.
Key Improvements in HTTP/2:
Single Connection, Multiple Streams: Instead of multiple TCP connections, HTTP/2 uses a single connection per domain. Within this connection, multiple streams handle different requests.
No Max Connection Limit: Since all requests share the same connection, theoretically, the number of parallel requests is unlimited.
Stream Multiplexing: Multiple requests can be sent in parallel without waiting for others to complete, fixing the HOL blocking issue.
And much more. Refer to the article by DigitalOcean for a detailed comparison between HTTP/1 and HTTP/2. https://www.digitalocean.com/community/tutorials/http-1-1-vs-http-2-what-s-the-difference
Unlimited Streams but Not Unlimited
The HTTP/2 RFC (RFC 7540) specifies that the minimum recommended concurrent streams per connection is 100, which is defined by a parameter SETTINGS_MAX_CONCURRENT_STREAMS. This means that, at a minimum, a single domain can handle at least 100 parallel requests. However, the maximum number of streams is ultimately controlled by the browser and can vary based on its configuration and implementation.
Final Thoughts
HTTP/2 provides a major upgrade over HTTP/1.1 by eliminating per-domain connection limits and introducing multiplexed streams. By understanding how these improvements work, developers can optimize their applications for better performance and efficiency.
Top comments (0)