Show virtual memory status
The vmstat command means to display virtual memory status ("Viryual Memor Statics"), but it can report on the overall operating status of the system such as processes, memory, I/O, etc.
vmstat(options)(parameters)
-a: Display the inner page of the event;
-f: Displays the total number of processes created after startup;
-m: Display slab information;
-n: The header information is only displayed once;
-s: Display event counters and memory status in table format;
-d: Report disk status;
-p: Display the specified hard disk partition status;
-S: Unit of 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 description:
Procs (process)
Memory
Swap
Note: When the memory is sufficient, these two values are both 0. If these two values are greater than 0 for a long time, system performance will be affected, and disk IO and CPU resources will be consumed. Some friends think that the memory is not enough when they see that the free memory (free) is very small or close to 0. You can't just look at this, but also combine si and so. If there is very little free, there are also very few si and so. (Most of the time it is 0), then don’t worry, system performance will not be affected at this time.
IO (current Linux version block size is 1kb)
Note: When reading and writing random disks, the larger these two values are (such as exceeding 1024k), the larger the value you can see that the CPU is waiting for IO.
system
Note: The larger the above two values are, the greater the CPU time consumed by the kernel will be.
CPU (expressed as a percentage)
When the value of us is relatively high, it means that the user process consumes a lot of CPU time, but if the usage exceeds 50% for a long time, then we should consider optimizing the program algorithm or accelerating it.
When the value of sy is high, it means that the system kernel consumes a lot of CPU resources. This is not a benign performance and we should check the reason.
When the value of wa is high, it means that the IO wait is serious. This may be caused by a large number of random accesses on the disk, or there may be a bottleneck (block operation) on the disk.