title: Using ThreadPool threads with long running ADO.NET queries. Is this scalable?
body: <p>We are currently enhancing an ASP.NET app that performs quotes on a number of products.</p>
  
  <p>At present the existing quote engine is basically a big stored procedure (2-3 secs per call) followed by a small amount of business logic that runs after the procedure call.</p>
  
  <p>We are looking into multi-threading the call to each product in order to speed up a set of quotes.  </p>
  
  <p>Our current approach is to encapsulate each product quote work in a ThreadPool thread.  This seems to perform much better, but I'm a little concerned that though it's performing well with a small number of users, will it scale well in a production environment?</p>
  
  <p>Please note at present we are not using async ADO.NET methods.</p>
  
  <p>Note: Our code that calls the ThreadPool has a throttle that queues requests so we can only use a configurable amount of threads from the ThreadPool at one time.  We also don't need to wait for the quote results on the same page, we allow the user to progress and check for updates (a quote results page uses AJAX to check for results).</p>
  
  <p>Further note: The preferred solution would be to use a message queue as the quote service is a one-way operation.  However, the timescales for the project didn't provide us time to do this.</p>
  
  <p>In the meantime we are going to revise the implementation to use the async methods of ADO.NET (as that is where all the long running aspect of the process is) saving the need to use ThreadPool threads.</p>