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)06/01 Report--
This article mainly introduces "what is the meaning of server load". In daily operation, I believe that many people have doubts about what server load means. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the question of "what is the meaning of server load?" Next, please follow the editor to study!
In ordinary work, when measuring the performance of the server, several indicators are often involved, such as load, cpu, mem, qps, rt and so on. Each index has its own unique meaning, and many times when problems occur online, it is often accompanied by some abnormal indicators. In most cases, some indicators show anomalies in advance before the problem occurs.
Understanding and viewing these indicators, exception resolution, etc., are important and necessary skills for programmers. This paper mainly introduces a more important index-machine load (Load), which mainly involves the definition of load, the mode of viewing load, the train of thought of load soaring and so on.
What is a load?
With the rapid development of Internet and the continuous improvement of business volume, the web-based data access traffic is growing rapidly, especially for data centers, large enterprises and portals, whose access traffic even reaches the level of 10Gb/s; at the same time, the server network station provides visitors with more and more rich content and information with the help of HTTP, FTP, SMTP and other applications, and the server is gradually inundated with data. In addition, most websites (especially e-commerce and other websites) need to provide uninterrupted 24-hour service, any service interruption or the loss of critical data in communications will cause direct business losses. All these put forward the requirements of high performance and high reliability for application services, and these huge amounts of access data are loads.
View machine load
On the Linux machine, there are several commands that can view the machine's load information. It includes uptime, top, w and so on.
Uptime command
The command can print how long the system has been running and the average load of the system. The uptime command can display information in the following order: the current time, how long the system has been running, how many logged-in users are currently, and the average load of the system in the past 1 minute, 5 minutes, and 15 minutes.
➜~ uptime13:29 up23:41, 3usersloadaverages: 1.741.871.97
The second half of this line of information shows "load average", which means "average load of the system". There are three numbers from which we can tell whether the system load is big or small.
The three numbers 1.74 1.87 1.97 mean the average load of the system within 1 minute, 5 minutes and 15 minutes respectively. We generally express it as load1, load5, load15.
W command
The main function of the W command is to display the user information currently logged in to the system. But unlike who, the w command is more powerful, and it also shows the current time, the time since the system 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 each user's data, and the items are displayed in the following order: login account, terminal name, remote hostname, login time, idle time, JCPU, PCPU, command line of the currently running process.
➜~ w14 23:40-hollis 08 up23:41, 3usersJournal loadaverages: 1.741.871.97USER TTY FROM LOGIN@ IDLE WHAThollis console-6 14 23:40-hollis s000-6 14 20:24-zshhollis S001-6 15-w
From the results of the w command above, you can see that the current system time is 14:08, and it has been 23 hours and 41 minutes since the system started, and a total of 3 users have logged in. The average load of the system in the past 1 minute, 5 minutes and 15 minutes is 1.74 1.87 1.97 respectively. This is the same as the result obtained by uptime. The following also prints the data of some logged-in users, which will not be described in detail.
Top command
Top command is a commonly used performance analysis tool under Linux, which can display the resource consumption of each process in the system in real time, similar to the task manager of Windows.
➜~ 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.VMpur682Gvsizere533m frameworkvsizere6402060 (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 TH # WQ # PORTMEM PURG CMPRS PGRP PPID STATE BOOSTS% CPU_ME%CPU_OTHRSUID FAULTS COW MSGSENT MSGRECV SYSBSD SYSMACH CSW30845 top 3.0000 TH # WQ # PORTMEM PURG CMPRS PGRP PPID STATE BOOSTS% CPU_ME%CPU_OTHRSUID FAULTS COW MSGSENT MSGRECV SYSBSD SYSMACH CSW30845 top 3.00.491Universe 00.491Universe 1 021 3632K 0B 0B 308451394 running * 0 [1] 0.000000.00000 03283 + 112203556 + 101770 + 8212 + 119901 + 823 0842 GoogleChrom0.0 00vane 47.3917 0155 130M 0B 1146 1146 sleeping*0 [1] 0.000000.00000 501 173746 2697 117678 374228 444830 310043
In the above output, Load Avg: 1.74,1.87,1.97 shows the load information.
Normal load range of machine
The question of how much Load of a machine is normal has always been controversial, and different people have different understandings. For a single CPU, some people think that if the Load exceeds 0. 7, it is out of the normal range. Some people think that as long as it is no more than 1, it is no problem. It is also believed that a single CPU load below 2 is acceptable.
The reason why there are so many different understandings is that different machines have other factors besides the influence of CPU, such as running programs, machine memory, and even the temperature of the computer room.
For example, some machines are used to perform a large number of batch tasks on a regular basis, during which time the Load may be relatively high. The rest of the time may be lower. So should we troubleshoot the problem during this period of high?
My suggestion is that it is best to establish a baseline of indicators (such as the average value of nearly a month) according to the actual situation of your machine. As long as most of the daily load is not acceptable within the range above and below the baseline, if the gap is too large, you may have to check it artificially.
How to reduce the load
The reasons for the high load can be complex, either hardware or software.
If it is a hardware problem, then the performance of the machine is really bad, so the solution is very simple, just change the machine directly.
As we mentioned earlier, CPU usage, memory usage, and IO consumption can all lead to high load. If it is a software problem, it may be caused by some threads in Java being occupied for a long time, a large amount of memory, and so on. It is recommended to troubleshoot code problems from the following aspects:
1. Whether there is a memory leak causing frequent GC
2. Whether there is a deadlock
3. Whether there is reading and writing of large fields
4. Whether it is caused by the database operation, troubleshoot the SQL statement.
Here is another suggestion. If you find that the Load of online machines is soaring, you can consider rebooting the stack memory after dump, temporarily solving the problem, and then considering rollback and troubleshooting.
The thought of troubleshooting by applying Load to Java Web
1. Use uptime to view the current load and find that the load is soaring.
2. Use the top command to view the ID of the process with high CPU consumption.
3. Use the top command to see which thread has a higher occupancy rate
4. Use the printf command to view the hexadecimal of this thread
5. 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.
At this point, the study on "what is the meaning of server load" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.