Wait method
Hi,
I run dottrace analyze on some processes and I got high % on Wait, PollTask, WaitForShutdown
and some block method that seems that consume CPU
My question is if these rows are take CPU
attach screenshot
Please sign in to leave a comment.
more screenshot
Hi!
dotTrace displays the time that program has spent in the method. Whether the method used CPU or not depends on the method implementation. However if you are using Timeline profiling type ( https://www.jetbrains.com/help/profiler/Profiler_Options.html#choosing-profiling-type ) and want to investigate only "time on CPU" you could apply "Running" state on Thread state filter ( https://www.jetbrains.com/help/profiler/Thread_State.html ). In that case dotTrace just remove all "waiting" time from result.
Thanks Kirill Ponimash
I read your comment
I tried to filter only "running" but still got wait methods (Attach)
I want to know if these wait method is consuming cpu?
Thanks,
Maor
Hi!
Here you also selected a thread filter, so it's hard to compare values from the first screenshot and the last one. But it looks like most time the thread 15076 (including Wait method) wasn't doing any work (only about 0.5% was in running state).
In other words the thread life time was around 30 seconds and it worked only 0.144 seconds. Not sure if it's important for your case but indeed, it looks like the Wait method consumed just a tiny bit of CPU.
Thanks Kirill
we have ~20-30 microservices (as windows process)
I tried to monitor them with dottrace and every report contains 95%-100% wait methods
its strange because we have a lot of processing in these services
I will happy to advice with you
Thanks,
Maor
Hi!
You said as windows processes. You mean for each service you have a separate process, don't you? In the snapshot you could see measured data from one process. If the work all microservices do is spread between 30 processes in result every processes could take only 1/30 of the CPU time. As a result every single process on average will sleep 29/30 of the time. You could prove it if you would look at task manager. If every of microservice processes take only a tiny CPU time, that's it.
If we are still talking about CPU consumption, I still don't see any issue here. 0.5% of CPU generally means the process doesn't consume CPU. Is it possible that you have too many workers and the overhead of microservices is more than the work itself? If you want to investigate a specific microservice I believe it will be much easier if you run only one instance and then stress/load test it while profiling. In that case in the task manager you will see much more than 0.5% of CPU usage and in snapshot you will see a real "running time" distribution.