The vmstat helps you to identify bottlenecks on your server. It displays real-time performance information about processes, memory, paging, disk I/O, and CPU usage.
Here’s sample output (Oracle Linux 5.6):
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 0 339904 74636 440928 0 0 67 25 108 81 1 0 96 3 0
Descriptions of the columns:
r: The number of processes waiting for run time
b: The number of processes in uninterruptible sleep
swpd: Total virtual memory (swap) in use (KB)
free: Total idle memory (KB)
buff: Total memory used as buffers (KB)
cache: Total memory used as cache (KB)
si: Amount of memory swapped in from disk (KB/s).
so: Amount of memory swapped to disk (KB/s).
bi: Blocks received from a block device (blocks/s).
bo: Blocks sent to a block device (blocks/s).
in: The number of interrupts per second, including the clock.
cs: The number of context switches per second.
us: User-level code time as a percentage of total CPU time
sy: System-level code time as a percentage of total CPU time
id: Idle time as a percentage of total CPU time.
wa: Time spent waiting for IO.
st: Time stolen from a virtual machine.
Prior to Linux kernel 2.5.41, idle time also includes IO-wait time.
Some quick tips about reading output of vmstat:
- If the “wa” (time spent waiting for IO) column is high, it shows that the storage subsystem is overloaded.
- If the “b” (# of processes in uninterruptible sleep) is consistently greater than 0, it show that you may not have enough CPU.
- If the “so” (memory swapped to disk) and the “si” (memory swapped in from disk) are consistently greater than 0, it shows that there’s a memory bottleneck.