IIS High Thread Count
<p>I have an IIS application which behaves like this - Number of total threads in IIS processes is low, traffic starts at some low rate like 5 rpm, the number of threads starts increasing, alarmingly, keeps on going even after load stops, does not gets down in reasonable time, reaches like 30,000 plus threads,  response time goes for a toss. </p>

<p>Machine config is set to auto_Config. </p>

<p>There are no explicit threads in application, though there is some --very fancy-- use of parallel for each.</p>

<p>Looking for some tips on how do I go about diagnosing this. Reducing parallel for each seemed to help; I am yet to conclusively prove it. Limiting max number of threads also helps cap the thread count; but I am thinking that there is something wrong with the app that causes those threads to keep increasing. I would want to solve this. </p>

<p>In the picture below, the thread count is ONLY for IIS worker processes. The PUT requests are the only ones doing some work; gets are mostly static resources requests. </p>

<p><a href="https://i.stack.imgur.com/xXbut.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xXbut.png" alt="enter image description here"></a></p>