问题描述
我必须分析大小为35-40GB的Java堆转储,除了大内存的远程服务器之外,该堆不能在本地计算机上加载。
到目前为止,我发现Tool for analyzing large Java heap dumps是最好的链接。但是在配置完所有内容并正确执行了所有命令行之后,我无法获取任何报告文件。
我的 ParseHeapDump.sh 文件外观为
#!/bin/sh
#
# This script parses a heap dump.
#
# Usage: ParseHeapDump.sh <path/to/dump.hprof> [report]*
#
# The leak report has the id org.eclipse.mat.api:SUSPECTs
# The top component report has the id org.eclipse.mat.api:top_components
#
./MemoryAnalyzer -consolelog -application org.eclipse.mat.api.parse "$@" -vmargs -xms8g -Xmx10g -XX:-UseGCOverheadLimit
和 MemoryAnalyzer.ini 文件的外观为
-startup
plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.700.v20180518-1200
java -Xmx8g -xms10g -jar plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar -consoleLog -consolelog -application org.eclipse.mat.api.parse "$@"
-vmargs
-xms8g
-Xmx10g
如果我在配置上有任何错误,或者向我建议市场上其他可用的工具,请告诉我。
解决方法
处理大型堆转储是一个挑战。 VisualVM和Eclipse Memory Analyzer都需要太多内存来处理堆转储,顺序为几十个GiB。
商业分析器显示出更好的结果(尤其是您的Kit),尽管我不确定它们的实际限制。
要例行处理100+ GiB,我想出了无头解决方案heaplib,该解决方案基于VisualVM(实际上是Netbeans)的代码库。
Heaplib是图形化的,也不是交互式的。它面向自动报告。 该工具允许您使用OQL / JavaScript(如果需要,也可以使用Java)编写用于堆分析的代码,尽管功能受到限制以适应内存需求。处理100GiB可能要花费数小时,但对于非交互式工作流则可以接受。