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)06/01 Report--
This article mainly explains "how to view the average system load through the Linux command". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to view the average system load through the Linux command".
1. The concept of average load of Linux system.
Sometimes we feel that the response of the system is slow, but we can't find the reason, so it's time to check the average load to see if it has a large number of processes waiting in line. The average number of processes in the running queue during a specific time interval can reflect the busy degree of the system, so we usually check the load of the system, that is, the average load of CPU, as soon as our website or system slows down.
2. View the average load
How on earth should you look at the average load? The simplest command is uptime, as follows:
The code is as follows:
[root@localhost ~] # uptime
11:31:11 up 11 days, 19:01, 2 users, load average: 0.02, 0.01, 0.00
At present, the mainstream servers are dual quad-core and have quite strong CPU. If you do general application services, we don't have to worry about the load of the Linux system.
You can also check it with the w command, and by the way, you can see which users are currently on the system and which terminals they occupy, as shown below:
The code is as follows:
[root@localhost ~] # w
11:33:00 up 11 days, 19:03, 2 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
Root pts/1113.57.224.3 09V 032v 11m 0.04s 0.04s-bash
Root pts/2113.57.224.3 11:310.00s 0.02s 0.00s w
In addition, there is the dynamic command top, which can also reflect the system load. In the following command prompt, we are only concerned with the bold font.
The code is as follows:
[root@localhost ~] # top
Top-11:37:47 up 11 days, 19:08, 2 users, load average: 0.00,0.00,0.00
Tasks: 122 total, 1 running, 121 sleeping, 0 stopped, 0 zombie
Cpu (s): 0.1%us, 0.0%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4044136k total, 1435504k used, 2608632k free, 274740k buffers
Swap: 8193140k total,0k used, 8193140k free, 941884k cached
What does it mean by showing it in bold font? Check it again through uptime.
The code is as follows:
[root@localhost ~] # uptime
11:39:36 up 11 days, 19:16, 1 user, load average: 0.09, 0.03, 0.01
It used to represent the average number of processes in the process queue in the past 1 minute, 5 minutes, and 15 minutes.
So, how to measure whether the current system is overloaded? It can be considered from the following points.
If the number of currently active processes per CPU (which can be calculated by the number of CPU cores) is not greater than 3, the system performs well.
If the number of currently active processes per CPU is not greater than 4, it is acceptable.
If the number of currently active processes per CPU is greater than 5, the system performance problem is serious.
You can also use the vmstat command to determine whether our system is too busy, and if you are sure to be busy, consider whether to replace the server or increase the number of CPU. The summary is as follows:
If r is often greater than 3 or 4, and id is often less than 50, the load on CPU is heavy.
In the above example, my server is PowerEdge 2850 and the CPU is dual-core and dual-threaded, and the CPU load of this system is basically negligible. In fact, the CPU of mainstream servers is very strong now, and the load is basically very small if it is not for special scenarios such as application virtualization.
According to the previous calculation formula, the CPU load threshold of the Nagios alarm I configured is the number of CPU cores (that is, the physical number of CPU × cores). Take my server PowerEdge 2850 as an example. If the number of CPU cores is 2 × 2 × 4, the alarm value is set to 4. This setting is reasonable, because after all, not every application server's CPU supports multi-core, after all, there are some weak servers in the entire site that are used for backup.
Thank you for your reading, the above is the content of "how to view the average system load through the Linux command". After the study of this article, I believe you have a deeper understanding of the problem of how to view the average system load through the Linux command. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.