1821051 Members
2857 Online
109631 Solutions
New Discussion юеВ

TOP CPU Processes

 
Jojo Castro
Regular Advisor

TOP CPU Processes

Hi all,

Our system is running under HP-UX11.23 with 48 Active CPUs. Normally, it is only at 20-25% utilization. Our operations noticed that it shoots up to 100%. But unfortunately, they were not able to capture the top process during shoots up.
Help me please on how to get that "particular" process/es....
My first action is via measureware...
Any other suggestions?

Thanks!
8 REPLIES 8
Dennis Handly
Acclaimed Contributor

Re: TOP CPU Processes

You could use top and send the output to a file:
top -f top.out -n 8 -d 20

This appends to top.out the top 8, does it 20 times with a delay of 5 seconds.
rajv
Advisor

Re: TOP CPU Processes

Hi,


Use the following mentioned command to find the top 10 memory and cpu eater process

UNIX95= ps -ef -o pid,ppid,pcpu,sz,args | sort -nbk 4 | tail -10


or

top -f /home/monitor/top.log

It will create top.log file.

cat /home/monitor/top.log | grep USER | grep LOAD


Thanks,
V.Rajesh
Jojo Castro
Regular Advisor

Re: TOP CPU Processes

Thanks to both of you. But my problem is how to get the historical. meaning the top processes when it shoots up. Say 1 hour ago.
Dennis Handly
Acclaimed Contributor

Re: TOP CPU Processes

>But my problem is how to get the historical, meaning the top processes when it shoots up.

You have to continually run top or ps and save the results.

>rajv: cat /home/monitor/top.log | grep USER | grep LOAD

No need to use cat with grep:
grep USER /home/monitor/top.log | grep LOAD
Ninad_1
Honored Contributor

Re: TOP CPU Processes

Hi,

As suggested, you need to run the above solutions continuously by running them in a continuous loop - like while loop through a script.
Also as per your initial inclination to use measureware - you use the extract tool to get the detailed report to get the details on CPU intensive processes.

Other things to look would be to see if
1. There is any particular pattern or time of the day etc., is it happening daily/weekly??
2. There are any jobs shceduled through cron or through any Enterprise scheduling tool (if you are using any).
3. Are there any maintenance/cleanup jobs scheduled at that time (Some common mistakes while writing cleanup scripts is to use -exec with the find option to delete old files. This causes a very very large number of rm commands to be spawned for the deletion of files - this causes a lot of context switching. Instead pipe the output of find command (without the -exec)to xargs
(e.g. find $DIR -type f -mtime +30 | xrags rm -f)
4. Check the CPU usage pattern in terms of how much percentage is used by User, by System, by WIO - this will also give you a hint on where the CPU power is been used/wasted.

Regards,
Ninad
Jeeshan
Honored Contributor

Re: TOP CPU Processes

Hi

you can add the command state by RAJV above in cron schedule. for every 15-20 minutes interval and redirect the output in a file.

or you can redirect the output through mail.

it will eb easier to find out if you don't have measureware.
a warrior never quits
Dennis Handly
Acclaimed Contributor

Re: TOP CPU Processes

>Ninad: -exec with the find option to delete old files. This causes a very very large number of rm commands to be spawned ...
>find $DIR -type f -mtime +30 | xargs rm -f

No need to use xargs, just -exec ... +
find $DIR -type f -mtime +30 -exec rm -f +
Jojo Castro
Regular Advisor

Re: TOP CPU Processes

Thanks for the help. But all your suggestions are moving forward. Our DBA have already identified the top process during "that time" via statspack.