如何在JVM中调试挂起的线程? [英] How do I debug hanging threads in the JVM?

查看:178
本文介绍了如何在JVM中调试挂起的线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个远程Ubuntu服务器上运行一个持久的Java程序,我拥有root用户权限。一段时间后,某些CPU内核的使用率可达100%。日志显示无可疑,应用仍然可行,但吞吐量降低。



如何调试JVM,以便在仍然运行的时候找出原因?

解决方案

一个选项是 VisualVM ,它包含在JDK中与Java 1.6。



您可以连接到本地应用程序或远程应用程序。



要连接到远程应用程序,请在远程服务器上运行 jstatd ,然后在本地运行VisualVM并输入服务器的IP地址。您应该获得一个运行中的Java应用程序列表,包括您希望探索的应用程序。如果您在列出应用程序时遇到任何问题,VisualVM网站提供了良好的文档。


I am running a durable Java program on a remote Ubuntu server, where I have root user rights. After some time, the usage on some CPU cores goes up to 100%. The logs show nothing suspicious and the application still works, but with reduced throughput.

How can I debug the JVM so that I can find out the cause of this, while it's still running?

解决方案

One option is VisualVM, which is included in the JDK starting with Java 1.6. I have found it useful in some situations in the past.

You may connect to local applications or remote applications.

To connect to a remote app, run jstatd on your remote server, and then run VisualVM locally and enter your server's IP address. You should be provided with a list of running Java applications including the one you wish to explore. If you have any trouble listing your application, good documentation is available at the VisualVM website.

这篇关于如何在JVM中调试挂起的线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆