In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
What is the reason for the low utilization and high load of CPU? I believe many inexperienced people are at a loss about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Reason summary
In a word, the reason is that too many processes are waiting for disk Imax O to complete, resulting in too large process queue length, but very few processes running by cpu, which reflects the overload and low cpu utilization.
The following is a specific analysis of the principle:
Before analyzing why the load is high, we first introduce what is load, multi-tasking operating system, process scheduling and other related concepts.
What is a load?
What is load: load is the statistics of the total number of processes being processed by cpu and waiting for cpu over a period of time, that is, the length statistics of queues used by cpu. The smaller the number, the better. (it is abnormal if it exceeds the CPU core * 0.7).
The load is divided into two parts: CPU load and IO load
For example, suppose you have a program that performs large-scale scientific calculations, and although the program does not input or output frequently from disk, it takes quite a long time to complete. Because the program is mainly used for calculation, logic judgment and other processing, so the processing speed of the program mainly depends on the calculation speed of cpu. Such cpu-loaded programs are called "compute-intensive programs".
There is also a class of programs that mainly search for arbitrary files from a large amount of data saved on disk. The processing speed of this search program does not depend on cpu, but on the read speed of the disk, that is, input and output (input/output,I/O). The faster the disk, the less time it takes to retrieve. This kind of Icano-loaded program is called "Icano-intensive program".
What is a multitasking operating system?
Linux operating systems can handle several tasks with different names at the same time. But in the process of running multiple tasks at the same time, the limited hardware resources such as cpu and disk need to be shared by these task programs. Even if the time interval is very short, you need to switch between these tasks, which is called multitasking.
When there are fewer tasks in operation, the system is not waiting for this kind of switching action to occur. But when tasks increase, for example, task An is performing calculations on CPU, and then if tasks B and C also want to do calculations, you need to wait for CPU to be idle. In other words, even if you run and process a task, you can't run it until it's his turn, and this kind of waiting state is characterized by a delay in running the program.
The uptime output contains the number of "load average"
[root@localhost ~] # uptime
11:16:38 up 2:06, 4 users, load average: 0.00, 0.02, 0.05
From the left, Load average is the number of waiting tasks per unit time in the past 1 minute, 5 minutes, and 15 minutes, that is, the average number of tasks that are waiting. In the case of high load average, this means that there are more tasks waiting to run, so the waiting time for the task to run will be delayed, which reflects the high load at this time.
Process scheduling
What is process scheduling:
Process scheduling is also called cpu context switching by some people, which means that CPU switching to another process requires saving the state of the current process and restoring the state of another process: the current running task becomes ready (or suspended or interrupted), and another selected ready task becomes the current task. Process scheduling includes saving the running environment of the current task and restoring the running environment in which the task will be run.
In the linux kernel, every process has an administrative table called the process descriptor. The process descriptor is adjusted to be sorted in descending order of priority, and the processes (tasks) are run in a reasonable order. This adjustment is the job of the process scheduler.
The scheduler divides and manages the state of the process, such as:
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.