HTTP管线化(HTTP pipelining)
默認情況下http協議中每個傳輸層連接只能承載一個http請求和響應,然后結束。
??? HTTP是一個簡單的協議??蛻暨M程建立一條同服務器進程的 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.
轉載于:https://www.cnblogs.com/dongzhiquan/archive/2011/01/03/1994525.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的HTTP管线化(HTTP pipelining)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 迷宫探索
- 下一篇: 《sql语句练习1》