Understanding VMSTAT Output - Explained

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
 2  5 375912  19548  17556 477472    0    1     0     0      1     1        1  0  0  1
 0  4 375912  18700  17556 478264    0    0  1044   0     774  1329   8  1   0  91
 0  5 375912  17664  17556 479168    0    0  1160   0     764  1110   8  1   0  91
 1  8 375912  15836  17568 479796    0    0  1144   840  751  1622  16 7   0  78
 0  7 375912  19340  17576 480224    0    0  1224   148  587  1958  17 18  0  65
 2  0 375912  18288  17588 481036    0    0   812    0     845  1732  18 3  21  59
 0  2 375912  15868  17588 481528    0    0  1012   0     588   941   4   1  5   90 



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).

Share this

Related Posts

Previous
Next Post »

5 comments

Write comments
Anonymous
October 11, 2012 at 8:33 PM delete

It is too les to quote the man page.
You should at least interpret the example (why is CPU Wait that high) and suggest limits for machines depending on cpu core number and the intended application.

Reply
avatar
May 25, 2015 at 7:20 AM delete

Most of linux distro default block size is 4096(4 KB).
$ sudo tune2fs -l /dev/sda1 | grep Block*
Block count: 5375742
Block size: 4096
Blocks per group: 32768

Reply
avatar
July 20, 2016 at 9:48 PM delete

Parthiban it is a good article, it will be greatful if you explain trouble shooting procedure.
ex: r: How many processes are waiting for CPU time.
if more processes are waiting a queue what to do?
System:
-------------
in: The number of interrupts per second, including the clock.---what to do if if it increases
cs: The number of context switches per second.

Reply
avatar
Anonymous
June 14, 2018 at 5:52 AM delete

Great article.
What would you make of this?: The SWPD is constant at peak and idle. Problem?
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 1 100 3430040 158992 3465124 0 0 41 2 0 0 0 0 99 0 0
0 2 100 3429892 158992 3465124 0 0 776 538 857 10131 0 1 92 7 0
0 1 100 3429892 158992 3465124 0 0 752 580 867 10420 0 1 96 4 0
1 0 100 3430016 158992 3465124 0 0 306 2844 2623 33119 1 1 96 2 0
0 1 100 3430140 158992 3465124 0 0 618 508 770 8813 0 0 97 3 0

cat proc/swaps
Filename Type Size Used Priority
/dev/dm-1 partition 16383992 100 -1

thanks

Reply
avatar

What do you think about this Article? Add your Opinion..! EmoticonEmoticon