非串行流水线HTTP可能吗? [英] Non-serial pipelined HTTP possible?

查看:79
本文介绍了非串行流水线HTTP可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RFC 2616 第8.1.2.2节状态:

RFC 2616 section 8.1.2.2 states:


支持持久连接的客户端可以管道化其请求(即,在不等待每个响应的情况下发送多个请求)。服务器必须将其响应发送到以相同的顺序收到请求。

A client that supports persistent connections MAY "pipeline" its requests (i.e., send multiple requests without waiting for each response). A server MUST send its responses to those requests in the same order that the requests were received.

串行响应经常弊大于利,因为串行响应实际上是要求服务器执行更多处理 并否定流水线技术带来的性能优势。

Serial responses are often more harm than good, since serial responses actually require the server to do more processing and negates the performance benefits gained by pipelining.

例如,如果HTTP客户端请求文件1.jpg,2.jpg,3.jpg,4.jpg和5。如果在.jpg之前返回3.jpg,或者如果在.jpg之前返回4.jpg,则无关紧要。客户只需要在任何订单中提供响应即可。

For example, if a HTTP client requests for files 1.jpg, 2.jpg, 3.jpg, 4.jpg, and 5.jpg, it doesn't matter if 3.jpg is returned before 1.jpg, or if 4.jpg is returned before 3.jpg. The client simply want the responses as soon as they are available, in any order.

HTTP客户端如何获得流水线操作的好处,同时又不支付响应排队的缺点?

How can a HTTP client gain the benefits of pipelining, and at the same time not pay for the disadvantages of response queueing?

推荐答案

客户端无法规避HOL排队,因为它是RFC 2616的一部分。流水线技术的唯一好处(在我看来)是极其具体和狭窄的情况。考虑:

A client can't circumvent HOL-queueing as it's part of RFC 2616. The only benefit of pipelining (in my opinion) is in extremely specific and narrow cases. Consider:

R 1 成本 = 请求A 处理成本。

R 2 成本 = 请求B 处理成本。

TCP cost =协商新TCP连接的成本。

R1cost = Request A processing cost.
R2cost = Request B processing cost.
TCPcost = Cost of negotiating new TCP connection.

因此,在特定情况下使用流水线技术是可行的:

Using pipelining would, therefore, be viable in specific cases where:


R 1 成本 R 2 成本 TCP 成本

R1costR2costTCPcost

请求比以前的请求更昂贵,并且比协商新的TCP连接便宜?不经常。我想补充一点,Websockets(到目前为止)是一个更有趣和更合适的解决方案(就并行后端处理而言)。

How often is a request more expensive than a previous request and less expensive than negotiating a new TCP connection? Not often. I would add that Websockets are (by far) a more interesting and appropriate solution (as far as parallel back-end processing is concerned).

这篇关于非串行流水线HTTP可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆