Skip to content

Instantly share code, notes, and snippets.

@uarun
Last active April 26, 2016 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save uarun/e4577c2c1137ec7dbc05 to your computer and use it in GitHub Desktop.
Save uarun/e4577c2c1137ec7dbc05 to your computer and use it in GitHub Desktop.
Profiling a remote host using VisualVM

Remote VisualVM

Start RMI registry

$ rmiregistry -J-Djava.rmi.server.codebase=file:$JAVA_HOME/lib/tools.jar

Create Policy file for jstatd

  • Create a file named jstatd.all.policy

  • With the following contents:

    grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; };
    

Start jstatd

$ jstatd -J-Djava.security.policy=/home/arun/jstatd.all.policy &

Launch VisualVM on the remote host

$ jvisualvm

After VisualVM is launched, select "Remote" > "Add Remote Host.." and enter the hostname where jstatd is running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment