views:

460

answers:

2

Currently we are developing an ASMX, ASP 2.0, IIS 7 web service that does some calculations (and return a dynamically generated document) and will take approx. 60 seconds to run.

Since whe have a big machine with multiple cores and lots of RAM, I expected that IIS tries its best to route the requests that arrive in its requests queue to all available threads of the app pool's thread pool.

But we experience quiet the opposite:

When we issue requests to the ASMX web service URL from multiple different clients, the IIS seems to serially process these requests. I.e. request 1 arrives, is being processed, then request 2 is being processed, then request 3, etc.

Question:

Is it possible (without changing the C# code of the web service) to configure IIS to process requests in parallel, if enough threads are available?

If yes: how should I do it?
It no: any workarounds/tips?

Thanks
Uwe

+2  A: 

Make sure you have the "Maximum Worker process" for the application pool set to > 1 to enable the worker pool to become a Web Garden. By default each application pool is set to only use one process, which would cause requests to be queued.

You may also want to look at this article about using ASP.NET 2.0 in Integrated mode on IIS7

  1. ASP.NET threading settings are not used to control the request concurrency in Integrated mode

The minFreeThreads, minLocalRequestFreeThreads settings in the system.web/httpRuntime configuration section and the maxWorkerThreads setting in the processModel configuration section no longer control the threading mechanism used by ASP.NET. Instead, ASP.NET relies on the IIS thread pool and allows you to control the maximum number of concurrently executing requests by setting the MaxConcurrentRequestsPerCPU DWORD value (default is 12) located in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727.0 key. This setting is global and cannot be changed for individual application pools or applications. Workaround

A. To control the concurrency of your application, set the MaxConcurrentRequestsPerCPU setting.

Greg Bray
Thanks, Greg, we did that already, with no success. I watched the additional processes in SysInternal's Process Explorer but saw that they seem to be idle all the time. Any additional steps to perform than just enhancing the Worker Process count? Maybe moving to ASP.NET 3.5?
Uwe Keim
That should be all that is required. If it still doesn't work try writing a simple web service in the same application pool that makes the thread sleep for 60 seconds and see if you can get it to work with multiple processes. If that service works then it must be an issue with your application logic locking on resources.
Greg Bray
+1  A: 

Are you using session state in your web service? Requests to pages that use session state are serialized; maybe it's the same with your service.

ASP.NET and IIS normally process requests in parallel. If they're not, then something is preventing it.

John Saunders
Thanks, John. We did use session state in the past but removed it. Probably we forgot to remove all "references" to the session state. I'll check this.
Uwe Keim