Get heap dump from a remote application in Java using JVisualVM

最后都变了- 提交于 2019-11-28 05:07:47

There is a way to do it!

  1. rmiregistry -J-Xbootclasspath/p:$JAVA_HOME/lib/sa-jdi.jar ( this uses port 1099)
  2. start 'jsadebugd' on the machine in which application is running: jsadebugd & (pid of JVM)
  3. On remote machine use following jmap -dump:file= :1099

  4. jhat

The above will start a web application at port 7000

All the above tools are part of JDK 1.6

All the best!

Unfortunately there isn't an automated way to do this. You'll have to run jmap manually on the Linux server to dump the heap of your JVM and then copy the resultant heap dump to your local machine running JVisualVM and use File|Load... to load the heap dump into JVisualVM for analysis.

Since 1.3, VisualVM support remote heap dumps:

Starting with VisualVM 1.3, you can now use the Heap Dump actions and buttons in the tool to take a heap dump of applications that are running remotely. When invoked, a dialog is displayed that enables you to specify the full path on the remote system where you want to dump the heap. After the heap dump is created, you need to manually copy the file to your local machine and use the Load action to open and analyze the file using VisualVM.

See: VisualVM 1.3 Released

You cannot analyze the heap remotely. You could run visualvm on your server and export the x session to your local machine. You would have to have x11 installed on your server which many servers do not.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!