Sunday, 8 June 2014

Unix top CPU and Memory


To find the top CPU and Memory consuming process:
===========================================
ps -ef | awk '{t=t+$7 - $10 ;print $7 - $10,$1,$11,$12,$13}END{printt}' | sort -rn | pg
ps -ef|sort +5|tail  ==> high CPU session
ps augxww|egrep "RSS| "|head ==> Avg cpu session
ps -eaf -o pcpu,pid,user,tty,comm | grep ora | grep -v \/sh | grep -v ora_ | sort -r | head -20  ==> high CPU session
or
ps –eo pcpu,pid,comm,args | sort –n | tail -20  ---> high cpu sessions

ps gv | head -n 1; ps gv | egrep -v "RSS" | sort +6b -7 -n -r --> memory RSS column is memory

To memory on Sun:
------------------
ps -ef | grep $PROG | grep -v 'sh -c' | grep $pid > /dev/null

ps -eo vsz,pid,args | sort +0n -1 | tail -20


prstat -s size -n 5 ==> to see memory

ps aux|sort -nr +4 -5|pg   ==> top process eating the memory
OR
ps axwv | awk '{t=t+$7 - $10 ;print $7 - $10,$1,$11,$12,$13}END{print t}' | sort -rn | pg

prstat -t ===> to see cumulative of memery and cpu
prstat -a

svmon -G ==> AIX over all memory info
svmon -P | grep -p 15256 ==> for a given process

top -c --> to see expanded process

===========================

Run Queue size of the server:
-----------------------------
# sar -q 2 5

Paging activity of the server:
------------------------------
# sar -p 2 5

Swapping activity of the server:
--------------------------------
# sar -w 2 5

No comments: