CPU load and utlization

Started by kghammond, February 11, 2008, 08:04:49 PM

Previous topic - Next topic

kghammond

I am trying to understand the difference between CPU load and CPU utilization.  I setup both of those DCI's along with a custom DCI for SQL Server CPU.  I graphed them over the weekend.

It seems during our nightly maintenance tasks, (this includes a 15 GB database restore), the SQL ServerCPU pegged out at 100%.  The CPU utilization pegged out just over 50% and the CPU load barely reached 5.

I am guessing that CPU Utilization and SQL Server CPU were off by a factor of 2 due to the server being a dual processor.  If I remember correctly, a processes cpu can reach 200% if it happens to be pegging both CPU's, and CPU utilization is the total CPU for all processors.

But what is CPU Load meassuring?

Thank you,
Kevin

Victor Kirhenshtein

Hello!

CPU load is an average length of processor queue (number of processes ready for execution but waiting for free CPU time slot) for last minute. This measure is widely used in UNIX world, often called "load average".

Best regards,
Victor

kghammond

Thank You, that makes more sense.

Going back to the % CPU time for a process:

Counter = UserProcess.SQLServer.CPU:"\Process(sqlservr)\% Processor Time":60:A:INT:Average % CPU Time for sqlservr.exe over past minute

Is there a way to divide this number by the number of CPU's?  I am guessing this will need to be a script of some sort.  I don't know how hyper-threading affects this counter as well.

Thank you,
Kevin

Victor Kirhenshtein

You mean just divide value to a constant number of processors? Currently you can do it on server side by using transformation script in DCI. If you have two processors, your transformation script can look like this:


$1 / 2


Drawback of this method is that you cannot create an universal template which can be used on machines with different number of CPUs, because CPU number is hard coded as a constant.

Best regards,
Victor

kghammond

Thanks again for your assistance.  I tried using this transfomration above at a template level but it did not seem to work.  I also tried the following transfromation which did not seem to impact the results either.

sub main()
{
   return ($i / 2)
}


Step 1 is set at "Keep original value"

When I have a lot of CPU activity, it still show the SQL Server CPU at roughlt 2x the CPU utilization.

Thank you,
Kevin

Victor Kirhenshtein

You should use $1 instead of $i. Do you use $1 in when trying short form? Also, you example has syntax error - there are missing ; after return statement.
It should be like this:


sub main()
{
   return ($1 / 2);
}


Best regards,
Victor

kghammond

Thank you,

I am starting to feel really dumb for all my little typo's.  It is working great.

Thanks again,
Kevin