我可以设置 jhat 或 jmap 等配置文件来定期或在检测到异常时拍摄快照吗
所以基本上在我们的例子中,服务器神秘地宕机了,我们经常重新启动它,它开始正常工作。到目前为止,我们还无法建立一个模式。查看线程转储确实有帮助,但我们也想分析内存使用情况。这些工具是否可以设置为定期运行(以便它们定期保存快照)或在检测到异常或崩溃时运行
So basically in our case the server goes down mysteriously and we often restart it and it starts to work fine. Till now we haven't been able to establish a pattern. Looking at thread dump did help but we want to analyse memory usage too. Can these tools be set up to run at regular intervals (so they keep saving snapshots at regular intervals) or whenever it detects an exception or crash
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 cron 中运行 jmap ?
另一种选择是将 jdb 附加到进程 。它将在未捕获的异常上停止,您可以在该状态下使用 jmap 进行堆转储。不幸的是 jdb 本身不支持进行堆转储。
run jmap in a cron?
Another option is to attach jdb to the process. It will stop on uncaught exception and you can take a heap dump using jmap in that state. Unfortunately jdb itself doesn't support taking a heap dump.
它不会产生完整的转储,但是
jstat
可以连续运行以定期提供一段时间内内存的摘要统计信息:例如,每分钟都会生成内存池和垃圾收集统计信息,直到您杀死使用
Ctrl-C
即可。jstat
可以做的不仅仅是内存和垃圾收集。有关详细信息,请参阅 jstat 联机帮助页:http://docs .oracle.com/javase/6/docs/technotes/tools/share/jstat.html
It won't produce a complete dump, but
jstat
can be run continuously to provide sumamry statistics of memory over time at regular intervals:for instance, will produce memory pool and garbage collection statistics every minute until you kill it with
Ctrl-C
.jstat
can do a lot more than memory and garbage collection. See the jstat manpage for more information:http://docs.oracle.com/javase/6/docs/technotes/tools/share/jstat.html