如何从 JVM 分析和监控 gc.log 垃圾收集器日志文件
我想知道直观分析和监视 java gc.log 文件的最佳方法是什么。
GCViewer 是迄今为止我发现的最有趣的工具,但我想知道是否有更好的工具或者是监视多个远程 gc.log 文件的良好解决方案。
I'm wondering what is the best way to visually analyse and monitor java gc.log files.
GCViewer is the most interesting tool I've found so far, but I'm wondering if there is anything better or a good solution for monitoring multiple remote gc.log files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为分析垃圾收集器日志的最有效方法是查看输出本身。我们的生产服务器都使用并发标记扫描收集器运行,并且我使用选项
-Xloggc:$GCLOGFILE -XX:+PrintGCDetails
运行日志,如果环境遇到问题,我我通常还会查看线程列表并检查垃圾收集器消耗的 cpu 时间量。我通过使用
-p
参数运行 top 并随后按“H”来完成此操作,这样您就可以看到消耗最多 cpu 时间的 pid。然后可以将其与线程转储相匹配,以查看 gc 线程是否是最耗时的线程。每个线程都有一个 pid 显示在线程转储中,该 pid 为十六进制,可以与顶部的 pid 相匹配。查看 GC 消耗的 cpu 时间并将其与日志输出相匹配非常重要。我多次尝试使用 GCViewer,但从未真正从 GC 数据的可视化显示中获得有用的提示。
I think the most effective way for analyzing the garbage collector log is by looking at the output itself. Our production server all run using the Concurrent Mark Sweep Collector and I have the log running with the options
-Xloggc:$GCLOGFILE -XX:+PrintGCDetails
and if the environment runs into problems II usually also look at the thread list and check the amount of cpu time the Garbage Collector consumes. I do this by running top with the
-p <java-pid>
Parameter and press "H" afterwards, with this you get to see the pids which consume the most cpu time. This then can be matched to a Thread Dump to see if gc threads are the most time consuming threads. Every thread has a pid displayed in the thread dump, which is in hex, this can be matched to the pids in top.It is quite important to see the cpu times the GC consumes and match this to your log output. I tried the GCViewer several times but never really got useful hints from the visual display of the GC-Data.
您可以使用 JDK 中包含的 jconsole 工具。或者当您运行java应用程序时,可以使用参数“-verbose:gc”。
You can use the jconsole tool which is included into the JDK. Or when you run a java application, you can use the parameter "-verbose:gc" .
我认为您可以使用选项在日志文件中记录 gc 活动:
-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Xloggc:gc.log
您可以使用 HPJmeter 等软件利用此日志
I think you can use options to log gc activity in a log file :
-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Xloggc:gc.log
You can exploit this log with software as HPJmeter