views:

2112

answers:

3

I have some WCF services that are hosted in a windows service. Yesterday I looked at Task Manager and noticed that the CPU time for my windows service process was over 5 hours, while the majority of all other processes were at 0.

What does that mean?

Should I be concerned that the CPU Time was 5+ hours?

+3  A: 

CPU Time is a reflection of how much time your program spends executing instructions in the CPU vs waiting for IO or other resources. Should you be concerned with it being 5+ hours?

I would guess not, some things to consider are:

  1. How long has this process been running?

  2. Do you have any issues with the performance of the process or other processes on the box that this might be stealing CPU from?

  3. What other processes do you have? Are these active processes that you'd expect to use the CPU? For reference of the 80 processes I have about 20 have over 1 second of CPU time used.

Edit

It is possible that the WCF service is stealing CPU from the other services, you need to monitor them making sure their performance is what you expect. You can also get a sense based on Total CPU usage. If you for example you only see 25% of your CPU used, then your other services should not be affected; however, if your running above 75% then they might be affected.

When it comes to monitoring be sure to monitor over time so you can see how the performance trends, and it will help you isolate problems. For example you service is running fine but then after a deploy it slowly starts to take more and more CPU (Assume 10% a week). Unless your trending your CPU usage you might one day wake up and see your service running slowly which could be weeks after a deploy.

JoshBerke
The process had been running for about 3 weeks. It was restarted last night and the CPU time is currently at 31 seconds.We haven't noticed any performance problems - the web site that uses these WCF services is very fast.We have some SOAP web services hosted on the same box in IIS so there was concern that the WCF process might be stealing CPU and affecting the performance of the other web services.
You had 5 hours of CPU time on a process that has been running 504 hours (3 weeks * 7 days/week * 24 hours/day). So simplistically, on average, your process has been using 1% of the CPU the entire time. In reality of course, that isn't the case, there are times your service is using near 0% CPU and other times it is using considerably more. I would say it is nothing to worry about, but if you are concerned, you should use 'perfmon' to track your processes CPU usage over time to determine if you have a problem.
Grant Wagner
A: 

CPU time is an indication of how much processing time that the process has used since the process has started (in Windows: link to a Technet article.)

It is basically calculated by:

CPU Time of Process = Process Uptime * CPU Utilization of Process

For example, if the process has been running for 5 hours and the CPU time is 5 hours, then that means that the process has been utilizing 100% of the resources of the CPU. This may either be a good or bad thing depending on whether you want to keep resource consumption low, or want to utilize the entire power of the system.

If the process was using 50% of the CPU's resource and running for 10 hours, then the CPU time will be 5 hours.

coobird
+1  A: 

If you are concerned about how much CPU time your process is using, you should use perfmon to track your processes' CPU usage over an extended period of time to determine if you have a problem.

Grant Wagner