title: Using ThreadPool.QueueUserWorkItem in ASP.NET in a high traffic scenario
body: <p>I've always been under the impression that using the ThreadPool for (let's say non-critical) short-lived background tasks was considered best practice, even in ASP.NET, but then I came across <a href="http://csharpfeeds.com/post/5415/Dont_use_the_ThreadPool_in_ASP.NET.aspx" rel="noreferrer">this article</a> that seems to suggest otherwise - the argument being that you should leave the ThreadPool to deal with ASP.NET related requests.</p>
  
  <p>So here's how I've been doing small asynchronous tasks so far:</p>
  
  <pre><code>ThreadPool.QueueUserWorkItem(s =&gt; PostLog(logEvent))
  </code></pre>
  
  <p>And <a href="http://csharpfeeds.com/post/5415/Dont_use_the_ThreadPool_in_ASP.NET.aspx" rel="noreferrer">the article</a> is suggesting instead to create a thread explicitly, similar to:</p>
  
  <pre><code>new Thread(() =&gt; PostLog(logEvent)){ IsBackground = true }.Start()
  </code></pre>
  
  <p>The first method has the advantage of being managed and bounded, but there's the potential (if the article is correct) that the background tasks are then vying for threads with ASP.NET request-handlers. The second method frees up the ThreadPool, but at the cost of being unbounded and thus potentially using up too many resources.</p>
  
  <p>So my question is, is the advice in the article correct?</p>
  
  <p>If your site was getting so much traffic that your ThreadPool was getting full, then is it better to go out-of-band, or would a full ThreadPool imply that you're getting to the limit of your resources anyway, in which case you shouldn't be trying to start your own threads?</p>
  
  <p>Clarification: I'm just asking in the scope of small non-critical asynchronous tasks (eg, remote logging), not expensive work items that would require a separate process (in these cases I agree you'll need a more robust solution).</p>