In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Most people don't understand the knowledge points of this article "What is the load and troubleshooting method of the server", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "What is the load and troubleshooting method of the server".
What is a load?
With the rapid development of Internet and the continuous improvement of business volume, the network-based data access traffic increases rapidly, especially to data centers, large enterprises and portal websites, and its access traffic even reaches the level of 10Gb/s. At the same time, server websites provide more and more rich content and information for visitors by means of HTTP, FTP, SMTP and other applications, and servers are gradually flooded with data. In addition, most websites (especially e-commerce websites) need to provide uninterrupted 24-hour service, and any service interruption or loss of critical data in communication will cause direct business losses. All of these put forward high performance and high reliability requirements for application services, and these massive access data are load.
View machine loads
On Linux machines, there are several commands that can be used to view load information on the machine. These include uptime, top, w, etc.
Uptime command
The command prints how long the system has been running and the average load on the system. The uptime command displays the following information: the current time, how long the system has been running, how many logged-in users are currently logged in, and the average load on the system in the past 1 minute, 5 minutes, and 15 minutes.
➜ ~uptime13:29 up23:41, 3users,loadaverages: 1.741.871.97
The second half of this line shows "load average," which means "average load on the system." There are three numbers in it, from which we can judge whether the system load is large or small.
1.74 1.87 1.97 These three numbers mean the average load on the system for 1 minute, 5 minutes and 15 minutes respectively. Load1, load5, load15.
W command
The main function of the w command is actually to display the information of the user currently logged in to the system. But unlike who, the w command is more powerful and can also display: the current time, the time since the system was started, the number of logged in users, and the average load of the system in the last 1 minute, 5 minutes, and 15 minutes. Then there is the data of each user, and the items are displayed in the following order: login account, terminal name, remote host name, login time, idle time, JCPU, PCPU, and the command line of the currently running process.
~w14:08 up23:41, 3users,loadaverages: 1.741.871.97USER TTY FROM LOGIN@ IDLE WHAThollis console -VI 14 23:40-hollis s000 -VI 14 20:24-zshhollis s001 -VI 15 - w
As you can see from the results of the w command above, the current system time is 14:08, and it has been 23 hours and 41 minutes since the system was started, with a total of 3 users logged in. The average load of the system in the last 1 minute, 5 minutes and 15 minutes is 1.74, 1.87 and 1.97 respectively. This is the same as the uptime result. The following also printed some of the login user data, not detailed.
top command
The top command is a commonly used performance analysis tool under Linux, which can display the resource consumption status of each process in the system in real time, similar to Windows Task Manager.
➜ ~topProcesses:244total,3running,9stuck,232sleeping,1484threads14:16:01LoadAvg:1.74,1.87,1.97 CPUusage:8.0%user,6.79%sys,85.19%idle SharedLibs:116Mresident,16Mdata,14Mlinkedit.MemRegions:66523total,2152Mresident,50Mprivate,930Mshared.PhysMem:7819Mused(1692M wired),370Munused.VM:682Gvsize,533Mframeworkvsize,6402060(0)swapins,7234356(0)swapouts.Networks:packets:383006/251Min,334448/60Mout.Disks:1057821/38Gread,350852/40Gwritten.PID COMMAND %CPUTIME #TH #WQ #PORTMEM PURG CMPRS PGRP PPID STATE BOOSTS %CPU_ME%CPU_OTHRSUID FAULTS COW MSGSENT MSGRECV SYSBSD SYSMACH CSW30845 top 3.0 00:00.491/1 0 21 3632K 0B 0B 308451394 running *0[1] 0.000000.00000 0 3283+ 112 203556+ 101770+ 8212+ 119901+ 823+30842 GoogleChrom0.0 00:47.3917 0 155 130M 0B 0B 1146 1146 sleeping*0[1] 0.000000.00000 501 173746 2697 117678 37821 364228 444830 310043
In the output above, Load: 1.74, 1.87, 1.97 shows the load information.
Normal load range of machine
The question of how much of a machine's Load is normal has always been controversial, and different people have different understandings. For a single CPU, some people think that if Load exceeds 0.7, it is out of the normal range. Some people think that as long as it does not exceed 1, there is no problem. Some people think that the load of a single CPU is acceptable below 2.
The reason why there are so many different understandings is that different machines have other factors besides CPU influence, such as running programs, machine memory, and even room temperature.
For example, some machines are designed to perform a large number of batch tasks at regular intervals, during which time Load may spike higher. Other times may be lower. So, should we check out the problem during this period of high altitude?
My suggestion is that it is best to establish a baseline of indicators (such as the average value of nearly one month) according to the actual situation of your own machine. As long as the daily load is not too large within the baseline range, you can receive it. If the gap is too much, you may have to manually intervene to check it.
How to Reduce Load
The cause of the high load can be complex and can be hardware or software.
If it is a hardware problem, then it means that the performance of the machine is really not good, then the solution is very simple, just change the machine directly.
As mentioned earlier, CPU usage, memory usage, IO consumption can all lead to high loads. If it is a software problem, it may be caused by some threads in Java being used for a long time, a large amount of memory being used continuously, etc. It is recommended to troubleshoot code problems from the following aspects:
1. Is there a memory leak that causes frequent GC
2. Is there a deadlock?
3, whether there is a large field of reading and writing
4, will it be caused by database operations, troubleshooting SQL statement problems.
There is also a suggestion here. If you find that the Load of the online machine is high, you can consider dumping the stack memory first, restarting it, temporarily solving the problem, and then consider rolling back and troubleshooting.
Java Web Application Load High Troubleshooting Ideas
1. Use uptime to check the current load and find that the load is soaring.
2. Use the top command to view the ID of the process that uses the highest CPU.
3. Use the top command to see which thread occupancy is higher.
4. Use printf command to view the hexadecimal of this thread
You can also use jstat() to check GC to see if there is frequent FGC, and then use jmap to dump memory to see if there is a memory leak.
The above is about the content of this article "What is the load of the server and the troubleshooting method?" I believe everyone has a certain understanding. I hope the content shared by Xiaobian will be helpful to everyone. If you want to know more relevant knowledge, 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.