简体   繁体   English

如何调试 Java 进程的 CPU 使用率高,而不是由 Java 线程引起的

[英]How to debug high CPU usage on Java process, not caused by Java threads

I have a Java application that runs on Tomcat on Linux.我有一个在 Linux 上的 Tomcat 上运行的 Java 应用程序。 After running for several weeks, it starts taking close to 100% CPU (as displayed by 'top' command), but none of the Java threads takes more than 5% CPU;运行几周后,它开始占用接近 100% 的 CPU(如“top”命令所示),但没有一个 Java 线程占用超过 5% 的 CPU; it's not kernel CPU either (that one is between 0.2-0.5%).它也不是内核 CPU(在 0.2-0.5% 之间)。 So something else (native code? JVM itself?) is causing this high CPU usage.所以其他东西(本机代码?JVM 本身?)导致这种高 CPU 使用率。 The problem can only be solved by restarting Tomcat.问题只能通过重启Tomcat来解决。

So the question is: is there the way to find out what is causing this high CPU usage, if not Java threads?所以问题是:如果不是 Java 线程,有没有办法找出导致这种高 CPU 使用率的原因? Is there a way to "look at" native libraries running inside Java process.有没有办法“查看”在 Java 进程中运行的本机库。 Or what should be my debugging strategy in this case?或者在这种情况下我的调试策略应该是什么?

Versions: Linux 2.6 (CentOS), Apache Tomcat/6.0.33, JVM: Sun 1.6.0_29-b11.版本:Linux 2.6 (CentOS)、Apache Tomcat/6.0.33、JVM:Sun 1.6.0_29-b11。 The application happens to be Forgerock OpenAM 10.0 (I am checking known issues on their end too, but so far didn't find the exact match, so looking for more generic suggestions)该应用程序恰好是 Forgerock OpenAM 10.0(我也在检查它们的已知问题,但到目前为止没有找到完全匹配的,所以寻找更通用的建议)

This seems to be long unanswered.这似乎很久没有答案了。 Investigating cpu for a java process is based on analyzing the cpu consumption of each of the pthread of the jvm process.调查一个java进程的cpu是基于分析jvm进程的每个pthread的cpu消耗。 Here is a link to the post that explains this: http://www.learnings.today/investigating-cpu-usage-in-a-java-process/这是解释这一点的帖子的链接: http : //www.learnings.today/investigating-cpu-usage-in-a-java-process/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM