1

I am trying to do some load testing and I was told that as parameters for testing, I should include both the number of concurrent requests and the number of concurrent connections. I really don't understand how there can be multiple requests on a given connection. When a client requests a webpage from a server, it first opens a connection, sends a request and gets a reponse and then closes a connection. What am I missing here?

UPDATE: I meant to ask how it was possible for a single connection to have multiple requests concurrently (meaning simultaneously.) Otherwise, what would be the point of measuring both concurrent requests and concurrent connections? Would counting both of them be helpful in knowing how many connections are idle at a time? I realize that a single connection can handle more than one request consecutively, sorry for the confusion.

4

2 回答 2

2

HTTP 支持一种称为流水线的功能,它允许浏览器通过单个连接向服务器发送多个请求,而无需等待响应。服务器必须支持这一点。IIRC,服务器必须向请求发送一个特定的响应,表明“是的,我会回答这个请求,你可以在等待的时候继续发送其他请求”。上次我查看时(很多年前),Firefox 是唯一支持流水线的浏览器,默认情况下它是关闭的。

还值得注意的是,即使没有流水线,并发连接也不等于并发请求,因为您可以打开当前空闲的连接(没有待处理的请求)。

于 2013-08-15T14:23:54.173 回答
0

服务器可以保持单个连接打开以服务多个请求。请参阅http://en.wikipedia.org/wiki/HTTP_persistent_connection。它描述了 HTTP 持久(也称为 keep-alive)连接。这个想法是,如果您发出多个请求,它会消除一些建立和拆除新连接的开销。

于 2013-08-11T13:49:34.117 回答