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?
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
ThreadPool is managed by the framework. As such, its hard to predict when it'll be released. But then, the whole idea is that you shouldn't have to bother with it.In .net 4.0 has it is 250 worker threads per CPU and 1,000 I/O completion threads...
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