Linux vmstat Commands Using Tutorial

  

vmstat is a tool for viewing virtual memory usage.

General format: vmstat [-V] [-n] [delay [count]]

Common options: -V : Print version information. -n : The output header information is only displayed once during the cyclic output. Delay : The time between two outputs, in seconds. Count : The number of times counted by this interval. -a : Displays active and inactive memory sizes.

Example: # vmstat 2 3 Print every 2 seconds for a total of 3 prints.

# vmstat 10 prints every 10 seconds until you press Ctrl+C. The vmstat command output is divided into six parts. (1) The procs process: r: The number of processes waiting in the run queue. If this value is longer than the number of CPUs in the system, it means that the CPU resources are insufficient. You can consider increasing the CPU. b: The number of processes waiting for I/O.

(2)memoy memory: swpd: use virtual memory size (in KB). Free: The number of free memory (in KB). Buff: The amount of memory used in the buffer (in KB). Cache: The amount of memory used (as KB).

(3)swap exchange page: si: The number of pages written to the memory from the disk swap area, in KB/sec. So: The number of pages written from memory to the disk swap area, in KB/sec. In general, the values ​​of si and so are all 0. If the values ​​of si and so are not 0 for a long time, it means that the system has insufficient memory and you need to consider whether to increase the system memory.

(4) io block device: bi: The total amount of data read from the block device (ie, read disk, in KB/sec). Bo: The total amount of data written to the block device (ie, write disk in KB/sec).

(5) system: in: The number of interrupts per second, including clock interrupts. Cs: number of environmental context switches per second. The larger the above two values, the more CPU time the kernel will consume.

(6) cpu central processing unit: us: the time used by the user process, expressed as a percentage. Sy: The time used by the system kernel process, expressed as a percentage. Id: Free time, expressed as a percentage. Wa: The time spent waiting for disk IO, expressed as a percentage. The higher the wa value, the more serious the IO wait. St: st generally does not pay attention to the percentage of time the virtual machine takes up.

Online, mainly look at the columns r, b, bi, bo, wa, to see if the CPU, disk I /O resources are insufficient.

Copyright © Windows knowledge All Rights Reserved