We have a Windows Service which hosts a number of WCF services and, in an unrelated part of the app, makes extensive use of the TPL Task
class to asynchronously do relatively short bits of work.
It is my understanding that WCF uses managed I/O threads from the ThreadPool to execute requests. I noticed that after deploying a feature which significantly raised the applications use of Tasks
, and as such the use of ThreadPool worker threads as well, performance of a couple of web services has become very slow. We're talking minutes instead of less than a second. The number of Tasks
actually trying to run at any one time can range between 20 and 1000, which makes me think that any new (last in) work needing some CPU time could be forced to wait for quite some time.
Does the (in my case extremely large) number of busy ThreadPool worker threads affect the ThreadPool's managed I/O threads? Could these two be connected in any way? Or should I start looking elsewhere...
Thanks!
EDIT: I just did a spot check on a live deployment of the app while trying to call one of the long running web services which is quite typical: 70 Tasks running, Windows Service process has about 150 threads, average CPU usage 30-60%. By typical I mean that CPU usage is generally around 40% and rarely exceeds 80%, however there are a large number of Tasks running and threads used by the process.