`
hideto
  • 浏览: 2649594 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

HTTP1.1 Notes 5, Connections

阅读更多
Persistent Connections
advantages:
      - By opening and closing fewer TCP connections, CPU time is saved
        in routers and hosts (clients, servers, proxies, gateways,
        tunnels, or caches), and memory used for TCP protocol control
        blocks can be saved in hosts.

      - HTTP requests and responses can be pipelined on a connection.
        Pipelining allows a client to make multiple requests without
        waiting for each response, allowing a single TCP connection to
        be used much more efficiently, with much lower elapsed time.

      - Network congestion is reduced by reducing the number of packets
        caused by TCP opens, and by allowing TCP sufficient time to
        determine the congestion state of the network.

      - Latency on subsequent requests is reduced since there is no time
        spent in TCP's connection opening handshake.

      - HTTP can evolve more gracefully, since errors can be reported
        without the penalty of closing the TCP connection. Clients using
        future versions of HTTP might optimistically try a new feature,
        but if communicating with an older server, retry with old
        semantics after an error is reported.

主流浏览器都支持persistent connection
像Firefox里就可以设置network.http.max-persistent-connections-per-server参数,默认为6
network.http.keep-alive.timeout参数默认为300ms

An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to maintain a persistent connection unless a Connection header including the connection-token "close" was sent in the request
If the server chooses to close the connection immediately after sending the response, it SHOULD send a Connection header including the connection-token close

An HTTP/1.1 client MAY expect a connection to remain open, but would decide to keep it open based on whether the response from a server contains a Connection header with the connection-token close
In case the client does not want to maintain a connection for more than that request, it SHOULD send a Connection header including the connection-token close

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

It is especially important that proxies correctly implement the properties of the Connection header field
The proxy server MUST signal persistent connections separately with its clients and the origin servers (or other proxy servers) that it connects to
Each persistent connection applies to only one transport link

Message Transmission Requirements
HTTP/1.1 servers SHOULD maintain persistent connections and use TCP's flow control mechanisms to resolve temporary overloads, rather than terminating connections with the expectation that clients will retry

An HTTP/1.1 (or later) client sending a message-body SHOULD monitor the network connection for an error status while it is transmitting the request
If the client sees an error status, it SHOULD immediately cease transmitting the body

The purpose of the 100 (Continue) status is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body

If an HTTP/1.1 client sends a request which includes a request body, but which does not include an Expect request-header field with the "100-continue" expectation, and if the client is not directly connected to an HTTP/1.1 origin server, and if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request
If the client does retry this request, it MAY use the "binary exponential backoff" algorithm to be assured of obtaining a reliable response
分享到:
评论

相关推荐

    jKill#basic-notes#简述 HTTP 1.0,1.1,2.0 的主要区别1

    1.1支持长连接(Persistent connections) 1.1支持分块编码(chunked-encoding) 1.1支持缓存 1.1支持压缩和解压缩

    Computer Age Statistical Inference: Algorithms,Evidence,and Data Science.

    1.1 A Regression Example 4 1.2 Hypothesis Testing 8 1.3 Notes 11 2 Frequentist Inference 12 2.1 Frequentism in Practice 14 2.2 Frequentist Optimality 18 2.3 Notes and Details 20 3 Bayesian Inference ...

    python3.6.5参考手册 chm

    PEP 314: Metadata for Python Software Packages v1.1 PEP 328: Absolute and Relative Imports PEP 338: Executing Modules as Scripts PEP 341: Unified try/except/finally PEP 342: New Generator Features...

    ZendFramework中文文档

    Notes Regarding Cascading Operations 11. Zend_Debug 11.1. 输出变量的值 (Dumping Variables) 12. Zend_Exception 12.1. 使用“异常” 13. Zend_Feed 13.1. 介绍 13.2. 导入Feeds 13.2.1. 定制 feeds ...

    Oracle sqldeveloper without jdk (win+linux)

    Release Notes 完整版下载:http://www.oracle.com/technology/global/cn/software/products/sql/index.html 1. Known Issues 1.1 General - Print prints only one page that is a truncation of the current ...

    Implementing 802.1X Security Solutions for Wired and Wireless Networks.pdf

    Review Release Notes 174 Establish a Server 175 System Requirements 175 Physical Location 175 Verify Network Connections 176 Configure Administrator Account Access 176 Security Tips 182 Install the ...

    Practical Mod Perl

    Introducing CGI and mod_perl Section 1.1. A Brief History of CGI Section 1.2. The Apache 1.3 Server Model Section 1.3. The Development of mod_perl 1.0 Section 1.4. Apache 1.3 ...

    Fundamentals of Wireless Communication 无线通信基础 英文版

    1.1 Book Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.2 Wireless Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3 Book Outline . . . . . . . ....

    java7帮助文档

    RowSet 1.1: The introduction of the RowSetFactory interface and the RowSetProvider class, which enable you to create all types of row sets supported by your JDBC driver; see Using the RowSetFactory ...

    Matplotlib.pdf

    13.1 Event connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 13.2 Event attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

    MySQL 5.6 Reference Manual

    Preface, Notes, Licenses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

    CIS_Solaris_10_Benchmark_v5.0.0

    1.1 Use the Latest OS Release .............................................................................................................. 13 1.2 Apply Latest OS Patches ...............................

Global site tag (gtag.js) - Google Analytics