The practice of Linux system optimization

Source: Internet
Author: User
Tags file system time interval cpu usage

As a Linux system administrator, the most important task is to optimize the system configuration, so that the application on the system in the optimal state of operation, but due to hardware problems, software problems, network environment and other complexity and variability, resulting in the optimization of the system becomes extremely complex, how to locate performance problems in which respect, is a big problem of performance optimization, this chapter begins with the system, focusing on the performance problems caused by improper system hardware and software configuration, and gives the general method and process of detecting system fault and optimizing performance.

1 CPU Performance Assessment

CPU is one of the main factors that affect Linux performance, here are a few commands for viewing CPU performance.

1.1 Vmstat Command

This command displays brief information about the performance of the various resources in the system, which we use primarily to look at a CPU load.

The following is the output of the Vmstat command on a system:

[Root@node1 ~]# Vmstat 2 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 162240 8304 67032 0 0 13 21 1007 23 0 1 98 0-0

0 0 0 162240 8304 67032 0 0 1 0 1010 20 0 1 100 0-0

0 0 0 162240 8304 67032 0 0 1 1 1009 18 0 1 99 0-0

The output of each item above is explained as follows:

Procs

The R column represents the number of processes running and waiting for the CPU time slice, which, if it is longer than the number of system CPUs, indicates that the CPU is low and needs to be increased.

Column B indicates the number of processes waiting on the resource, such as waiting for I/O, or memory swapping.

Memory

The SWPD column represents the amount of memory that is switched to the memory swap area (in K). If the value of SWPD is not 0, or relatively large, as long as SI, so the value of long-term 0, this case generally do not worry, will not affect system performance.

The free column represents the amount of physical memory currently idle (in K)

The Buff column represents the amount of memory buffers cache, which is generally required to read and write to a block device.

Cache column represents the amount of memory page cached, generally as a file system cached, frequently accessed files will be cached, if the cache value is large, the number of cached files, if the IO in the bi is relatively small, the file system efficiency is better.

Swap

The SI column represents the amount of memory entered into the memory swap area by the disk.

The so column represents the amount of memory that is transferred to the disk, that is, the memory swap area entering memory.

Under normal circumstances, SI, so the value is 0, if Si, so the value of the long-term is not 0, the system is not enough memory. Additional system memory is required.

IO entry shows disk read/write status

The BI column represents the total amount of data read from a block device (that is, a read disk) (KB per second).

The Bo column represents the total amount of data written to the block device (that is, write disk) (KB per second)

Here we set the Bi+bo reference value of 1000, if more than 1000, and the WA value is large, the system disk IO is a problem, you should consider improving disk read and write performance.

System displays the number of interrupts that occurred during the collection interval

The in column represents the number of device interrupts per second observed during a time interval.

The CS column represents the number of context switches generated per second.

The larger the above 2 values, the more CPU time will be consumed by the kernel.

The CPU item shows the CPU usage status, and this column is our focus.

The US column shows the percentage of CPU time consumed by the user process. When US values are high, the user process consumes more CPU time, but if it is longer than 50%, you need to consider an optimizer or algorithm.

The SY column shows the percentage of CPU time consumed by the kernel process. The high value of SY indicates that the kernel consumes a lot of CPU resources.

Based on experience, Us+sy's reference value is 80%, and if Us+sy is greater than 80%, there may be a shortage of CPU resources.

The ID column shows the percentage of time that the CPU is in idle state.

The WA column shows the percentage of CPU time that the IO wait takes. The higher the WA value, description io Wait for the more serious, according to experience, WA's reference value is 20%, if WA more than 20%, indicating the IO waiting for serious, cause IO wait may be caused by a large number of random disk read or write, or the disk or disk controller bandwidth bottlenecks caused by (mainly block operations).

To sum up, in the assessment of the CPU, it is important to focus on the values of the Procs r column and the values of the US, SY, and ID columns in the CPU entry.

Related Article

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.