본문 바로가기

IT-Consultant

vmstat 결과 분석

원론적인 이야기는 생략하자.
직관적으로 생각할 수 있게 정리한다. 
         procs           memory                   page                              faults       cpu
    r     b     w      avm    free   re   at    pi   po    fr   de    sr     in     sy    cs  us sy id
    2     5     0  3044320   67760    0    0     0    0     0    0     0   9260  50534  5935  29 13 58
r : CPU 병목현상(숫자는 대기하는 프로세스 수)
b : DISK IO 병목현상(숫자는 대기하는 프로세스 수)
w : MEM 부족현상(커널파라미터 조정 또는 메모리 증설 필요)
cs : 숫자가 크면 쓰레스 수가 너무 많다는 것이다.
us : 어플리케이션 병목현상
sy : 시스템 자원(주로 Disk IO) 병목현상  
id : 숫자가 크면 CPU가 논다. 


vmstat 예제(영문) 성능 

2004/05/12 17:34

http://blog.naver.com/matiz7945/140002425647

$ vmstat 5 
procs memory page disk faults cpu 
r b w swap free re mf pi po fr de sr f0 s0 s1 s5 in sy cs us sy id 
0 0 0 9760 16208 0 4 6 2 5 0 0 0 99 35 19 58 92 55 6 2 92 
0 0 12 293848 2088 0 1 3 0 0 0 0 0 1 0 0 105 140 50 0 0 99 

Here are tips to be aware: 

1. Ignore the first line of the vmstat output. 

2. memory - free: 
Don't waste time worrying about where all the RAM has gone. The system 
stops bothering to reclaim memory above certain level (ie., 3% of the 
total RAM or a fixed MB in size depending on the Solaris Revisions) after 
a while even if no load is occuring on the system. 

3. procs - w: 
You may igoore this. This is a count of how many idle processes are 
currently swapped out. 

4. page -pi & po: 
Page-ins and page-outs are normal since all filesystem I/O is done 
by means of the paging process. A high value (hundreds or thousands of 
KB) indicates the sytem is working hard. 

5. page -sr: 
Scan rate. 
High continuous activity indicates you are short of memory 
(ie., over 200 pages/second averaged over 30 seconds). 

6. procs -r: 
Run queue. 
If the run queue is more than 4 times the number of CPUs, processes 
end up waiting too long for a slice of CPU time. This maybe 
be an indication of a CPU shortage. 

7. procs -b: 
A blocked process. 
This is a sign of a disk bottleneck. If the number of blocked 
processes approaches or exceeds the number in the run queue, tune 
your disk subsystem. Note that the vmstat output includes wait for I/O 
for the blocked processes in its CPU idle value (but it can be better 
viewed with 'iostat' or 'sar'). 

8. cpu -sy: 
CPU system time. 
If there is more system time than user time (and the machine is not 
an NFS server where the entire service is done inside the kernel), 
you may have a problem. To understand the source of problem (ie., 
sytem calls, high interrupt rates, and excessive mutex contention), 
try 'truss -c' or 'mpstat'. 

9. Watch out for a CPU hog process 
Watch out for user processes which are accumulating CPU time rapidly. 
Watch out for the system process fsflush if it is using a lot of CPU 
power. For fsflush, review the 'tune_t_fsflushr' and 'autoup' value 
set for the system. 


See "Sun Performance and Tuning -2nd edition" by Adrian Cockcroft & 
RIchard Pettit for further explanation on vmstat.