简体   繁体   English

100%的CPU利用率需要帮助分析线程转储

[英]100% cpu utilization need help analyzing thread dump

I used jstack to get a thread dump of the PID with the highest cpu utilization. 我使用jstack获得了具有最高CPU使用率的PID线程转储。 It pointed to the thread with nid 0x4974. 它指向nid 0x4974的线程。

"VM Thread" prio=10 tid=0x00007ffc60068800 nid=0x4974 runnable "VM Periodic Task Thread" prio=10 tid=0x00007ffc60098000 nid=0x497b waiting on condition JNI global references: 1182 “ VM线程” prio = 10 tid = 0x00007ffc60068800 nid = 0x4974可运行的“ VM周期性任务线程” prio = 10 tid = 0x00007ffc60098000 nid = 0x497b等待条件JNI全局引用:1182

Im having a problem progressing with the analysis because it doesn't have the state of the thread and what code is being executed unlike the sample thread dumps that I've seen on the web. 我在进行分析时遇到问题,因为它没有线程状态以及正在执行什么代码,这与我在网上看到的示例线程转储不同。 And is there any freeware preferably online that can analyze a .txt threaddump file? 最好有在线的免费软件可以分析.txt线程转储文件吗?

Thanks for those who replied. 感谢那些回答。 Ok so I was able to learn how to use samurai,tda and the ibm thread dump tool. 好的,所以我能够学习如何使用武士,tda和ibm线程转储工具。 It seems that the problem lies with the number of threads being created,threads waiting for monitor,locking and blocking. 看来问题出在创建的线程数,等待监视,锁定和阻塞的线程。 But I was wondering if you guys have additional inputs. 但是我想知道你们是否还有其他投入。 This is what i got from TDA: 这是我从TDA获得的:

When its at 100% cpu utilization 当其CPU使用率达到100%时

Overall Thread Count    1001
Overall Monitor Count   644
Number of threads waiting for a monitor  50
Number of threads locking a monitor 636
Number of threads sleeping on a monitor 0
Number of deadlocks 0
Number of Monitors without locking threads 0

After I reset 重置后

Overall Thread Count  32
Overall Monitor Count  13
Number of threads waiting for a monitor  0
Number of threads locking a monitor  13
Number of threads sleeping on a monitor  13
Number of deadlocks 0
Number of Monitors without locking threads 0

40% of all threads are sleeping on a monitor. 所有线程中有40%在监视器上休眠。

This might indicate they are waiting for some external resource (eg database) which is overloaded or not available or are just waiting to get to do something (idle threads). 这可能表明他们正在等待过载或不可用的某些外部资源(例如数据库),或者只是在等待做某事(空闲线程)。 You should check the sleeping threads with a filter excluding all idle threads. 您应该使用除所有空闲线程之外的过滤器检查休眠线程。

We only have about 60 clients. 我们只有大约60个客户。

I uploaded the threaddumps when cpu utilization is at 100% and after reseting. 我在cpu利用率为100%并重置后上传了线程转储。 I also included the tools that i used (samurai,tda,and ibm thread and monitor dump analyzer) http://www.mediafire.com/?901mduvodm97d8v,x72cdixp8fltabu,fhfw4e50c7fzu4t,1oq2npaxmtxz0dq,i0u997fhvxfagd3,cdewe4de6x3rhe4,w2ndwqw2ekwixkd,qsbst5ow6f59p75,9fx8w8qpfdhjmyx,levpqppb3ouh71q 我还包括了我使用的工具(samurai,tda和ibm线程以及监视器转储分析器) http://www.mediafire.com/?901mduvodm97d8v,x72cdixp8fltabu,fhfw4e50c7fzu4t,1oq2npaxmtxz0dq,i0u997fhvxhexx2w7w9d2w3dw3dw3d3d3d3d3d3d6d3d3d3d3d3d3d3d3d3d3d3d3d5 levpqppb3ouh71q

These internal threads don't have a Java thread stack so none of the normal tools will help. 这些内部线程没有Java线程堆栈,因此所有常规工具都无法提供帮助。 If these are consuming excessive CPU I would first suspect a bug in the version of Java you are using. 如果这些资源消耗过多的CPU,我首先会怀疑您正在使用的Java版本中存在错误。 I would try this with Java 6 update 45 or Java 7 update 45. 我会尝试使用Java 6更新45或Java 7更新45进行此操作。

To diagnose this problem you need a native stack dump and a good understanding of the internals of the JVM. 要诊断此问题,您需要一个本机堆栈转储,并且对JVM内部有一个很好的了解。

Go to IBM Thread and Monitor Dump Analyzer for Java to download the tool from IBM. 转到IBM Thread and Monitor Dump Analyzer for Java以从IBM下载该工具。 But for your purpose, you might be able to analyze the thread dump by yourself and map the ID you find from jstack with thread stack trace in a thread dump. 但是出于您的目的,您也许可以自己分析线程转储,并映射从jstack中找到的ID和线程转储中的线程堆栈跟踪。 To get a thread dump : 要获取线程转储:

on Linux: kill -3 pid
on Windows: Ctrl-Break (not Ctrl-C)

After that you can copy the thread dump from your command window or stdout. 之后,您可以从命令窗口或标准输出中复制线程转储。

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

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