Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum number of threads available in Asp.net ThreadPool

Just out of curiosity , What is the maximum number of threads available for handling request in asp.net.

And does asp.net releases them for any I/O or database operations so that maximum number of requests can be handled?

like image 257
Kunal Avatar asked Jul 08 '11 21:07

Kunal


3 Answers

It is controlled via machine.config.

configuration > system.web > processModel

<processModel 
   maxWorkerThreads="num"
   maxIoThreads="num"
   minWorkerThreads="num"
   minIoThreads="num"
   ...
   />

It is set on a per CPU basis. Default for single CPU is 20/20.
http://msdn.microsoft.com/en-us/library/7w2sway1(v=VS.100).aspx

like image 128
Mrchief Avatar answered Nov 05 '22 21:11

Mrchief


In .net 4.0 has it is 250 worker threads per CPU and 1,000 I/O completion threads...

like image 3
Manoj Talreja Avatar answered Nov 05 '22 21:11

Manoj Talreja


To release worker threads for I/O operations, you'll want to use the async/await pattern. When you "await" an async file operation, the thread will be released back to the ASP.NET thread pool, which is then used to process other requests until your file i/o operation is completed.

http://www.asp.net/mvc/tutorials/mvc-4/using-asynchronous-methods-in-aspnet-mvc-4

like image 2
Tim P. Avatar answered Nov 05 '22 23:11

Tim P.