views:

97

answers:

3

Situation: My ASP.net application connects to another system for information via a TCP Connection

I am trying to simulate 100 people sitting & logging to my ASP.net application at the same time and connecting to the TCP Connection

Will creating a windows Application with 100 threads trying to connect to the TCP Connection provide the correct simulation/exact results

OR

Does ASP.net handle different instances differently.

+4  A: 

ASP.NET has a pool of "worker threads" which it will allocate to new requests until the pool runs out. Requests are then queued to wait until a worker thread gets returned to the pool (by its previous request ending one way or another).

By default I believe there are 20 available. Microsoft's recommended maximum is 100.

So, to answer your question - if configured as such, your web application could feasibly have (roughly) 100 threads simultaneously making TCP requests (though note the actual TCP operation is done on an I/O thread, so technically the actual number of threads that are connecting to the destination may be slightly less).

Rex M
There are many other factors you will also want to consider. Using a single machine to call your application does not factor in network latency among other factors. I would consider using a testing framework such as Visual Studio for testers, LoadRunner, or similar load testing software.
Chris Ballance
+2  A: 

Is a new thread created for every asp.net request?

My understanding of the request pipeline is not perfect, so this may not be 100% accurate. But as I understand it, a new thread is not created every time. It uses a pool of threads, and so you might re-use a thread from a previous request or you might even have to wait a few milliseconds for a thread in the pool to come available. So a new thread is created if the pool is not full.

Joel Coehoorn
A: 

If you are writing an application to test the load using .NET 3.5 SP1, and are testing it by using the HttpWebRequest to hit the page, make sure you include the settings in your app.config to increase the concurrent connection limit to a single web server beyond the default of 2. That being said, you'll likely have to hit the web server from multiple machines to generate an appreciable amount of load to really test the server capacity.

<?xml version="1.0" encoding="utf-8" ?>
<configuration> 
  <system.net> 
    <connectionManagement> 
      <add address="*" maxconnection="100" /> 
    </connectionManagement> 
  </system.net> 
</configuration>

And as others have said above, be sure you thread limits for the ASP.NET web site are also set equally high.

Chris Patterson