System performance monitoring Tool-Vmstat

Source: Internet
Author: User
Tags high cpu usage

Used to obtain information about processes, virtual storage, paging space, and CPU activity in UNIX systems. This information reflects the load situation of the system. Vmstat displays statistics from the start of the system startup at the first run, and then runs Vmstat displays statistics from the last time the command was run. Users can obtain the required statistics by specifying the number and time of the statistics.
1) output a message every 1 seconds, a total output of 3 after the exit
Vmstat 1 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 0 531760 67284 231212 108 0 0 260 111 148 1 5 86 8 0
0 0 0 531752 67284 231212 0 0 0 0 33 57 0 1 99 0 0
0 0 0 531752 67284 231212 0 0 0 0 40 73 0 0 100 0 0

Information about the process is: (procs)
R: The number of processes waiting in the ready state, indicating the number of processes in the running queue that have been allocated to resources waiting for CPU allocation to run, and when this value exceeds the number of CPUs, a CPU bottleneck occurs. This is also related to top of the load, the general load over 3 is relatively high, more than 5 is high, more than 10 is not normal, the state of the server is very dangerous. The load on top is similar to the run queue per second. If the running queue is too large, it means that your CPU is busy, which generally results in high CPU usage.
B: Indicates the number of processes that are blocking the wait for IO or other resources.

1) The Memory information is: (memory)
SWPD: The virtual memory swap size in use, in kilobytes. Combined with the Swap column.
Free: idle memory space.
Buff: The size of the buff used to buffer the read and write of the block device.
Cache: The cache size used, the file system cache.

2) information about the paging space is: (swap)
Si: Swap memory usage, the size of the transferred disk into memory, per second.
So: Swap memory usage, the size of the transfer from memory to disk, per second.

3) information about IO block devices is: (IO)
BI: Total amount of data read from a block device (read disk) (KB/S)
Bo: Total amount of data written to the block device (write disk) (KB/S)

4) Information about the failure is: (System)
In: Number of interrupts per second within the specified time. Includes hard interrupts and soft interrupts.
CS: The number of context switches per second within a specified time. For example, call the system function, the context switch, the thread switch, also to the process context switch, the smaller the better, too big, to consider the number of threads or processes, such as in Apache and Nginx Web server, We generally do performance testing will carry out thousands of concurrent or even tens of thousands of concurrent tests, the selection of the Web server process can be the process or the peak of the thread has been down, pressure measurement, until CS to a relatively small value, the process and the number of threads is a more appropriate value. System calls are also, each time the system function is called, our code will enter the kernel space, resulting in context switching, this is very resource-intensive, but also try to avoid frequent calls to system functions. Too many context switches means that most of your CPU is wasted in context switching, resulting in less time for the CPU to do serious work, and the CPU not being fully utilized, is undesirable.

5) Information about the CPU is: (CPU)
US: CPU utilization in the user state during the specified time interval.
SY: CPU utilization in the kernel mentality at the specified time interval.
ID: The CPU idle time ratio during the specified time interval.
WA: The CPU is idle for I/O during the specified time interval.

Vmstat can be used to determine whether the work of a system is limited to CPU or memory: If the CPU's SY and US values are added close to 100%, or the number of processes waiting in the run queue (R) is always not equal to 0, and is often greater than 4, and the ID is often less than 40, The system is CPU-bound and if the value of bi and Bo is always not equal to 0, then the system is limited to memory.

System performance monitoring Tool-Vmstat

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.