HTTP管线化(HTTP pipelining)

简介:

    HTTP是一个简单的协议。客户进程建立一条同服务器进程的 T C P连接,然后发出请求并读取服务器进程的响应。服务器进程关闭连接表示本次响应结束。服务器进程返回的文件通常含有指向其他服务器上文件的指针(超文本链接)。用户显然可以很轻松地沿着这些链接从一个服务器到下一个服务器。 

HTTP管线化

    HTTP管线化是将多个HTTP要求(request)整批提交的技术,而在传送过程中不需先等待服务端的回应。管线化机制须通过永久连接(persistent connection)完成,仅HTTP/1.1支持此技术(HTTP/1.0不支持),并且只有GET和HEAD要求可以进行管线化,而POST则有所限制。此外,初次创建连接时也不应启动管线机制,因为对方(服务器)不一定支持HTTP/1.1版本的协议。

    浏览器将HTTP要求大批提交可大幅缩短页面的加载时间,特别是在传输延迟(lag/latency)较高的情况下(如卫星连接)。此技术之关键在于多个HTTP的要求消息可以同时塞入一个TCP分组中,所以只提交一个分组即可同时发出多个要求,借此可减少网络上多余的分组并降低线路负载。


[摘自W3C]

    在永久连接或者HTTP pipelining出现之前,每个连接的获取都需要创建一个独立的TCP连接。

    Prior to persistent connections, a separate TCP connection was established to fetch each URL, increasing the load on HTTP servers and causing congestion(拥塞) on the Internet.

[摘自维基百科]

    HTTP pipelining可以吧多个http请求输出到一个socket连接(倘若是基于socket的话,更确切的说应该是输出到一个传输层连接,在tcp ip中即为TCP连接)中去,然后等到对应的响应。

    HTTP pipelining is a technique in which multiple HTTP requests are written out to a single socket without waiting for the corresponding responses. Pipelining is only supported in HTTP/1.1, not in 1.0.
    
    The pipelining of requests results in a dramatic improvement in page loading times, especially over high latency connections such as satellite Internet connections.
    
    Since it is usually possible to fit several HTTP requests in the same TCP packet, HTTP pipelining allows fewer TCP packets to be sent over the network, reducing network load.
    
    Non-idempotent(非幂等) methods like POST should not be pipelined. Sequences of GET and HEAD requests can be always 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.[1]
    
    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.

Implementation in web servers 

    Implementing pipelining in web servers is a relatively simple matter of making sure that network buffers are not discarded between requests. For that reason, most modern web servers handle pipelining without any problem.
    Exceptions include IIS 4.

Implementation in web browsers 

    HTTP pipelining is disabled in most browsers.
    Opera has pipelining enabled by default. It uses heuristics to control the level of pipelining employed depending on the connected server.
    Internet Explorer 8 does not pipeline requests, due to concerns regarding buggy proxies and head-of-line blocking.
    Mozilla browsers (such as Mozilla Firefox, SeaMonkey and Camino), support pipelining however it is disabled by default.It uses some heuristics(测试试探), especially to turn pipelining off for IIS servers. does the same thing as Firefox.
    Konqueror 2.0 supports pipelining, but it's disabled by default.
    Google Chrome does not support pipelining.

Implementation in web proxies 
    Most HTTP proxies do not pipeline outgoing requests.
    Some versions of the Squid web proxy will pipeline up to two outgoing requests. This functionality has been disabled by default and needs to be manually enabled for "bandwidth management and access logging reasons."Squid supports multiple requests from clients.
    The Polipo proxy pipelines outgoing requests.




本文转自 dogegg250 51CTO博客,原文链接:http://blog.51cto.com/jianshusoft/626670,如需转载请自行联系原作者

相关文章
|
Rust JavaScript Unix
Nodejs 常见版本管理工具(nvm、n、fnm、nvs、nodenv)
Nodejs 常见版本管理工具(nvm、n、fnm、nvs、nodenv)
13454 0
Request Headers 中的 Accept 是 text/event-stream
Request Headers 中的 Accept 是 text/event-stream
2201 0
|
网络协议 应用服务中间件 网络安全
阿里云环境中TLS/SSL握手失败的场景分析
TLS/SSL握手是一个相对复杂的过程,在阿里云环境中结合产品,安全等特性,可能会让TLS/SSL握手过程的不定性更多。本文来总结下各种握手失败的场景。
阿里云环境中TLS/SSL握手失败的场景分析
|
存储 Linux 程序员
【Linux-14】进程地址空间&虚拟空间&页表——原理&知识点详解
【Linux-14】进程地址空间&虚拟空间&页表——原理&知识点详解
|
Web App开发 大数据 应用服务中间件
什么是 HTTP Range请求(范围请求)
HTTP Range 请求是一种非常有用的 HTTP 功能,允许客户端请求资源的特定部分,从而提高传输效率和用户体验。通过合理使用 Range 请求,可以实现断点续传、视频流播放和按需加载等功能。了解并掌握 HTTP Range 请求的工作原理和应用场景,对开发高效的网络应用至关重要。
1905 16
|
Dubbo Java 应用服务中间件
服务架构的演进:从单体到微服务的探索之旅
随着企业业务的不断拓展和复杂度的提升,对软件系统架构的要求也日益严苛。传统的架构模式在应对现代业务场景时逐渐暴露出诸多局限性,于是服务架构开启了持续演变之路。从单体架构的简易便捷,到分布式架构的模块化解耦,再到微服务架构的精细化管理,企业对技术的选择变得至关重要,尤其是 Spring Cloud 和 Dubbo 等微服务技术的对比和应用,直接影响着项目的成败。 本篇文章会从服务架构的演进开始分析,探索从单体项目到微服务项目的演变过程。然后也会对目前常见的微服务技术进行对比,找到目前市面上所常用的技术给大家进行讲解。
545 1
服务架构的演进:从单体到微服务的探索之旅
|
安全 Linux 网络安全
【工具使用】几款优秀的SSH连接客户端软件工具推荐FinalShell、Xshell、MobaXterm、OpenSSH、PUTTY、Terminus、mRemoteNG、Terminals等
【工具使用】几款优秀的SSH连接客户端软件工具推荐FinalShell、Xshell、MobaXterm、OpenSSH、PUTTY、Terminus、mRemoteNG、Terminals等
137849 0
|
存储 缓存 JSON
详解HTTP四种请求:POST、GET、DELETE、PUT
【4月更文挑战第3天】
74239 5
详解HTTP四种请求:POST、GET、DELETE、PUT
|
存储 缓存 负载均衡
图解一致性哈希算法,看这一篇就够了!
近段时间一直在总结分布式系统架构常见的算法。前面我们介绍过布隆过滤器算法。接下来介绍一个非常重要、也非常实用的算法:一致性哈希算法。通过介绍一致性哈希算法的原理并给出了一种实现和实际运用的案例,带大家真正理解一致性哈希算法。
28598 66
图解一致性哈希算法,看这一篇就够了!
|
算法 数据挖掘 区块链
HTTP/2 协议-HPACK(HTTP2 头部压缩)原理介绍
HTTP/2 协议-HPACK(HTTP2 头部压缩)原理介绍
1748 0

热门文章

最新文章