high cpu utilization


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users high cpu utilization
# 1  
Old 01-03-2011
high cpu utilization

good morning.

just wanted to ask if there's a way to check what causes the high cpu utilization of a server for the past 2 months? My jffnms report resulted to high utilization for a specific server last month. is there a way to check via a command line?

thanks
# 2  
Old 01-03-2011
You might have to observe or log a while to see. I have used a simple script to find processes that are using high CPU, where I do a ps -ef every N seconds, and compare them, suppressing lines with 0-1 second CPU used, using some sort, comm -13 and grep. Logging time for each pass is good, too, so you can see who runs what when to drive it up. You may find a looping process right off the bat. It goes something like this:
Code:
#!/usr/bin/ksh

export fa=/tmp/ps.a.$$ fb=/tmp/ps.b.$$

ps -fp$$ | read zh  # capture ps header

ps -ef | sort >$fb   # prime the comparison

while [ 1 ]
do
 sleep 120
 mv $fb $fa
 date
 ps -ef | sort >$fb
 echo "$zh"
 comm -13 $fa $fb | grep -v '0:0[01] '
 echo
done


Last edited by DGPickett; 01-03-2011 at 10:21 PM..
# 3  
Old 01-03-2011
thanks..does this means that there is no way to check the past month say last december? pls advise
# 4  
Old 01-05-2011
Well, if the system logged tremendous detail unasked, it would be a dog. You can find how many times every command was called, but I don't think it tracks total cpu cycles. There may be accounting bits to tell you user cpu time totals, but they may have to be turned on. Usually, it is something to do ongoing forever, so you can tell if it is a command or a user or batch or service or possible attack/denial of service.

Using all the CPU you bought is no sin. (There is a psychology of reserve that says it is, but it is just neurosis. Once, a manager suggested I not fix the CPU with the last spare PWB, because then we would not have a spare . . . .) If the users feel it is slow, then look.
# 5  
Old 01-12-2011
thank you for your reply.
just a bit confused.

Tried the below and here's one output of the script your wrote.
Code:
     UID   PID  PPID   C    STIME TTY         TIME CMD
    root     0     0   0   Dec 03 ?           3:02 sched
    root     1     0   0   Dec 03 ?           0:02 /sbin/init
    root     2     0   0   Dec 03 ?           0:00 pageout
    root     3     0   0   Dec 03 ?         105:39 fsflush
    root     7     1   0   Dec 03 ?           0:12 /lib/svc/bin/svc.startd
    root     9     1   0   Dec 03 ?           0:32 /lib/svc/bin/svc.configd
    root  3985     1   0   Dec 14 ?          32:25 /usr/jdk/instances/jdk1.5.0/bin/java 
   smmsp   910     1   0   Dec 03 ?           0:02 /usr/lib/sendmail -Ac -q15m
  daemon   163     1   0   Dec 03 ?           0:00 /usr/lib/crypto/kcfd
  daemon   311     1   0   Dec 03 ?           0:00 /usr/sbin/rpcbind
-Dcom.sun.aas.instanceRoot=/opt/SUNWappser
 lhareigh 10962 10961   0 14:32:25 ?           0:00 /usr/lib/ssh/sshd

a. how will I know which CPU are they occupying? see output of psrinfo
Code:
The physical processor has 8 virtual processors (0 2 4 6 8 10 12 14)
  x86 (chipid 0x0 GenuineIntel family 6 model 26 step 5 clock 2933 MHz)
        Intel(r) Xeon(r) CPU           X5570  @ 2.93GHz
The physical processor has 8 virtual processors (1 3 5 7 9 11 13 15)
  x86 (chipid 0x1 GenuineIntel family 6 model 26 step 5 clock 2933 MHz)
        Intel(r) Xeon(r) CPU           X5570  @ 2.93GHz

b. on the output above, which of them has the highest CPU usage and what CPU it uses?

thank you for your swift reply

Last edited by Franklin52; 02-23-2011 at 03:37 AM.. Reason: Please use code tags, thank you
# 6  
Old 01-12-2011
If you have the "top" command it is very good for showing you the CPU usage live. Most versions also show you which CPU a process is using. Very useful for finding orphan looping processes.


What Operating System and version are you running?

Apart from unix process accounting (an acquired taste) there are many commercial monitoring suites of programs available. Very detailed record keeping is a significant task and may cause you to re-size your server in order to maintain the historic records.
Setting up basic unix System Activity recording (see "man sar" and "man sadc") is useful if you want an overview.

Btw. High average CPU usage often just means that you have sized your server correctly. If processes are constantly queueing for CPU time, then you have a problem.
Beware that some performance monitors know how many processors you have and can report say 800% utilisation (on a 16 processor system) without there being a problem. In this example 100% utilisation is trivial.
# 7  
Old 01-12-2011
The CPU in use by a process may vary for every run time slice, although for some situations it helps to run the same lwp on the same CPU if possible.

Maybe with some wide ps options (w or x, it varies), you can see what the java proc is running. You can make the interval lower, and see who shows up often. Sometimes the scheduling column changes, and you need a ps -o (as I recall) with specific columns relevant to who is using how much of what.

Top is great, too, but can be a bit busy and leaves no log.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Kswapd high cpu utilization.

Hi, Please suggest how to troubleshoot, kswapd is utilizing high cpu? also wanted to know which parameters are important and needs to be added with sar command for monitoring the performance of Linux (Oracle 5.8 -64 bit Please guide me. I am facing the issue where server is getting... (0 Replies)
Discussion started by: manoj.solaris
0 Replies

2. Red Hat

High CPU Utilization

Hi Experts, I need to understand few basic things regarding top command result from one of the node i have collected: Cpu0 : 4.6%us, 2.0%sy, 0.0%ni, 91.4%id, 1.3%wa, 0.3%hi, 0.3%si, 0.0%st Cpu1 : 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu2 : ... (5 Replies)
Discussion started by: mackjack87
5 Replies

3. UNIX for Advanced & Expert Users

[Solved] High CPU utilization

Hi, i am observing few processes taking high CPU and when i got some more detials about them it looks like this PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 9452 xmp 25 0 16736 1224 860 R 100.0 0.0 903:54.18 ffmpeg -i - 9777 xmp 25 0 16736 1224 ... (1 Reply)
Discussion started by: Siddheshk
1 Replies

4. Shell Programming and Scripting

Gzip with high CPU utilization

Hello all, I am very new to unix and trying to solve this problem. I have cluster of 3 nodes. when I run TOP command on each server, I see a two GZIP processess with very high CPU utilization even,if I don't go backups or unzipping. Can somebody tell me what is the problem, I don't want... (1 Reply)
Discussion started by: nnani
1 Replies

5. Solaris

vsh is high - cpu utilization

Hi, I am working on a solaris app processor and the vsh goes high from time to time. I have executed various ps commands and switches and have found that it looks like the rlogind daemon is terminating vsh and not cleaning up after itself. There are also something like 10 zombies hanging around... (2 Replies)
Discussion started by: troystevens
2 Replies

6. Shell Programming and Scripting

High CPU Utilization of the script

There is a script which processes the incoming files from a particular directory and sleeps if it doesnt find any. Currently, i have been told that eventhough there are no files to process, the CPU utilization is very high. An independent evaluation by advisory specialist has found this script does... (2 Replies)
Discussion started by: nandu
2 Replies

7. Shell Programming and Scripting

Script with high CPU utilization

Hi All, i have a script that finds the file with .txt .zip .Z .gzip that are 3 days old in directory /abc/def and removes them find /abc/def -name '0*.txt' -mtime +6 -exec rm {} \; find /abc/def -name '0*.zip' -mtime +6 -exec rm {} \; find /abc/def -name '0*.gzip' -mtime +6... (3 Replies)
Discussion started by: mad_man12
3 Replies

8. Solaris

Non-Global zone take high CPU utilization.

In Production system there is 12 Non-Global Zones. So in that 12 Non-Global zones one of the Non-Global zone taking 60-70% CPU usage and load average become very high. Running processors are 52 only. Please advise me is there any way to reduce the CPU sharing Utilization. (Most Urgent) ... (9 Replies)
Discussion started by: murthy76
9 Replies

9. AIX

High CPU utilization

Hi am facing high cpu utilization on my sybase server. I have P550 Number Of Processors: 4 Processor Clock Speed: 1656 MHz CPU Type: 64-bit Kernel Type: 32-bit LPAR Info: 1 65-D837E Memory Size: 7840 MB in topas it shows Name PID CPU% PgSp Owner dataserv 565264 ... (1 Reply)
Discussion started by: vjm
1 Replies

10. Solaris

High CPU Utilization

Good morning, I need some help figuring out what's eating up my cpu. My application can't get enough cpu to do its job. this is a sunfire V440 2CPU's at 1/593 GHZ with 8GB of memory. In the morning hours the box is at less than 3%. I can't figure out what else is using the CPU. We use foglight and... (2 Replies)
Discussion started by: bbouhaik
2 Replies
Login or Register to Ask a Question