First, view the system load
If your computer is slow, you might want to look at, whether it's too much work.
In the Linux system, we generally use the uptime command (w commands and commands top line). (In addition, they are on Apple's Mac computers are also suitable.)
Uptime you type in a terminal window, the system returns a line of information.
This latter part of the line information display "load average", it means "the average load of the system," there are three numbers, which we can determine the system load is large or small.
Why are there three figures? You find the manual, they mean it is 1 minute, 5 minutes, the average load of the system within 15 minutes.
If you continue to look at the manual, it will tell you exactly when the CPU is idle, the average load is 0; when the CPU workload saturated, the average load is 1.
Clearly then, the lower the "load average" values, such as equal to 0.2 or 0.3, it means that the smaller the amount of work the computer, the system load is relatively light.
But what can be seen when the system load is heavy it? Equal to 1 when, or equal to or equal to 1.5 when 0.5? If 1 minute, 5 minutes, 15 minutes three values are not the same, how do?
Second, an analogy
Analyzing the system load is too heavy, you must understand the true meaning of the load average. Here, in accordance with "Understanding Linux CPU Load" in this article, try to use the most popular language to explain the problem.
First, assume the simplest case, your computer has only one CPU, all operations must be done by the CPU.
Well, we might think of this CPU as a bridge, the bridge is only one lane, all vehicles must be from the root through the lane. (Obviously, the bridge is only one way.)
System load is 0, the car does not mean that the bridge.
System load of 0.5, meaning that half of the bridge road car.
System load of 1.0, all sections of the bridge means has a car, which means that the bridge had been "filled" the. It must be noted that, until now still be able to smooth the passage of the bridge.
System load of 1.7, means that the vehicle too much, the bridge has been filled (100%), followed by waiting vehicles on the bridge deck is 70% of the vehicle. And so on, the system load is 2.0, which means waiting on the bridge deck of the vehicle and the vehicle as much; the system load is 3.0, which means that the vehicle is waiting on the bridge deck of the vehicle twice. In short, when the system load is greater than 1, the back of the vehicle must wait; the larger the system load, the bridge would have to wait the longer.
System CPU load, substantially identical to the above analogy. Capacity of the bridge, is the biggest workload of the CPU; vehicle on the bridge, the CPU is a wait process (process).
If the CPU processes up to 100 per minute, the system load of 0.2, means that the CPU in this one just 20 minutes treatment processes; system load 1.0, means that the CPU 100 processes just handle this one minutes; 1.7 System Load It means that in addition to CPU 100 processes being processed, as well as 70 process is waiting in the CPU.
For computers running smoothly, the system load should not exceed 1.0, so there is no need to wait for the process, all processes can be dealt with first. Obviously, 1.0 is a critical value, above this value, the system is not in the best condition, you want hands intervened.
Third, the rule of thumb system load
1.0 is an ideal value system load it?
Not necessarily, the system administrator will often leave little room, if the value of 0.7, it should attract attention. The rule of thumb is this:
When the system load duration is greater than 0.7, you have to start the investigation, where the problem is to prevent the situation worsening.
When the system load duration is greater than 1.0, you need hands to find solutions to this value down.
When the system load of 5.0, it means that your system has a very serious problem for a long time did not respond, or nearly crashed. You should not allow the system to achieve this value.
Above, we assume that your computer has only one CPU. If your computer has installed two CPU, what happens then?
2 CPU, means the computer's processing power has doubled, the number of processes can be processed simultaneously also doubled.
Or by analogy to the bridge, two CPU means that the bridge has two lanes, and traffic capacity doubled.
So, two CPU load indicates that the system can reach 2.0, where each CPU has reached 100% of the workload. To promote open, n-CPU computer, acceptable maximum system load n.0.
Fifth, multi-core processors
A CPU chip manufacturers often inside, comprising a plurality of CPU cores, this is called multi-core CPU.
In terms of system load, similar to the multi-core CPU and multi-CPU results, so consider the system load, it must be considered that there are several computer CPU, each CPU has several core. Then, the system load divided by the total number of cores, each core as long as the load is not more than 1.0, means that the computer works.
How to know how many computer CPU core it?
"Cat / proc / cpuinfo" command, you can view the CPU information. "Grep -c 'model name' / proc / cpuinfo" command directly returns the total number of the CPU core.
****** CPU Information ******
cpu Model: 40 Intel (R) Xeon (R) CPU E5-2680 v2 @ 2.80GHz
The number of logical cpu: 40
The number of physical cpu: 2
Each physical CPU core number: 10 ---- When the load does not exceed 20 says that the computer is running normally
(Greater than 1 indicates whether to support Hyper-Threading support): 2
Memory Size: 64375 M
[Root @ HaoDai_App_DB01 toolsqldir] # uptime
10:02:08 up 207 days, 5:51, 1 user, load average: 6.37, 5.34, 4.93
Sixth, the best observation duration
One last question, "load average" total return an average of three ---- 1 minute system load, system load 5 minutes, 15 minutes system load, which should refer ---- value?
If there is only a 1-minute system load is greater than 1.0, the other two time periods are less than 1.0, indicating that only a temporary phenomenon, not a big problem.
(After adjusting CPU cores) If within 15 minutes, the average system load is greater than 1.0, indicating that the problem is persistent, not a temporary phenomenon. So, you should observe the main "15 minutes system load", it would be as an indicator of normal operation of the computer.