ps command
How to use ps
#> ps
TIME : the total amount of CPU time used by the process since it began
#> ps -efl
SZ : shows the amount of virtual memory required by the process
Example of ps
#> ps
PID TTY
TIME COMD
346 pts/2
0:01 ksh
1029 pts/2 0:00
ps
1199 pts/2 0:01 ksh
#> ps
-efl
UID PID PPID C PRI NI ADDR
SZ WCHAN STIME TTY TIME
COMD
root 0 0 80 0 SY
f01706f0 0
19:47:44 ?
0:01 sched
root 1 0 80
99 20 fc18f800 173 fc18f9c8 19:47:48 ? 0:36
/etc/init -
vmstat command
How to use vmstat
#> vmstat 5
procs
r b w
r : In the run queue, waiting for processing time
b : Blocked, waiting for resources
cpu
cs us sy id
us : percentage of CPU time spent in USER mode
sy : percentage of CPU time spent in SYSTEM mode
id : percentage of CPU time spent idle
How to read vmstat data
¢º If CPU spends most of its time in USER mode, one or more processes may be monopolizing the CPU.
=> Check "ps -ef"
¢º A low value "id" indicates a MEMORY starved or I/O bound system.
=> RECOMMENDATION : idle time "id" should be grater than 20% most of time
=> In GENERAL guide
id < 15% : have to wait before being put into execution
us > 70% : the application load may be NEED some BALANCING
sy = 30% : is a good water mark
¢º Compute Intensive program.
=> One Compute Intensive program can push utilization rate to 100%.
¢º If the CPU is mainly in system mode, then it is probably I/O bound.
Example of vmstat
#> vmstat
procs
memory page
disk
faults cpu
r b w swap free re mf pi
po fr de sr f0 s0 s1 s2 in sy cs us sy id
0 0 0 72836 7688 0 1
5 1 4 0 2 0 0 0 1 16 37 30
1 1 98
ÁÖÀÇ : sr °ªÀÌ °è¼Ó ³ôÀ¸¸é ¸Þ¸ð¸®ºÎÁ·À» ÀǽÉÇØ ºÁ¾ß ÇÑ´Ù.
CPU Solutions
If your CPU is often busy, or
If it often deals with jobs than monopolize the system,
=> Be lower the priority of other processes (nice command).
=> Check for runaway processes, or other processes monopolizing the CPU or MEMORY.
check "ps -ef" (TIME field)
check "ps -efl" (SZ field)
=> Evaluate your system's memory usage.
ÁÖÀÇ : ºÎÁ·ÇÑ ¸Þ¸ð¸®´Â °ú´ÙÇÑ ½º¿ÍÇÎ(swapping)°ú ÆäÀÌ¡(paging)ÀÇ ¿øÀÎÀÌ µÈ´Ù.