Kohei Nozaki's blog 

Profiling with VisualVM


Posted on Thursday Mar 06, 2014 at 05:04PM in Technology


Environment

Local

  • VisualVM 1.7.0_51 (Build 1352-130117); platform 20130117-unknown-revn
  • WildFly 8.0.0.Final
  • Oracle JDK7u51
  • OS X 10.9.2

Remote profiling target

  • WildFly 8.0.0.Final
  • Oracle JDK7u45
  • OS X 10.9.1

Profiling local instances

  • We don't need any special operation to profiling with local instances.
  • After just launch VisualVM, we can see local instances.

Profiling Remote instances

Create a management user in the target instance

kyle-no-MacBook:bin kyle$ pwd
/Users/kyle/apps/wildfly-8.0.0.Final/bin
kyle-no-MacBook:bin kyle$ ./add-user.sh kyle ***
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
Added user 'kyle' to file '/Users/kyle/apps/wildfly-8.0.0.Final/standalone/configuration/mgmt-users.properties'
Added user 'kyle' to file '/Users/kyle/apps/wildfly-8.0.0.Final/domain/configuration/mgmt-users.properties'
kyle-no-MacBook:bin kyle$ 

Define a system property in the target instance to accept connection from remote host

  • CAUTION: this makes management port to accept connections from everyone.
/system-property=jboss.bind.address.management:add(value=0.0.0.0)

Launch VisualVM

  • We have to specify an additional jar on startup option like this:
jvisualvm --cp:a /Users/kyle/apps/wildfly-8.0.0.Final/bin/client/jboss-cli-client.jar
  • If it doesn't work, try “-cp:a” instead

Add and connect to target

  1. Right-click “Remote” - “Add a remote host”

  2. Enter hostname - OK

  3. Right-click hostname - add a JMX connection

  4. Enter connection url, username and password that created in above step - OK NOTICE: Usually, WildFly's management port is 9990. I customized it as 49990 for my environment.

  5. Double-click a icon which appeared with JMX icon. now we can do profiling with remote WildFly instance.

service:jmx:http-remoting-jmx://[HOSTNAME]:9990

References

  1. Connecting VisualVM with a remote JBoss AS 7 / EAP6 JVM process | akquinet-blog
  2. [AS7-4695] Server does not start with sun jmx enabled - JBoss Issue Tracker
  3. Using jconsole to connect to JMX on AS7 | Community
  4. adding alternative jmx connectivity (i.e. JBoss 7) | Oracle Community
  5. JMX subsystem configuration - WildFly 8 - Project Documentation Editor



No one has commented yet.

Leave a Comment

HTML Syntax: NOT allowed