问题
Is it because it requires the responses to be made to client in the order of request that causes the head of line blocking problem in HTTP 1.1?
If each request takes exactly an equal amount of time, then there won't be head of line blocking and HTTP 1.1 pipelining and would perform same as that of HTTP/2 multiplexing?
(let's say there is no request priority in HTTP/2 requests and disregard other changes of HTTP/2 such as header compression, binary, etc.)
回答1:
HTTP/1.1 pipelining still requires the requests to be returned in full, in the order requested.
HTTP/2 allows the requests responses to be split into chunks and be returned in an intermingled fashion so avoiding head of line blocking.
Additionally HTTP/1.1 pipelining never really took off and browser and server support is limited (see: https://en.m.wikipedia.org/wiki/HTTP_pipelining).
But yes, in theory, they are similar and hence give similar performance benefits. HTTP/2 is just a better, more fully featured, more supported version of this - along with other benefits that you've noted.
回答2:
HTTP/1.1 without pipelining: Each HTTP request over the TCP connection must be responded to before the next request can be made.
HTTP/1.1 with pipelining: Each HTTP request over the TCP connection may be made immediately without waiting for the previous request's response to return. The responses will come back in the same order.
HTTP/2 multiplexing: Each HTTP request over the TCP connection may be made immediately without waiting for the previous response to come back. The responses may come back in any order.
回答3:
I think to elaborate, both offer similar performance improvements.
However pipelining (or double buffering) is hampered by buggy proxies and sometimes buggy servers. So browsers stopped supporting it.
The solution is to use a completely new protocol HTTP/2. This has a few extra features, such as out of order return, header compression and server push, but it is unclear how much improvement they provide. The key issue is the bugs.
来源:https://stackoverflow.com/questions/34478967/what-is-the-difference-between-http-1-1-pipelining-and-http-2-multiplexing