Operating System - HP-UX
1752793 Members
6407 Online
108789 Solutions
New Discussion юеВ

Re: Help interpreting cpu%

 
SOLVED
Go to solution
Jim Gerken
Occasional Advisor

Help interpreting cpu%

I am running the following script to monitor cpu% and memeory consumed by a certain pid...

My problem is that it seems to be returning a % greater than 100%. I this because there is multiple cpu's?

FILE=/tmp/junk/cpu.log
echo "DATE PID USER CPU% MEM_SIZE COMMAND" > $FILE
while true
do
UNIX95= ps -eo "pid ruser pcpu vsz=Kbytes" -o comm | grep oracle >> $FILE
sleep 10
done

output...

15426 ormesa 0.02 33984 oracle
29690 ormesa 0.02 32832 oracle
29659 ormesa 0.02 32832 oracle
22635 ormesa 2.04 34112 oracle
29753 ormesa 0.02 32832 oracle
29726 ormesa 0.62 48320 oracle
14651 ormesa 0.02 40128 oracle
17502 ormesa 0.02 40128 oracle
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: Help interpreting cpu%

There are several bugs that cause top or glance to report total CPU % greater than 100% in dual processor machines.

If you install these bugs you might get better data.

You don't mention an OS, so I don't know which patches to search for you.

You might want to look at different ways to measure peformance, but I think its a patch issue.

I'm attaching some perf measurement scripts to help you.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Steele_2
Honored Contributor
Solution

Re: Help interpreting cpu%

These are snapshots during intervals of time and not totals or sums. That's why its best to use glance advisor instead of UNIX95= ps.

glance -adviser_only -syntax

Where the advisor systax file is preconfigured to measure of your choice.

See: /var/otp/perf/adviser.syntax

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x4c07543254bfd611abdb0090277a778c,00.html
Support Fatherhood - Stop Family Law
Tim D Fulford
Honored Contributor

Re: Help interpreting cpu%

I think the above comment hits the nail firmly on the head. Except you might want to patch to REMOVE bugs rather than install bugs!! :-)

I would use MeasureWare to do the above, or glance in adviser mode. Obviously you would need to have these installed!

Just my 0.02???

Tim
-
Jeff Schussele
Honored Contributor

Re: Help interpreting cpu%

Hi Jim,

To answer your question - absolutely you can report >100% in multiple CPU systems.

For example in a 6-way system, you could theoretically (albeit not probable) have a process consume a max of 600% CPU.

Now, there are some known issues with top, especially reporting incorrectly & there are patches available to address these issues. But it's entirley possible for a single process to generate >100% CPU in a multiple CPU system w/o a "bug" at work.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Bill Hassell
Honored Contributor

Re: Help interpreting cpu%

With multiple processors, very complicated situations can exist in trying to 'allocate' CPU usage. Typical compute-bound context switches can occur 10 time per second (context switch means a different program is given CPU time to run). The 'average' process is single-threaded so it would never consume more than 100% CPU. But Oracle can be configured to take advantage of parallel processors with threading. Essentially, threads are routines that can run independently for a while--milliseconds to minutes. Although the thread is like a separate process, the time consumed by a thread is assigned to the main process. So specialized processes that use threads can indeed 'seem' to consume more than 100% CPU time.

However, measuring CPU resources suitable for human consumption is always full of perils! Take a compute-bound process that runs for 5 milliseconds. While it is running, it consumed 100% CPU time. But during a more human-like span of time, say 1 second, this process consumed 0.5% of the CPU. SO which is the right metric? As a lawyer would say: it depends.

For a database engine, the problem is even more complicated because there are several processes that are part of a given transaction. And knowing that a given process is consuming 100% of CPU for several minutes gives no clue as to whether this is correct behavior. As most sysadmins will attest, it is very easy to write bad SQL statements, not adequately index a database and limit the amount of RAM available to the database engine, all leading to very bad performance.

You would be better served by increasing RAM to 4Gb to 8Gb, switch the executables to 64bit and increase SGA to several Gbytes. Then have the DBA fix the SQL and database design and you'll have a system that runs very fast.


Bill Hassell, sysadmin
Yogeeraj_1
Honored Contributor

Re: Help interpreting cpu%

hi,

In general, if you are at 99.99% utilization -- pat yourself on the back, you've done well.

someone: "Hey, my cache hit is 99.99%, pretty good eh?"
me: "oh, thats pretty bad -- that could indicate serious performance issues,
then again, maybe not -- but in any case, by itself it is a meaningless
number"


If the system uses 100% of the CPU to do 1tps and it uses 100% of the CPU to do 10tps and it uses 100% of the CPU to do little to no database work -- you have a problem.

CPU utilization is alot like cache hit ratios (except of course people want low cpu like golf scores and high cache hit like basketball scores).

if you are running at 99% continously that is not good.
if you peak at 99% from time to time that is ok.

how to find out what the "problem" is -- you analyze your system. find out what is taking 99% of the cpu -- is it 1,000 little things or one big thing. is it something you need to do or can you skip it all together (be surprised how often that is true)

best regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)