Linux Performance Tuning [a] 'Big Picture: System load average load average

To test linux system performance and tuning, you should first check the global average load of linux

1. What is the average load load average

Load average is defined as the average number of processes in the run queue within a specific time interval. It can also be simply understood as the average number of active processes.

In simple terms, means the average load per unit of time, the system is in a running state and non-state average number of interruptions in the process, which is the average number of active processes, CPU usage, and it has no direct relationship.

The so-called process can run state, it is how much of the CPU or waiting for CPU process, what we commonly see the ps command, is in the R state (Running or Runnable) process.

The process is not interrupted state is in the process of kernel mode key processes, and these processes are not interrupted, such as the most common is to wait for hardware I / O response, which is what we see in the ps command D state (Uninterruptible Sleep, also called Disk Sleep) process.

For example, when a process of reading and writing data to the disk, in order to ensure data consistency, get the disk before the reply, it can not be interrupted by other processes or interrupted, this time the process will not be interrupted in the state. If the process is interrupted at this time, inconsistent data and process data disk problem prone. So, do not interrupt status is actually a protective mechanism of the process and system hardware.

So you can simply understood as, in fact, the average load is the average number of active processes. The average number of active processes, understand that the number of active processes per unit time on the intuitive, but it is actually the number of active processes exponentially decaying average. The detailed meaning of "exponential decay average" you do not care about, this is just a system of more rapid calculation, you put it directly as the average number of active processes is also no problem.

2. Why is the average load monitoring

  The load average is the average number of active processes per unit of time, the average load / CPU = number of active CPU processing unit processes. So the ideal is that each CPU are just running a process, so that each CPU was fully utilized.

  If the system has two CPU

  • When the load average of 2, meaning that all of the CPU have just been fully occupied
  • When the load average of 1 means that all the CPU idle 50%
  • When the load average is 4, meaning that all of the competition less than half of the process CPU

  From the above calculations it can be concluded, where the average is equal to the number of the best load the CPU .

The number of cpu # 20 --- Viewing system 
[node2 the root @ ~] # grep ' Model name ' / proc / cpuinfo | WC - L 20 is

3. How do you view the average load

  In the Linux system, uptime, w, top output commands will have the load average load average

[root@node2 ~]# uptime
 10:10:44 up 17 days,  1:06,  7 users,  load average: 0.05, 0.10, 0.10
[root@node2 ~]# w
 10:10:54 up 17 days,  1:06,  7 users,  load average: 0.04, 0.10, 0.10
[root@node2 ~]# top
top - 10:10:57 up 17 days,  1:06,  7 users,  load average: 0.04, 0.10, 0.10
[root@node2 ~]# tload 
0.01, 0.06, 0.07

 Finally, the contents of the command output represents the average number of processes running in the queue in the last 5, 15 minutes.

[node2 the root @ ~] # CAT / proc / average load loadavg ------ View System
 0.01  0.05  0.06  1 / 1694  83634

 / Proc filesystem is a virtual file system, do not take up disk space, it reflects the current operating system is running in memory, view files in / proc can understand the operational status of the system.

The first three numbers indicate the average number of processes running in the queue in the last 5, 15 minutes. Followed by two molecules of a number of processes running, and the denominator is the total number of processes; the other is the recent run process ID number.

3. Case Study - How much time is reasonable average load

The best known case of the average load is equal to the number of CPU, how much time that can explain high system load? How small or when the system load is low can explain it? Three average load how to use?

  3.1 First you have to know the system has several CPU - 20 Ge

# View the number of cpu system --- 20
[root@node2 ~]# grep 'model name' /proc/cpuinfo | wc -l
20

  3.2 View average load

[root@node2 ~]# uptime
10:10:44 up 17 days,  1:06,  7 users,  load average: 0.05, 0.10, 0.10

  = The number of CPU load average [optimal];

  Load average> CPU overload [number];

  The average load <CPU number of [waste]

  Three different time intervals using a 3.3 average value, trend analysis system load

    • Three substantially identical value, or less, illustrates a system load is very smooth.
    • 1 minute, far less than 15 minutes of value, it means last-minute reduction in system load, while the last 15 minutes there is a huge load.
    • If the value is much greater than a 1-minute 15-minute value, it means last-minute load increase, this increase is likely only temporary, there are likely to continue to increase it, so we need to continue to observe. Once a 1-minute load average close to or over the number of CPU, it means the system is over-overload problem occurs, then you have to analyze where the problem is a result of the investigation, and to find a way to optimize the

  3.4 average load monitoring trends, determine performance

    Generally when the average load time is higher than the number of CPU 70%, you should analyze high load troubleshoot the problem.;

    But the most recommended method, or the average load on the system monitor up, and then according to more historical data to determine trends load. When the load is found to have significantly increased the trend, such as load doubled, you then do analysis and investigation.

Guess you like

Origin www.cnblogs.com/sylvia-liu/p/11819228.html