Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Threadpool in IIS context

I have a general question about System.Threading.Threadpool when run in a webapplication on IIS. Say we have 2 requests execute at once, and we fire up a couple of threads through the ThreadPool.QueueUserWorkItem method. Will the two requests share the ThreadPool, or will the calls to the ThreadPool from the two requests operate in a two separate pools?

This is in IIS6 and 7.

Thanks for any insight.

like image 655
El Che Avatar asked Sep 21 '09 07:09

El Che


People also ask

How do I increase thread pool in IIS?

To change how the IIS thread pool works, and how many threads it provides for your workload, you can modify a number of registry values under the registry key HKLM\System\CurrentControlSet\Services\InetInfo\Parameters. The configured maximum number of threads (per processor) in the IIS thread pool.

How many threads can IIS handle?

Consider using asynchronous operations to avoid threads altogether. Agree with SLaks, indeed IIS by default will use 12 threads, however almost any dynamic content you have (whether PHP, ASP.NET, etc) will have their own thread pool that in some ways makes the specific answer of 12 threads not interesting.

How do you change threads per CPU limit?

Click to expand Limits Properties under Behavior, click Threads Per Processor Limit, enter the desired value for Threads Per Processor Limit and click Apply in the Actions pane.

How many IIS worker processes should I have?

Can I use multiple worker processes in my IIS Application Pools? No. The 'moveitdmz ISAPI Pool' and the 'moveitdmz Pool' should each be set to use only 1 worker process. If this number is increased, you will most likely see unusual behavior on your DMZ system.


1 Answers

Here is a quote from the MSDN documentation about the ThreadPool class:

There is one thread pool per process. The thread pool has a default size of 250 worker threads per available processor, and 1000 I/O completion threads.

In IIS6 and IIS7 any given ASP.NET application is hosted inside of a single process (w3wp.exe) through the Application Pool infrastructure.
An Application Pool can host multiple web applications by keeping them in different AppDomains, but it runs inside of one physical process on the server.

These two facts mean in practice that all threads from a running web application instance execute inside the same .NET Thread Pool.

like image 87
Enrico Campidoglio Avatar answered Oct 15 '22 16:10

Enrico Campidoglio