In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, Xiaobian will bring you about how to understand Linux CPU load and CPU utilization. The article is rich in content and analyzed and described from a professional perspective. After reading this article, I hope you can gain something.
CPU load and CPU utilization
These two can reflect the busy degree of a machine to some extent.
CPU usage reflects the current CPU busyness. The reason why CPU usage fluctuates is that processes that take up CPU processing time may be in IO waiting state but have not yet been released into wait.
Load average refers to the number of processes taking cpu time and waiting cpu time in a certain period of time. Here, the processes waiting cpu time refer to the processes waiting to be awakened, excluding the processes in wait state.
The above analysis can be seen that a machine is likely to be in a low CPU usage and high load situation, so look at the busy degree of the machine should be combined with the two, from the actual use of observation, their own a dual-core Zhiqiang 2.8GHZ, 2G memory machine in the average load to about 50, CPU usage is close to 100%(application has a lot of io operation), in this case the application is smooth, the actual access delay is not very high. Therefore, in the case of cpu idle, how to improve io response is the key to reduce the load, many people think that the load to dozens of machines is very busy, I think if this time cpu utilization is relatively low, then the load may not be very good explanation problem, once the cpu process processing, those waiting for the process can also get a response immediately, in this case should optimize io read and write speed. When CPU usage is above 90%, even if the average load is only single digits (for example, a certain process has been operating), the machine is actually busy ~
In fact, in the previous article, there are also written CPU utilization is low, the load is high, the reason analysis CPU utilization is low, but the load is very high, the load is very high may be IO
An analogy for CPU load
To determine whether the system is overloaded, you must understand the true meaning of load average. Below, I try to explain this problem in the most common language, based on the article "Understanding Linux CPU Load".
First of all, assume that in the simplest case, your computer has only one CPU, and all calculations must be done by this CPU.
Think of the CPU as a bridge with only one lane on which all traffic must pass. Obviously, the bridge can only be used in one direction.
A system load of zero means there are no cars on the bridge.
A system load of 0.5 means that half of the bridge is occupied.
The system load of 1.0 means that all sections of the bridge are occupied, which means that the bridge is "full." However, it must be noted that the bridge has been able to pass smoothly until now.
The system load of 1.7 means that there are too many vehicles, the bridge is already full (100%), and the vehicles waiting behind the bridge are 70% of the deck vehicles. Similarly, a system load of 2.0 means that there are as many vehicles waiting to get on the bridge as there are on the deck; a system load of 3.0 means that there are twice as many vehicles waiting to get on the bridge as there are on the deck. In short, when the system load is greater than 1, the vehicle behind must wait; the greater the system load, the longer the bridge must wait.
The CPU system load is basically equivalent to the analogy above. The capacity of the bridge is the maximum workload of the CPU; the vehicles on the bridge are processes waiting for the CPU to process.
If the CPU is processing at most 100 processes per minute, then a system load of 0.2 means that the CPU is processing only 20 processes in that minute; a system load of 1.0 means that the CPU is processing exactly 100 processes in that minute; and a system load of 1.7 means that there are 70 processes queued for the CPU to process in addition to the 100 processes the CPU is processing.
In order for the computer to run smoothly, the system load is best not to exceed 1.0, so that no process needs to wait, all processes can be processed in the first time. Obviously, 1.0 is a critical value. Beyond this value, the system is not in the best state and you have to intervene.
CPU load-multiprocessor
Let's assume that your computer has only one CPU. What happens if you have two CPUs on your computer?
Two CPUs means that the processing power of the computer has doubled, and the number of processes that can be processed at the same time has doubled.
Still using the bridge analogy, two CPUs means that the bridge has two lanes, and the traffic capacity has doubled.
So, 2 CPUs means that the system load can reach 2.0, when each CPU reaches 100% of the workload. Generalizing, the maximum acceptable system load for a computer with n CPUs is n.0.
CPU load-multicore processors
Chip manufacturers often contain multiple CPU cores inside a CPU, which is called a multicore CPU.
In terms of system load, multicore CPUs are similar to multicore CPUs, so when considering system load, you must consider how many CPUs this computer has and how many cores each CPU has. Then, divide the system load by the total number of cores, and as long as the load per core does not exceed 1.0, the computer is functioning properly.
How do you know how many CPU cores a computer has?
"cat /proc/cpuinfo" command to view CPU information. The command "grep -c 'model name' /proc/cpuinfo" directly returns the total number of CPU cores.
Rules of thumb for system loading
1.0 Is it ideal for system load?
Not necessarily, system administrators tend to leave a bit of leeway, and 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 what 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 to reduce this value.
When the system load reaches 5.0, it indicates that your system has a serious problem, no response for a long time, or close to a crash. You shouldn't let the system reach this value.
For my machine, there are 24 cores, so how much load is appropriate?
[root@jiangyi01.sqa.zmf /home/ahao.mah/ALIOS_QA]#grep 'model name' /proc/cpuinfo | wc -l24
The answer is:
[root@jiangyi01.sqa.zmf /home/ahao.mah/ALIOS_QA]#echo "0.7*24" |bc16.8 Optimal observation duration
The last question,"load average" returns three average values---1 minute system load, 5 minutes system load, 15 minutes system load, ---which value should be referred to?
If the system load is greater than 1.0 for only one minute and less than 1.0 for the other two periods, this indicates that it is only a temporary phenomenon and that the problem is not serious.
If the average system load is greater than 1.0 (after adjusting for CPU cores) for 15 minutes, the problem persists and is not temporary. So you should focus on the "15-minute system load" as an indicator of how well your computer is working.
The above is how to understand Linux CPU load and CPU usage shared by Xiaobian. If there is a similar doubt, please refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.