Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the per-host connection limit raised with HTTP/2?

Browsers have a per-host limit regarding number of parallel XHR (about 6 nowadays).

Does this restriction apply to multiplexed HTTP/2 connections?

like image 690
Warren Seine Avatar asked Apr 25 '16 08:04

Warren Seine


People also ask

Is http 2 persistent connection?

As a result, all HTTP/2 connections are persistent, and only one connection per origin is required, which offers numerous performance benefits.

Why HTTP2 is not widely used?

First, because they received requests in large batches instead of smaller, more spread-out batches. And secondly, because with HTTP/2, the requests were all sent together—instead of staggered like they were with HTTP/1.1—so their start times were closer together, which meant they were all likely to time out.

How does HTTP 2 improve latency?

The primary goals for HTTP/2 are to reduce latency by enabling full request and response multiplexing, minimize protocol overhead via efficient compression of HTTP header fields, and add support for request prioritization and server push.

Does http 2 improve performance?

In particular, HTTP/2 is much faster and more efficient than HTTP/1.1. One of the ways in which HTTP/2 is faster is in how it prioritizes content during the loading process.


1 Answers

Browsers impose a per-domain limit of 6-8 connections when using HTTP/1.1, depending on the browser implementation. This allows at most 6-8 concurrent requests per domain.

With HTTP/2, browsers open only 1 connection per domain. However, thanks to the multiplexing feature of the HTTP/2 protocol, the number of concurrent requests per domain is not limited to 6-8, but it is virtually unlimited.

It is virtually unlimited in the sense that browsers and servers may limit the number of concurrent requests via the HTTP/2 configuration parameter called SETTINGS_MAX_CONCURRENT_STREAMS.

Typical limits are around 100 (Firefox's default value for network.http.spdy.default-concurrent - note the spdy name here: it was the protocol ancestor of the HTTP/2 protocol) but could be larger (or, less commonly, smaller), depending on browser implementation and on the server you connect to.

Expect these limits to vary over the years with the evolution and the more widespread usage of HTTP/2 (in the same way it happened with HTTP/1.1: browsers started with 2 connections, and ended up to 6-8 after years of usage, experience and tuning).

I don't think there is any difference between how a browser treats the number of connections and concurrent requests for normal browsing and for the usage of XHR, so the explanations above holds true for XHR as well.

like image 105
sbordet Avatar answered Sep 22 '22 14:09

sbordet