在HTTP 1.1 Spec中针对Persistent Connections提出了这样的Practical considerations:
Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.
以上内容表明,为了提高HTTP响应时间以及避免产生网络堵塞,HTTP连接中的客户端不应该与服务器端建立超过2个的HTTP连接。如果有更多的请求需要,那么这些请求将被pipeline到这两个HTTP连接之中,并以异步的方式传送给服务器端。举个例子:有上百辆汽车(requests)想从天津开往北京,但是天津与北京之间最多只允许修建两条公路(HTTP connection),因此这些汽车要想从天津驶往北京的话,就只能走这两条公路。
阅读(1579) | 评论(0) | 转发(0) |