Vmstat of Linux system performance tuning

Source: Internet
Author: User
Tags switches high cpu usage

A Vmstatread more at http://www.07net02.com

The Vmstat command reports statistical information about kernel threads, virtual memory, disks, traps, and CPU activity. Reports generated by the Vmstat command can be used to balance system load activity. These system-wide statistics (all processors) calculate the average as a percentage, or calculate its sum.

Vmstat can show the status of the server at a given time interval, including server CPU utilization, memory usage, virtual memory exchange, IO Read and write situations.

The use of the general Vmstat tool is done by two numeric parameters, the first parameter is the number of time intervals sampled, the unit is seconds, the second parameter is the number of samples, such as:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7C/DF/wKioL1baVKGC1l4nAACYCUDLHdE321.png "title=" Sogou March 03, 16 2215_1.png "alt=" Wkiol1bavkgc1l4naacycudlhde321.png "/>


The second command above means that it's only going to be collected every two seconds.

Now understand the parameters of the acquisition:

R: Indicates the running queue, when this value exceeds the number of CPUs, there will be bottlenecks, the general load of more than 3 is relatively high, more than 5 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: Process blocking

swap : The size of virtual memory used, if greater than 0, indicates that your machine is out of physical memory, if not the cause of program memory leaks, then you should upgrade the memory or the memory-consuming task to other machines.

The Free: column represents the amount of physical memory currently idle (in kilobytes)

Buff: column represents the amount of memory buffers cache, generally read and write to block devices need to buffer; here 8676k;

Si: The size of the virtual memory read from disk per second, if the value is greater than 0, indicates that the physical memory is not enough or memory leaks, to find the consumption of memory process resolved.

So: the size of virtual memory written to disk per second, if this value is greater than 0, ibid.

BI: Block device receives the number of blocks per second, where the block device refers to all the disk and other block devices on the system, the default block size is 1024byte, I have no IO operation on this machine, so has been 0;

Bo: The number of blocks that a block device sends per second, such as when we read a file, the Bo will be greater than 0. Bi and Bo are generally close to 0, otherwise the IO is too frequent and needs to be adjusted.

In: CPU interrupts per second, including time interruption;

cs: The number of context switches per second, for example, we 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.

US: User CPU time, I used to do encryption and decryption very frequently on the server, you can see us approaching 100,r running queue reached 80 (the machine is doing stress testing, poor performance).

SY: System CPU time, if too high, indicates a long system call time, for example, the IO operation is frequent.

ID: System CPU time, if too high, indicates a long system call, such as frequent IO operations.

WT: waits for IO CPU time.


This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://2367685.blog.51cto.com/2357685/1747795

Vmstat of Linux system performance tuning

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.