Is there a way to see (preferably through the built-in performance counter) how much work TPL has put in the queue with which it is trying to work?
Here are some details about what I'm trying to do and what I see:
I have a large workload that I upload to .NET Threadpool using Task.Factory.StartNew () (default scheduler). When there is more load than my system can handle, work queues until the load decreases or I run out of memory. I am updating my own performance counter (this is a counter per second) as part of my processing, and I see that this counter does not exceed about 27,000 (messages per second), regardless of how many messages I put on the Task.Factory.StartNew ( )
My question is more about monitoring than advice on improving the system - I can do micro-optimizations, but at the moment there is no visibility in the perforated meters that work. Optimization aside, I would like to be able to accurately determine how much TPL work is buffered, so that I can evaluate the responsiveness of my system. I want to see if adding a new message on the input side will result in immediate processing (zero latency) or if there will be some time out before I see the results of my query.
Now what happens is that below 27,000 messages per second, if I stop logging in, I see that the βMessage Processing Per Secondβ counter drops to zero. Above this breakpoint, the counter continues to record 27K per second for a while (depending on how long I have increased the lag) until the rest of the load starts to work through the system.
source share