Linux vmstat command for performance monitoring

Source: Internet
Author: User

There are many system performance analysis tools in Linux, including top, free, PS, time, Timex, and uptime. The following describes

To use vmstat.

Monitor memory usage with vmstat
Vmstat is short for virtual MEOMORY statistics (Virtual Memory statistics,

CPU activity is monitored. It collects statistics on the overall situation of the system. The disadvantage is that a process cannot be thoroughly analyzed.
The syntax of vmstat is as follows:

Vmstat [-V] [-N] [delay [count]
Among them,-V indicates printing the published information;-N indicates that the output header information is only displayed once during cyclic output; Delay

Is the delay time between two outputs; count refers to the number of times counted according to this interval. For the meaning of each field output by vmstat,

Run man vmstat to view details.

Oracle @ Oracle [/home/Oracle] vmstat 30

Procs ----------- memory ---------- --- swap -- ----- Io ---- System -- ----- CPU ------
R B SWPD free buff cache Si so Bi Bo in CS us Sy ID wa st
0 7 191060 46436 8516 6320140 0 0 25145 3988 2953 7 2 45 47 0
0 8 191060 46772 8944 6262940 0 0 18306 4123 2762 6 2 42 50 0
0 8 191060 46048 9476 6214968 0 0 16523 5260 2444 7 2 39 52 0
0 8 191060 45504 10584 6260116 3 0 14665 5954 2553 5 5 40 49 0
0 7 191060 80140 11088 6280616 0 0 20427 2419 2942 4 2 55 39 0
1 6 191060 46632 10948 6305656 0 0 17997 4201 1295 4 3 60 33 0
1 8 191060 45676 10240 6191764 7 0 29717 888 1258 5 6 58 31 0
0 9 191060 45600 8608 6180256 0 0 24880 2717 1220 3 1 56 40 0
0 10 191060 44984 9056 6169620 0 0 24803 1591 1224 3 1 51 44 0
0 9 191060 46476 9816 6165352 0 0 20735 2587 1186 3 1 50 46 0
0 8 191060 46524 11084 6011804 9 0 15602 5370 1223 5 2 46 47 0

PS: Write Once in 30 seconds, no limit, if there is a limit to print 5 times: vmstat 30 5

Procs
R: Number of processes awaiting running
B: Number of processes in non-interrupted sleep state (number of I/O processes waiting)
W: Number of processes that can be switched out.
This number is calculated by Linux, but Linux does not exhaust swap space.
Quasi-test
R, B ≈ 0

Memory
SWPD: virtual memory usage, unit: KB (switch to memory on swap memory)
If the value of SWPD is not 0, or it is large, but the value of Si and so is 0 for a long time, you do not have to worry about affecting system performance.
Free: idle memory, in KB (idle physical memory)
Buff: The amount of memory used as the cache. Unit: KB (as the buffercache memory, buffer the reading and writing of Block devices)
Cache: Memory Used as the page cache, the cache of the file system
If the cache value is large, it indicates that the number of files in the cache is large. If files frequently accessed are cached

The disk read Io BI will be very small.

Swap
Si: Number of swap pages from disk swap to memory, measured in KB/second
So: the number of pages exchanged from the memory to the disk. Unit: KB/second
When the memory is sufficient, both values are 0. If these two values are greater than 0 for a long time, the system performance will be affected, and the disk I/O and CPU resources

All sources consume
If there are few free items but few Si so items (mostly 0), do not worry about performance impact.

Io
BI: number of blocks sent to the block device. Unit: block/second (read disk)
Bo: number of blocks received from the block device. Unit: block/second (write disk)
The larger the two values, the larger the value of CPU waiting for I/O.

System
In: The number of interrupts per second, including clock interruptions.
CS: Number of environment (context) switches per second
The larger the values, the larger the CPU time consumed by the kernel.

CPU
Display by CPU usage percentage
US: CPU usage time
Sy: CPU system usage time
ID: idle time
Wa: Percentage of CPU time consumed by I/O wait

Generally, Sy takes less than 10% of the time. Otherwise, you need to check the CPU usage of the system,
The ideal status for a single user is to make the CPU in the 100% working state,
If the "us + sys" 80 in a multi-user environment is used, the process will wait for time in the running queue, and the response time and throughput will decrease.
When the WA value is high, the IO wait is serious. It may be caused by a large number of random access to the disk or disk bottlenecks (block operations)
Wa> 40 indicates that there may be no unreasonable balance between disk Io or frequent disk operations.
US continues to exceed 50, which is acceptable during peak service hours.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.