HTTP pipelining

HTTP pipelining is a technique in which multiple HTTP requests are sent on a single TCP connection without waiting for the corresponding responses.[1]
The pipelining of requests results in a dramatic improvement[2] in the loading times of HTML pages, especially over high latency connections such as satellite Internet connections. The speedup is less apparent on broadband connections, as the limitation of HTTP 1.1 still applies: the server must send its responses in the same order that the requests were received — so the entire connection remains first-in-first-out[1] and HOL blocking can occur. The asynchronous operation of the upcoming HTTP 2.0 or SPDY could be a solution for this.[3]
Non-idempotent methods like POST should not be pipelined. Sequences of GET and HEAD requests can always be pipelined. A sequence of other idempotent requests like GET, HEAD, PUT and DELETE can be pipelined or not depending on whether requests in the sequence depend on the effect of others.[4]
HTTP pipelining requires both the client and the server to support it. HTTP/1.1 conforming servers are required to support pipelining. This does not mean that servers are required to pipeline responses, but that they are required not to fail if a client chooses to pipeline requests.



HTTP管线化 是一项技术使多个HTTP请求被发送于一个TCP连接中而不用等待接收匹配的响应。

而请求管线化会带来一个激动人心的改善是减少HTML页面的加载时间,尤其是再高的延迟下,比如卫星的互联网通讯。加速效果在宽带上不明显,由于HTTP1.1依旧在使用的限制:服务器必须根据收到的请求顺序发送它的响应-

所以整个的连接依然遵循 先进先出的原则 线头阻塞就会发生。HTTP2.0的异步处理方式 或spdy 可能会解决这个问题。非幂等 方法像 post 应该被管线化,有序的GET和HEAD请求也可以被管线化。一些列别的等幂请求 像GET,HEAD,PUT和DELETE可以被管线化或不,取决于序列中的请求是否依赖于别的请求的结果。

HTTP 管线化需要客户端和服务器端的同时支持。HTTP/1.1规范的服务器被要求支持管线化。这不等于服务器被要求管线化响应,而是他们被要求不能在客户端选择管线化请求时出现错误。


idempotent(幂等):

对某一个操作进行两次成功的操作,其结果都一样,就像只调用了一次一样,那么这个操作就是idempotent操作。例如,x = 1; 是一个idempotent操作因为不管执行了一次还是两次,x的值都是1。换句话说,x += 1;就不是一个idempotent操作,因为它执行了两次后,结果不同了。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值