In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to look at the cpu utilization load average under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Load average can generally be observed through top or uptime, in the following format:
Load average: 0.10, 0.05, 0.58
It represents the average load of CPU in the last 1 minute, 5 minutes and 15 minutes, respectively.
If it is a single-core CPU, 1.00 means that the CPU is fully loaded.
If it is a multicore CPU, if the load average reaches the number of cores of the CPU, it means that the CPU is fully loaded.
If there are multiple physical CPU, when the load average reaches the total number of cores of all physical CPU, the system CPU is at full load.
In short, the number of cores of CPU is the basis on which we measure CPU load according to load average.
So when the CPU load reaches a certain value, it should attract our attention? The empirical value given in the reference article is the CPU kernel minus 0.3.
That is, if the total core number of CPU is 4, when the 15-minute value on load average reaches 3.7, it is time for us to take a good look at the system.
CPU Utilization is easy to understand, that is, the utilization rate of CPU is higher than 75% (it is also said that it is 80% or higher). In addition to this indicator, but also combined with Load Average and Context Switch Rate, it is possible that the high CPU is caused by the high of the latter two indicators.
Load Average, this is hard to measure. After searching the Internet, I haven't seen many reasonable explanations yet. The two values tested by my 100 concurrent users are: 77.534% Load Average 6.108 CPU utilization is relatively high, CPU seems to be a little high. Later, I found the following two blog posts: understanding Load Average to do a good stress test, "Load Average is the Load of CPU, and the information it contains is not the utilization status of CPU, but the statistics of the total number of processes being processed by CPU and waiting for CPU over a period of time, that is, statistics on the length of queues used by CPU." it basically explains the principle of the multi-process,multi-thread program. To understand the load averaging of Linux processors (translation), to put it in a nutshell:
Load Average
< CPU个数 * 核数 *0.7 比如1个1核CPU,Load Average < 1 * 1 * 0.7;1个4核的CPU,Load Average必须 < 1 * 4 * 0.7 = 2.8。 查看cpu的信息:grep 'model name' /proc/cpuinfo Context Switch Rate 。就是Process(Thread)的切换,如果切换过多,会让CPU忙于切换,也会导致影响吞吐量。《高性能服务器架构 》这篇文章的第2节就是说的是这个问题的。究竟多少算合适?google了一大圈,没有一个确切的解释。Context Switch大体上由两个部分组成:中断和进程(包括线程)切换,一次中断(Interrupt)会引起一次切换,进程(线程)的创建、激活之类的也会引起一次切换。CS的值也和TPS(Transaction Per Second)相关的,假设每次调用会引起N次CS,那么就可以得出 Context Switch Rate = Interrupt Rate + TPS* N CSR减掉IR,就是进程/线程的切换,假如主进程收到请求交给线程处理,线程处理完毕归还给主进程,这里就是2次切换。也可以用CSR、IR、TPS的值代入公式中,得出每次事物导致的切换数。因此,要降低CSR,就必须在每个TPS引起的切换上下功夫,只有N这个值降下去,CSR就能降低,理想情况下N=0,但是无论如何如果N >= 4, then you should check it carefully. In addition, CSR said on the Internet.
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: 237
*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.