Kohei Nozaki's blog 

Entries tagged [ssh]

Profiling remote JVM over SSH with VisualVM


Posted on Friday Feb 06, 2015 at 01:31PM in Technology


UPDATE October 2015: This procedure requires a VisualVM distribution that can be obtained from https://visualvm.java.net . At least, It will work with VisualVM 1.3.8. May doesn’t work with VisualVM which has been installed as a part of JDK distribution. I have experienced VisualVM which comes with JDK8u60 doesn’t work.

First I tried that creating a tunnel like ssh remote.example.org -L 19999:localhost:9999 and connecting VisualVM to localhost:19999, but it didn’t worked. intead, creating a socks tunnel like ssh remote.example.com -D 1080 and connecting VisualVM to localhost:9999 via socks proxy is worked. detailed procedure is following:

  1. Create ssh socks tunnel

  2. Set manual proxy in VisualVM’s preferences

  3. Right-click Local

  4. Add JMX connection

  5. Enter localhost:9999 to text box

  6. Click OK

  7. Double-click newly added JMX icon

Make sure that destination JVM has started with following system properties:

-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false