Display virtual memory statistics.
The vmstat command stands for "Virtual Memory Statistics," but it can report overall system status regarding processes, memory, I/O, and more.
vmstat (option) (parameter)
-a: Display active memory pages;
-f: Display the total number of processes created since boot;
-m: Display slab information;
-n: Display the header only once;
-s: Display event counters and memory statistics in a table format;
-d: Report disk statistics;
-p: Display statistics for a specified hard disk partition;
-S: Specify the units for output information.
vmstat 3
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 320 42188 167332 1534368 0 0 4 7 1 0 0 0 99 0 0
0 0 320 42188 167332 1534392 0 0 0 0 1002 39 0 0 100 0 0
0 0 320 42188 167336 1534392 0 0 0 19 1002 44 0 0 100 0 0
0 0 320 42188 167336 1534392 0 0 0 0 1002 41 0 0 100 0 0
0 0 320 42188 167336 1534392 0 0 0 0 1002 41 0 0 100 0 0
Field Descriptions:
Procs (Processes)
Memory
Swap
Note: When there is enough memory, both values are 0. If these values are consistently greater than 0, system performance may be affected as disk I/O and CPU resources are consumed. Do not worry if free memory is low as long as si and so remain low (mostly 0).
IO (Block size is typically 1KB in current Linux versions)
Note: During random disk I/O, higher values (e.g., > 1024K) will lead to higher CPU I/O wait times.
System
Note: Higher values for these two fields result in more CPU time consumed by the kernel.
CPU (Expressed as percentages)
us values mean user processes are consuming a lot of CPU; if consistently over 50%, consider optimizing the program.sy values indicate the kernel is consuming significant CPU resources, which should be investigated.wa values indicate serious I/O waiting, possibly due to heavy random disk access or disk bottlenecks.