Friday, November 18, 2011
2:04 PM

Understanding VMSTAT Output - Explained on Linux

vmstat is a nice tool, to analyze the Linux / UNIX server performance.

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b        swpd   free         buff  cache          si   so    bi    bo   in    cs   us sy id wa st
 0  0 1183588 1361312 234324 451696    0    0     2    17    0    2     0  0 100  0  0
 0  0 1183588 1361064 234324 451700    0    0     0     8 1014  449  0  0 99  0  0
 0  0 1183588 1361064 234324 451704    0    0     0     8 1012  457  0  0 100  0  0
 0  0 1183588 1361064 234336 451700    0    0     0    62 1016  463  0  0 100  0  0
 0  0 1183588 1361064 234344 451704    0    0     0    16 1014  499  0  0 100  0  0

 
Proc: 
-------
r: How many processes are waiting for CPU time.
b: Wait Queue - Process which are waiting for I/O (disk, network, user 
    input,etc..) 


Memory: 
-----------
swpd: shows how many blocks are swapped out to disk (paged). Total Virtual  
          memory usage. 
            
Note: you can see the swap area configured in server using "cat proc/swaps"


free: Idle Memory 
buff: Memory used as buffers, like before/after I/O operations
cache: Memory used as cache by the Operating System


Swap: 
---------
si: How many blocks per second the operating system is swapping in. i.e 
    Memory swapped in from the disk (Read from swap area to Memory)
so: How many blocks per second the operating system is swaped Out. i.e 
     Memory swapped to the disk (Written to swap area and cleared from 
     Memory)


In Ideal condition, We like to see si and so at 0 most of the time, and we definitely don’t like to see more than 10 blocks per second.


IO: 
------
bi: Blocks received from block device - Read (like a hard disk) 
bo: Blocks sent to a block device - Write


System: 
-------------
in: The number of interrupts per second, including the clock. 
cs: The number of context switches per second. 


CPU: 
--------
us: percentage of cpu used for running non-kernel code. (user time, including 
     nice time) 
sy: percentage of cpu used for running kernel code. (system time - network, IO 
     interrupts, etc) 
id: cpu idle time in percentage.
wa: percentage of time spent by cpu for waiting to IO.




If you used to monitor this data, you can understand how is your server doing during peak usage times. 


Note: the memory, swap, and I/O statistics are in blocks, not in bytes. In Linux, blocks are usually 1,024 bytes (1 KB).

0 comments:

Post a Comment