Linux system load concept (load average)

Source: Internet
Author: User

First, view the system load

If your computer is slow, you might want to check to see if it's too much work.

In Linux systems, we generally use the uptime command to view (W and top commands are also OK). (in addition, they are also available on Apple's Mac computers.) )

You type uptime in the terminal window and the system returns a line of information.

<span style= "FONT-SIZE:18PX;"  >17:17 [[Email protected]]$ uptime 17:19:58 up 358 days, 23:23,  5 users,  load average:0.24, 0.32, 0.34You Mail in/var/spool/mail/roottty:[0] jobs:[1] cwd:[/home/data/exchange/job]</span>

The second half of this line of information shows "load average", which means "average load of the system", with three numbers in it, from which we can tell if the system load is large or small.

Why is there a three number? You see from the manual that they mean the average load of the system in 1 minutes, 5 minutes, and 15 minutes, respectively.

If you continue to read the manual, it will also tell you that when the CPU is completely idle, the average load is 0, and when the CPU workload is saturated, the average load is 1.

Then obviously, the lower the value of "load average", such as 0.2 or 0.3, indicates that the smaller the workload of the computer, the less the system load.

But when can you see how heavy the system load is? is equal to 1, or is it equal to 0.5 or equal to 1.5? What if 1 minutes, 5 minutes, 15 minutes, three values are different?

Second analogy

To determine if the system is overloaded, you must understand the true meaning of load average. Below, I try to explain this problem in the most popular language, based on the article "Understanding Linux CPU Load".

First of all, assuming the simplest case, your computer has only one CPU, and all operations must be done by this CPU.

So, we might as well think of this CPU as a bridge, there is only one lane on the bridge, all vehicles must pass through this lane. (It is clear that the bridge can only be used one way.) )

The system load is 0, which means there is no car on the bridge.

The system load is 0.5, which means there is a car in half the bridge section.

With a system load of 1.0, it means that all sections of the bridge have cars, which means the bridge is "full". However, it is important to note that the bridge will still be able to pass smoothly until this time.

The system load is 1.7, which means that there are too many vehicles, the bridge is already occupied (100%), and the vehicles behind the bridge are 70% of the deck vehicles. The system load of 2.0, then, means that the number of vehicles waiting for the bridge is as much as that of the deck, and the system load of 3.0 means that the vehicle waiting for the upper bridge is twice times the deck vehicle. In short, when the system load is greater than 1, the rear of the vehicle must wait, the larger the system load, the bridge must wait longer.

The CPU's system load is basically equivalent to the above analogy. The capacity of the bridge is the maximum workload of the CPU, and the vehicle on the bridge is a process that waits for CPU processing.

If the CPU handles up to 100 processes per minute, Then the system load 0.2, means that the CPU in these 1 minutes to handle only 20 processes, the system load 1.0, which means that the CPU in the 1 minutes to handle 100 processes, the system load 1.7, means that in addition to the CPU is processing the 100 processes, there are 70 processes are queued waiting for CPU processing.

For the computer to run smoothly, the system load is best not more than 1.0, so that no process needs to wait, all processes can be processed the first time. Obviously, 1.0 is a key value, exceeding this value, the system is not in the best state, you have to intervene.

Rule of thumb for system load

1.0 is the ideal value for the system load?

Not necessarily, system administrators tend to leave a little leeway, when this value reaches 0.7, it should be noticed. The rule of thumb is this:

When the system load continues to be greater than 0.7, you must start investigating where the problem is and prevent the situation from deteriorating.

When the system load continues to be greater than 1.0, you have to find a solution and drop this value down.

When the system load reaches 5.0, it indicates that your system has a serious problem, long time no response, or close to the freezing. You should not let the system reach this value.

Quad, multi-processor

Above, we assume that your computer has only 1 CPUs. What happens if your computer is loaded with 2 CPUs?

2 CPUs means that the computer's processing power has doubled, and the number of processes that can be processed simultaneously has doubled.

Or the bridge to analogy, two CPU means the bridge has two lanes, the capacity of the traffic doubled.

Therefore, 2 CPUs indicate that the system load can reach 2.0, when each CPU reaches 100% of the workload. Spread, n CPUs of the computer, the acceptable system load Max is n.

Five, multi-core processor

Chip vendors tend to be inside a CPU, which contains multiple CPU cores, which is known as multicore CPUs.

In terms of system load, multi-core CPUs are similar to multi-CPU, so when considering the system load, it is important to consider that the computer has several CPUs and several cores per CPU. Then, dividing the system load by the total number of cores, as long as the load per core does not exceed 1.0, indicates that the computer is functioning properly.

How do you know how many CPU cores a computer has?

<span style= "FONT-SIZE:18PX;" > "cat/proc/cpuinfo" command to view CPU information. The "Grep-c ' model name '/proc/cpuinfo" command returns the total number of cores for the CPU directly. </span>

Vi. Best observed duration

Last question, "load average" returns a total of three averages----1 minutes system load, 5 minutes system load, 15 minutes system load,----should refer to which value?

If only 1 minutes of system load is greater than 1.0, the other two time periods are less than 1.0, which indicates that only a temporary phenomenon, the problem is not big.

If the average system load is greater than 1.0 (after adjusting the CPU cores) within 15 minutes, the problem persists, not a temporary phenomenon. Therefore, you should mainly observe the "15-minute system load", as the computer normal operation of the indicator.

Linux system load concept (load average)

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: 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.