How to increase Requests/second with a constant execution time for Asp.NET?

1.7k Views Asked by At

I have a web application which is suffering because of low requests/sec under moderate traffic. The average request execution time is around 200ms per page.

To simulate the environment, I created a super simple test page in an Asp.NET 4.0 web application with one line of code.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    System.Threading.Thread.Sleep(200)
End Sub

I published it to a server with 4 core cpu, 8GB RAM, Win7 Enterprise 64 bit, clean install.

Then I created a super simple console application which will put some load on this test page.

    For i = 1 To 100
        For j = 1 To 100
            Dim client = New System.Net.WebClient

            client.DownloadStringAsync(New Uri(address))
        Next
        Threading.Thread.Sleep(1000)
    Next

I opened the performance monitor and observed Requests/sec. It was always 50 no matter what I tried to do to increase it. All the hardware usage (CPU, memory) was very low, so there must be enough room to increase it.

I changed the processModel in the machine.config as below with no luck.

<processModel autoConfig="false" maxWorkerThreads="1000" maxIoThreads="1000" minWorkerThreads="500" minIoThreads="500" />

So, what I need to do to utilize my full hardware and increase the processed requests per second?

1

There are 1 best solutions below

0
On

If you were only working with a single thread on the server side you would get 1000/200 = 5 requests per second. But you're getting 50. So it seems like the server is allowing you to have multiple threads, just not enough of them.

Or perhaps your client app isn't launching enough threads to max out the server. Part of the problem here is that you're testing two applications at the same time.

One solution to this is to use a tried-and-true web performance tool. Here's a question on SO that will give you some options there:

ASP.NET Stress Testing

Once you have ascertained that it is in fact your server-side application that's the problem let us know and we can further investigate.