vmstat is one of the popular tool to analyze the Linux / UNIX server performance.
# vmstat 1 5
procs ———–memory———- —swap– —–io—- –system– —-cpu—-
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 129277344 346144 2033648 0 0 0 4 0 0 0 0 100 0
0 0 0 129277344 346144 2033648 0 0 0 0 1044 102 0 0 100 0
0 0 0 129277344 346144 2033648 0 0 0 0 1020 97 0 0 100 0
0 0 0 129277280 346144 2033648 0 0 0 0 1048 99 0 0 100 0
0 0 0 129277280 346144 2033648 0 0 0 0 1008 66 0 0 100 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).