Hi all, I’m newbie to Java world when our company’s moving to Scala. Now I’m profiling performance issue of our system. I’ve tried jprofiler, yourkit, but it was expired ^^. When I was searching for a free tool, I see VisualVM. Oh.. It’s offical tool for Java! It’s as good as Mysql Workbench for MySQL! That’s really what I need!
Let’s install it for our development environment. It’s interesting!
Our working environment: local one is MacOS, remote development server is CenOS on Vagrant, Scala application built on activator.
1. Download & install VisualVM
* http://visualvm.java.net/download.html It’s java world, so it should not depend on your OS. If you’re working with Java/Scala than it’s ok. So don’t worry if your computer is using Window or Ubuntu.
2. Config your remote host
* There’s some kind of Java app. Add the configuration to default for any java app is good, do it like this: export JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.33.40"
* hostname is my local vagrant ip setting, port is the defined by myself
* Now start your application! Hey.. in my environment, it’s not work, because I use activator, it not include JAVA_OPTS automatically. So I added it to my command manually to call application like this: ./activator "project my-application" -J-Dcom.sun.management.jmxremote -J-Dcom.sun.management.jmxremote.port=9010 -J-Dcom.sun.management.jmxremote.authenticate=false -J-Dcom.sun.management.jmxremote.ssl=false -J-Djava.rmi.server.hostname=192.168.33.40 run
* yes, -J prefix for additional Java options ^^
3. Open VisualVM (local) and connect to remote app to monitor
* On Application/Remote add your host, in my case : 192.168.33.40
* Add JMX Connection: 192.168.33.40:9010
* It should be connected to your remote app, and you can monitor it now: