Linux CPU Performance Tuning

Source: Internet
Author: User


CPU is one of the main factors affecting Linux performance. Vmstat command: displays brief information about the performance of various system resources.

The r in the procs column indicates the number of processes that run and wait for the CPU time slice. If this value exceeds the number of CPU for a long time, it indicates that the CPU is insufficient and the CPU needs to be increased. In the memory column: swapd indicates the number of memories that are switched to the memory swap area. Free indicates the number of idle physical memory. Buff indicates the buffer required for reading and writing Block devices (/dev/sda. Cache indicates the cache of the file system. If the value is large, the number of files in the cache is large. In swap, si indicates that the disk is transferred to the memory. So indicates that memory is transferred to the disk. In general, the si and so values are both 0. If these two values are not 0 for a long time, the system memory is insufficient and the memory needs to be added. Www.2cto.com io: displays the disk read/write status. bi indicates the total amount of data read from the disk. Bo indicates the total amount of data written to the disk. System: displays the number of interrupts that occur during the interval. in indicates the number of device interruptions per second during the grinding interval. Cs indicates the number of context switches generated per second. The larger the two values, the more CPU consumed by the kernel. Cpu: displays the CPU usage status. us displays the CPU consumption time percentage of user processes. If the value of us is higher, the CPU consumption time is longer. If the value of us is longer than 50%, You need to optimize the program or algorithm. Sy displays the percentage of CPU consumed by the kernel. If the value of us + sy is greater than 80%, there may be insufficient CPU resources. Id indicates the percentage of time when the CPU is idle. Wa displays the percentage of CPU time used by IO wait. The higher the wa, the more serious the IO wait, consider improving the disk read/write performance. Wa reference value: 20%. Sar command: separate statistics can be performed on each aspect, but the system overhead is increased, but the statistical results of the system will not be greatly affected.

We can see that my system only has one CPU. If there are multiple CPUs, multiple CPUs will be displayed. When multiple CPUs are used, if you want to calculate information about one of the CPUs, use sar-P 0 2 3 to calculate information about the first CPU. % User: CPU time consumed by user processes % nice: CPU time consumed by normal processes % system: CPU time consumed by system processes % iowait: CPU time consumed by I/O wait % idle indicates the percentage of CPU idle time % steal indicates that pagein forces steal operations on different pages in a memory-intensive environment. The Average of the last row shows the Average value of the preceding statistics. In a multi-CPU system, if the program uses a single thread, the overall CPU usage is not high, resulting in one CPU being used, and other CPUs being idle. The www.2cto.com iostat command is mainly used to calculate the disk I/O status, but can also view CPU usage, but can only display the average information of all CPUs.

The meaning of each column here is the same as that in sar. Uptime command: Mainly used to count the current running status of the system.

Average load of the system within 1 minute, 5 minutes, and 15 minutes. The above vmstat, sar, iostat, and uptime commands are mainly used to collect CPU information. You can also view the process usage through top and ps to determine the cause of excessive CPU load.

Author alan9101

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.