Linux detection command (vmstat) command format:
vmstat [-a] [-n] [-S unit] [delay [count]] vmstat [-s] [-n] [-S unit] vmstat [-m] [-n] [delay [count]] vmstat [-d] [-n] [delay [count]] vmstat [-p disk partition] [-n] [delay [count]] vmstat [-f] vmstat [-V]
Command functions: virtual memory to display information about the command parameters:
-a: Display active and inactive memory
-f: the number of fork display start date from the system.
-m: show slabinfo
-n: show only once at the beginning of each field name.
-s: display memory-related statistics for the number of systems and a variety of activities.
delay: refresh interval. If not specified, show only one result.
count: refreshes. If you do not specify a refresh frequency, but specifies the refresh interval, then refresh frequency is infinite.
-d: display disk statistics.
-p: display statistics for a specified disk partition
-S: Using the specified units. Parameters k, K, m, M, representing 1000,1024,1000000,1048576 byte (byte). The default unit is K (1024 bytes)
-V: Display vmstat version information.
[Root@www.linuxidc.com ~] # vmstat 2 8 procs ----------- memory ---------- - --swap-- ----- io- --- --system-- ----- cpu ----- rb swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 21928380 471140 9757520 0 0 0 6 9 12 0 0 100 0,000,021,928,388,471,140 9,757,524,002,601,091 20990010000000 21928372 471140 9,757,524,000,581,067 20850010000000 21,928,240 471140 9757524 00060108321040 0 1,000,000,021,928,224 471,144 9,757,524,000,641,079 21000010000100 21928224 471 144 9,757,528,002,521,081 20920010000000 21,921,000 471,144 9757528 00680118821620 0 99 0,010,021,920,628,471,144 9,757,548 0,007,410,942,110,001,000 0
Linux memory monitor vmstat command output is divided into six parts:
(1) Process procs:
r: The number of processes in the run queue waiting. When this value exceeds the number of CPU, there will be a CPU bottleneck. The top of the load and also has a relationship, generally more than 3 load is relatively high, more than 5 will be high, more than 10 is not normal, the status of the server is very dangerous. top load similar second run queue. If the run queue is too large, that your CPU is very busy, usually resulting in high CPU utilization.
b: the number of waiting for io process. When this value is a high Description I / O wait serious.
(2) Linux memory monitor memory memoy:
swpd: now available swap memory (in KB).
free: free memory (in KB).
buff: the buffer to the number (unit: KB) of memory.
cache: is used as a cache memory (Unit: KB).
(3) Linux memory monitor exchange swap page
si: the amount of swap pages from memory to disk swapping, unit: KB / sec.
so: the number of swap pages from memory is swapped to disk, unit: KB / sec.
(4) Linux memory monitoring io block device:
bi: Blocks sent to a block device, unit: blocks / sec.
bo: Blocks received from a block device to the number of units: Block / sec.
(5) Linux system memory monitoring system:
in: the number of interrupts per second, including the clock interrupts.
cs: second environment (context) conversions.
(6) Linux memory cpu monitor CPU:
cs: user process time. Expressed as a percentage. If you are using more than 40%, then we should consider the optimization process
sy: system time used by the process. Expressed as a percentage. If you use more than 40%, then we should consider the operating system BUG or by public transport, and so on .....
id: central processor idle time if long-term use of more than 50% if more than 40%, then we should consider the optimization algorithm or program to add CPU wa: the percentage of CPU time consumed by IO wait wa value is high, indicating IO wait Comparison severe, this may be due to the large number of disks in random access cause, there may be a bottleneck of bandwidth disk (operation block). If r is often greater than 4, and id is often less than 40 indicates a heavy load on the central processor. If bi, bo long-term is not equal to 0, indicating that the physical memory is too small
Summary: Use this command to gather information that can help us analyze it server I / O problem, or CPU problem, very useful command.