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.
[..]
我对“SHOULD”一词特别不确定……它的意义是什么?为什么?
我知道HTTP持久连接(也称为HTTP keep-alive)是使用相同的TCP连接发送和接收多个HTTP请求/响应的想法,而不是为每个单独的请求/响应对打开一个新的连接。我知道使用持久连接对于提高HTTP性能非常重要。
- 2个连接限制每个服务器是否预定义?
- 何时请求将使用现有连接或获取新连接?
假设我有一个包含以下图像引用的HTML页面:
<img src="http://example.com/image1.gif"/>
<img src="http://example.com/image2.gif"/>
<img src="http://example.com/image3.gif"/>
<img src="http://example.com/image4.gif"/>
我的服务器启用了keep-alive指令:在持久连接方面会发生什么?与2个同时连接每个服务器限制相关的优化规则/技巧是否有效?
<img src="http://example.com/image1.gif"/>
<img src="http://example.com/image2.gif"/>
<img src="http://example2.com/image3.gif"/>
<img src="http://example2.com/image4.gif"/>
thanks