2

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?

sspekinc
  • 21
  • 3
  • you need to disable the session on pages that takes too much time of processing - or make download/upload that also takes some time. – Aristos Dec 17 '12 at 12:57
  • @Aristos session is disabled, all unnecessary httpmodules have been removed like session, windowsauthentication, passportauthentication, urlauthorization, fileauthorization etc. The web server and the console app are on the same network. The test environment is just an empty Asp.NET web application with a single test page in it. – sspekinc Dec 17 '12 at 14:29
  • Ok, then where is the delay - do you know what is delay your pages ? – Aristos Dec 17 '12 at 14:31
  • @Aristos I have put the delay deliberately by adding the line `Thread.Sleep(200)` into the Page_Load to simulate a regular page processing time. My question is how to increase the requests/sec with the same page processing time. Why IIS or Asp.NET engine not using all the available cpu to fulfill more requests? – sspekinc Dec 17 '12 at 14:39
  • Do you have try to give more threads to a pool - to make a web garden ? – Aristos Dec 17 '12 at 16:12
  • @Aristos To be able to give more threads, I have changed the processModel as I have explained in my question, nothing has changed. Is there any other way to add more threads to the pool? Adding one extra worker processes indeed doubled the requests/sec, but it also doubled the execution time so the net effect is happened to be zero. – sspekinc Dec 17 '12 at 22:38
  • If you go to the pool, you can add more working pools than 1. If you do that, then you need to take care the synchronization of your application on many points using mutex. – Aristos Dec 18 '12 at 05:39
  • @Aristos As I said, I already added woker processes to the application pool and the net effect is null. – sspekinc Dec 18 '12 at 13:48

1 Answers1

-1

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.

Community
  • 1
  • 1
Mike Sandford
  • 1,315
  • 10
  • 22