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 Java programs that occupy a high level of CPU under Linux

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

Share

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

This article mainly shows you "how to troubleshoot Java programs that occupy a high CPU under Linux", which is easy to understand and clear, hoping to help you solve your doubts. Let the editor lead you to study and learn this article "how to troubleshoot Java programs that occupy a high CPU under Linux".

Jstack is a stack trace tool that comes with the java virtual machine. Jstack is used to print out the Java stack information for a given java process ID or core file or remote debugging service.

Deliberately set up a scene with a high CPU footprint:

To troubleshoot the problem, steps:

\ 1. Ps-mp [replace with process ID PID]-o THREAD,tid,time

It is found that threads 6322 and 6323 take up a high amount of CPU and take a long time.

\ 2. Printf "% x" [thread ID TID]

Convert TID to hexadecimal.

\ 3. Jstack [process ID PID] | grep [thread ID hexadecimal]-A 10-B 10

Using the jstack tool, look at the front and back 10 lines to find the problem!

Intentionally set in the code:

\ 4. Repeat 2 and 3 to see another thread.

--

Appendix: to access your own Virtual Box, the network settings should be adjusted to:

The above is all the contents of this article entitled "how to troubleshoot Java programs that occupy high CPU under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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