Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to troubleshoot the high CPU caused by Java application

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to troubleshoot too high CPU caused by Java application, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

Use the top command to query the service cpu usage

Server resource utilization

You can see that 31737 of this process has a huge CPU utilization.

Use top-Hp 31737 to query the resource utilization of each thread in the 31737 process

Top-Hp 31737

Use top-Hp 31737 to query the resource utilization of each thread in the 31737 process

31737 Utilization of individual threads in the process

Because the screenshot was lost at that time, to put it simply, using the top-Hp 31737 command to query the 31737 process, a thread id for 5322 takes up too much CPU

Use printf "% x\ n" 5322 to convert thread id to hexadecimal

Printf "% x\ n" 5322

Because the local thread identifies the nid as hexadecimal when printing the thread stack, use this command to convert the thread id to hexadecimal

The hexadecimal of 5322 is 14ca

Use the jstack command to print stack information

Jstack 31737 | grep-10 14ca

Use jstack 31737 | grep-10 14ca to print stack information for 31737 and look for thread stack information identified as 14ca by the local thread

31737 stack information

As shown in the figure, the status of the thread is TIMED_WAITING, and the object is waiting. Check the source code.

The code that has a problem

The cause of the problem will not be analyzed in detail. The main purpose here is to share the process of troubleshooting.

Du Niang, there is a big god answer is right, connected here, interested can take a look at the https://stackoverflow.com/questions/6981564/why-must-the-jdbc-driver-be-put-in-tomcat-home-lib-folder/7198049#7198049

The above is all the contents of this article entitled "how to troubleshoot too high CPU due to Java applications". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report