排除JVM CPU峰值故障 [英] Troubleshooting JVM CPU spikes

查看:122
本文介绍了排除JVM CPU峰值故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们看到其中一个应用程序服务器出现一个有趣的(尽管很严重)问题:在某个时间点,运行我们的Web应用程序的JVM的CPU使用率开始上升,并一直在上升,直到应用程序最终变慢爬行.解决该问题的唯一方法是重新启动应用程序服务器软件.

We're seeing an interesting (though quite severe) issue with one of our application servers: at a certain point in time, the CPU usage of the JVM running our web applications starts rising and keeps on rising until the applications eventually slow down to a crawl. The only way to fix it is to restart the Application server software.

  • 应用程序服务器:Spring tc Server(由于服务器托管在其他地方,我目前不知道确切的版本)
  • 应用程序:相对标准的Spring 3 Web应用程序(尽管我们确实使用了JVM中的EHCache)

这使我想到了一个简单的问题;我们该怎么做才能解决此问题?

This brings me to a simple question; what can we do to troubleshoot this?

我已经考虑过使用VisualVM(或其他一些JVM监视工具),但是在这种特殊情况下,他们能做的最好的事情就是给我一个线程转储,它仍然不会告诉我什么占用了所有CPU时间(除非我缺少任何东西).

I have considered using VisualVM (or some other JVM monitoring tool), but the best they can do - in this particular case - is give me a thread dump, which still will not tell me what is eating up all the CPU time (unless I'm missing something).

推荐答案

您需要找出它在做什么?导致此问题的常见原因是可用内存不足.如果不是这个原因,则需要一个CPU事件探查器. VisualVM是JDK附带的免费软件,可以为您完成这两项工作.

You need to find out what it is doing? A common cause of this problem is running low on free memory. If this is not the cause, a CPU profiler is needed. VisualVM comes free with the JDK and can do both for you.

仅您无法始终对应用程序进行配置

only you can't profile the application all the time

发生这种情况时,您可以通过相隔几秒钟多次调用jstack进行临时分析.您可以使用堆栈跟踪中的diff来帮助您找到可能忙碌且消耗CPU的线程.

When this is happening you can do an ad hoc profiling by calling jstack multiple times a few second apart. You can use diff of the stack traces to help you can find the thread which are likely to be busy and consuming CPU.

这篇关于排除JVM CPU峰值故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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