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/02 Report--
How to check the machine load in Linux, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Load is an important indicator of the linux machine, which directly reflects the current state of the machine. If the machine load is too high, then the operation of the machine will be difficult.
The high load of Linux is mainly due to three parts: CPU usage, memory usage and IO consumption. Excessive use of any one of these items will lead to a sharp increase in server load.
There are many commands to view server load, either w or uptime can show the load directly.
$uptime
12:20:30 up 44 days, 21:46, 2 users, load average: 8.99, 7.55, 5.40
$w
12:22:02 up 44 days, 21:48, 2 users, load average: 3.96, 6.28, 5.16
Load average corresponds to the average load of the past 1 minute, 5 minutes, and 15 minutes, respectively.
These two commands simply reflect the load, and linux provides a more powerful and practical top command to view the server load.
$top
The top command can clearly show the state of the system, and it is real-time monitoring, press Q to exit.
The Tasks line shows the current total number and status of processes. Note that zombie indicates a zombie process, while a value other than 0 indicates that there is a problem with the process.
Line Cpu (s) shows the status of the current CPU. Us represents the percentage of CPU occupied by user processes, sy represents the percentage of CPU occupied by kernel processes, id represents the percentage of idle CPU, and wa represents the percentage of CPU time spent waiting for IO. When wa occupies more than 30%, it means that IO is under a lot of pressure.
The Mem line shows the current state of memory, where total is the total memory size, userd is used, free is remaining, and buffers is the directory cache.
The Swap line is the same as the Mem line, and cached represents the cache, the file that the user has opened. If the used of the Swap is high, the system is out of memory.
Under the top command, press 1 to show how much CPU the server has and how each CPU is used
Generally speaking, the reasonable load on the server is CPU core * 2. In other words, for an 8-core CPU, a load of less than 16 indicates that the machine is running smoothly and steadily. If the load exceeds 16, it means that the server is under some pressure.
Under the top command, press shift+ "c" to sort processes according to CPU usage from largest to smallest, and press shift+ "p" to sort processes according to memory utilization from largest to smallest. It is easy to locate which services occupy higher CPU and memory.
The top command is not enough, because it only shows the usage of CPU and memory, and there is no clear demonstration of IO, another important reason for the increase in load. Linux provides the iostat command to understand the cost of io.
Enter the iostat-x 1 10 command to start monitoring the input and output status,-x to display all parameter information, 1 to monitor every 1 second, and 10 to monitor a total of 10 times.
Rsec/s means read in, and wsec/s means write per second. When one of these two parameters is particularly high, disk IO is under great pressure. Util means IO utilization. If it is close to 100%, IO is running at full load.
Summary:
(1) use the top command to view the load, press "1" under top to view the number of CPU cores, shift+ "c" to sort by cpu utilization, and shif+ "p" to sort by memory utilization.
(2) use the iostat-x command to monitor whether the input and output of io is too large.
This is the answer to the question about how to view the machine load in Linux. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
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.