views:

19

answers:

1

Hi,

I am trying to write a load-testing client for a web service server I've wrote. The client interacts with the server using HTTP.

The regular clients for my service should use HTTP keep alive (by using HTTP 1.1 and not setting the KeepAlive value to false in HttpWebRequest) so that their TCP connections stay up for later HTTP requests. Each client does a synchronous request/response at the start to authenticate, then moves on to asynchronous requests.

In my load test I want to have hundreds of simulated clients all sending requests to the same server. But, if I don't set KeepAlive to false in my HttpWebRequests, ALL of the simulated clients apparently try and use the SAME TCP connection, and I get stalls in my load test as they slowly try to share the connection to do their initial synchronous requests. I do not believe that making the first request asynchronous will fix this, I've tried it before and got the same stall in the BeginGetResponse() call (which is supposed to return immediately but doesn't), because it's waiting to get onto the shared connection I think.

Is there some way to make sure each of my "clients" in my load test gets their own TCP connection, which they re-use for future HttpWebRequests?

Someone had a similar question here: http://stackoverflow.com/questions/562526/httpwebrequest-timeout-in-3-5sp1 which they solved by using KeepAlive = false, but that isn't good enough for me because this server is going to have a huge volume and I want to keep the network data transfer to a minimum.

A: 

The connection limit might vary depending on the underlying operating system /hosting environment. It can be changed programmatically by setting HttpWebRequest.ServicePoint.ConnectionLimit to a higher value, or in one of .NET's .config files

Tinku
It is recommended that a client application should not use more than 2 persistent connection at a time (http://www.faqs.org/rfcs/rfc2616.html)
Tinku
The connection limit doesn't matter, I'm not hitting it. The problem is that the same TCP connection is being re-used over and over and I don't have fine enough control over which TCP connection is being used by a specific HTTP request. I suspect it's impossible, I'll just try using separate processes.
evilfred
Try compiling with .net 1.1 this is problem with 2.0
Tinku