Analysis of Linux vmstat output method

Time:2022-1-14

Vmstat
procs ———–memory———- —swap– —–io—- –system– —-cpu—-
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 100152 2436 97200 289740 0 1 34 45 99 33 0 0 99 0
procs
Column r indicates the number of processes running and waiting for CPU time slice. If it is greater than 1 for a long time, it indicates that the CPU is insufficient and needs to be increased.
Column B indicates the number of processes waiting for resources, such as I / O or memory exchange.
CPU indicates the usage status of CPU
The US column shows the percentage of CPU time spent in user mode. When the value of us is relatively high, it indicates that the user process consumes more CPU time, but if it is greater than 50% for a long time, it needs to consider optimizing the user’s program.
The sy column shows the percentage of CPU time spent by the kernel process. Here, the reference value of us + sy is 80%. If US + sy is greater than 80%, there may be insufficient CPU.
The wa column shows the percentage of CPU time spent waiting for Io. Here, the reference value of Wa is 30%. If wa exceeds 30%, it indicates that IO waiting is serious, which may be caused by a large number of random disk access, or by the bandwidth bottleneck of disk or disk access controller (mainly block operation).
The ID column shows the percentage of time the CPU is idle
System displays the number of interrupts that occurred during the acquisition interval
The in column indicates the number of device interrupts per second observed in a time interval.
The CS column indicates the number of context switches generated per second. For example, when CS is much higher than disk I / O and network packet rate, it should be further investigated.
memory
The amount of memory swpd switches to the memory swap area (k). If the value of swpd is not 0 or relatively large, such as over 100m, the system performance is normal as long as the values of Si and so are 0 for a long time
Free the amount of memory in the current free page list (k indicates)
As the amount of memory in buffer cache, buffer is generally required for reading and writing to block devices.
Cache: as the memory quantity of page cache, it is generally used as the cache of file system. If the cache is large, it indicates that there are many files using the cache. If the Bi in io is relatively small, it indicates that the file system efficiency is relatively good.
swap
The number of Si from memory into the memory swap area.
So is the amount of memory entered from the memory swap area.
IO
The total amount of data read by the Bi from the block device (read disk) (KB per second).
Bo total amount of data written by the block device (to disk) (KB per second)
Here, we set the Bi + Bo reference value to 1000. If it exceeds 1000 and the wa value is large, we should consider balancing the disk load, which can be analyzed in combination with iostat output.
The vmstat command output is divided into six parts:
(1) process procs:
R: number of processes waiting in the run queue.
B: the number of processes waiting for Io.
(2) memory memoy:
Swpd: currently available swap memory (unit: KB).
Free: free memory in KB.
Buff: the amount of memory in the buffer (unit: KB).
Cache: the amount of memory used as a cache (unit: KB).
(3) swap Exchange page
Si: number of swap pages swapped from disk to memory, unit: KB / s.
So: number of swap pages swapped from memory to disk, unit: KB / s.
(4) IO block equipment:
Bi: the number of blocks sent to the block device, unit: block / second.
Bo: the number of blocks received from the block device, unit: block / second.
(5) system:
In: number of interrupts per second, including clock interrupts.
CS: number of environment (context) switches per second.
(6) CPU central processing unit:
CS: time used by the user process. Expressed as a percentage.
SY: time used by the system process. Expressed as a percentage.
ID: idle time of CPU. Expressed as a percentage.
If R is often greater than 4 and ID is often less than 40, it indicates that the load of the CPU is very heavy. If Bi and Bo are not equal to 0 for a long time, it indicates that the physical memory capacity is too small.