Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Long running HttpWebRequests

I have a ASP.NET web application running on an IIS6 server. The application is making potentially long running calls to a xml service on a remote machine. Some of the service calls on the remote machine are taking a long time to execute (sometimes up to 4 minutes). The long term solution would be to make the calls asyncronous, but as a short term solution we want to increase the timeout for the calls and the overall httpRequest time out.

My fear with this is that the long running calls will fill up the request queue and prevent the "normal" page requests from completing. How can the server, IIS and application settings be tuned to temporarely resolve the issue?

Currently there are approximately 200 page requests/minute and this results in 270 service requests/minute.

  • The current executionTimeout is 360 (6 minutes)
  • The current service call time out is 2 minutes
like image 980
PHeiberg Avatar asked Feb 02 '10 13:02

PHeiberg


1 Answers

There's this article on Microsoft's Knowledgebase that has some pretty much all the information you might need:

* Contention, poor performance, and deadlocks when you make Web service requests from ASP.NET applications


I will give you some research I have done regarding some of the specific items handled in the article above. This information below applies to IIS6, comments for IIS7 where applicable.

Increase the Processor Worker Thread pool from 25 to at least 100

The default values for the Threadpool size is 100 because the default value for autoConfig is true.

The values covered by autoConfig is

  • maxWorkerThreads
  • maxIoThreads
  • maxConnection

There is one value that is still 25 that must change is – ASPProcessorThreadMax, this can only be set in the IIS metabase (via adsutil tool) in IIS6. [IIS7’s equivalent is the processorThreadMax value]

So I'm opting not to change the machine.config settings as they are fine and there are other paramaters that would be affected by turning off autoconfig, but rather change ASPProcessorThreadMax from 25 to 100 via the IIS metabase (the only way to change this value).

e.g.

cscript %SYSTEMDRIVE%\Inetpub\AdminScripts\<nowiki>adsutil.vb</nowiki>s SET W3SVC/AspRequestQueueMax 100

Max connections per server

maxconnection The autoconfig sets this value to 12*number of cpu’s, that’s how many connections can be made to each address you are connecting to at one time.

Debugging

Here are some things you can do:

Monitor if requests are waiting in the queue

Monitor the following counter:

  • Run perfmon
  • Add counter:    ASP.NET Applications/Requests In Application Queue

This will show us if work items are queued because of a shortage of workers.

Check Identity Used by Application Pool

  1. Open IIS Manager
  2. Check which application pool is used by your site in IIS manager.
  3. Choose the Application pool being used in the Application Pools list, then Right Click -> properties and see what account identity is being used.
  4. It should be Network Service by default.
like image 183
David d C e Freitas Avatar answered Sep 30 '22 18:09

David d C e Freitas