如何从运行在Linux上的WL应用程序服务器上的远程JVM获取堆转储?
当我在本地Windows机器上运行时,我知道如何获取转储。但是,如何从用户验收测试服务器获取转储?谢谢。
由于它是一个 *-nix 系统,如果您拥有必要的权限,那么使用 SSH 协议连接将非常容易:
Connect to the remote machine:
ssh user@remote-machine-ip-address
Enter the user password once prompted for it (it should be the one for the user on the remote machine and not your current system user).
Generate your heap dump using the jmap
utility (JDK binaries path should be availble into your system PATH variable or use a full path to it):
jmap -dump:format=b,file=cheap.bin <pid>
有三个步骤:
ssh <your_user_name>@<remote_ip>
jmap -dump:format=b,file=<your_file_name> <your_jvm_pid>
jhat -J-Xmx512m <your_file_name>
jhat -port 7401 <your_file_name>
我写了一篇博客来帮助分析性能问题:性能优化
jmap
工具。 - Michiel Haisma这里是从Dzone连接到VM的步骤,VisualVM:通过SSH(JMX或非JMX)监视远程JVM 对于其他替代方案,Baeldung JAVA网站提供了很棒的信息和教程,其中包括Java Profilers指南。VisualVM也作为Java VisualVM在Oracle JDK 6〜8中分发。 它已在Oracle JDK 9中停止。