In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to troubleshoot the problem of high CPU occupancy rate in Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Many OPS students are often at a loss when they encounter this situation. The following two methods are usually used to quickly locate the problem of CPU overload:
Method one
Step 1: use the
Top command, and then sort by shift+p by CPU
Find the pid of the process that consumes too much CPU
Step 2: use the
Top-H-p [process id]
Find the id of the thread in the process that consumes resources *
Step 3: use the
Echo 'obase=16; [thread id]' | bc or printf "% x\ n" [thread id]
Convert thread id to hexadecimal (lowercase letters)
Bc is the calculator command of linux
Step 4: execute
Jstack [process id] | grep-A 10 [hexadecimal of thread id] "
View thread status information
Method two
* step: use the
Top command, and then sort by shift+p by CPU
Find a process that takes up too much CPU
Step 2: use the
Ps-mp pid-o THREAD,tid,time | sort-rn
Get thread information and find the thread that takes up high CPU
Step 3: use the
Echo 'obase=16; [thread id]' | bc or printf "% x\ n" [thread id]
Convert the required thread ID to hexadecimal format
Step 4: use the
Jstack pid | grep tid-A 30 [hexadecimal of thread id]
Print the stack information for the thread
Case analysis
1. Scene description
Troubleshooting of JAVA process with High CPU occupancy in production Environment
two。 Solution process
(1) according to the top command, it is found that the Java process with a PID of 2633 takes up up to 300% of the CPU and fails.
(2) after finding the process, how to locate the specific thread or code? first, display the list of threads and sort them according to the threads with high CPU occupation:
[root@localhost ~] # ps-mp 2633-o THREAD,tid,time | sort-rn
The display results are as follows:
Found a time-consuming thread (TID) 3626, which took up 12 minutes of CPU time!
(3) convert the required thread TID to hexadecimal format
[root@localhost ~] # printf "% x\ n" 3626 e18
(4) use the jstack command to print out the stack information of this thread under the process:
[root@localhost ~] # jstack 2633 | grep "E18"-A 30 "how to troubleshoot the problem of high CPU occupancy in Linux system" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.