JMX usage from a remote machine can be frustrating. Therefore, please make sure that:
- Your hostname is included in the /etc/hosts
- Get host name using hostname
- Add the host name after 127.0.0.1 in /etc/hosts
- JMX is binded to the external IP:
- Verify 127.0.0.1 is not presented at: netstat -na | grep 1099
- If it does presented, add to your java command: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=
If everything is Okay, you will be able to run VisualVM from a remote machine and connect to the remote server.
Now, that you have your VisualVM up and running there are some items you should take a look at:
- General CPU and memory graphs.
- Sampler that enables you taking snapshots.
- Snapshot analysis that enables you a hotspot presentation as well as deep.
My recommendation is to have snapshot of the process and then look at the hotspots tab for major calls with actual long CPU time. You should focus on these items.