Thursday, April 6, 2017

Check Java application Memory consumption using jconsole

First add these JAVA OPTS to the application.

JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname="
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.useLocalHostname"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9010"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.local.only=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"

Or to the wrapper.xml

wrapper.java.additional.14=-Djava.rmi.server.hostname=
wrapper.java.additional.15=-Djava.rmi.server.useLocalHostname
wrapper.java.additional.16=-Dcom.sun.management.jmxremote
wrapper.java.additional.17=-Dcom.sun.management.jmxremote.port=9010
wrapper.java.additional.18=-Dcom.sun.management.jmxremote.local.only=false
wrapper.java.additional.19=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.20=-Dcom.sun.management.jmxremote.ssl=false


Then start the java application.

Start jconsole. The java path should have setted.

> jconsole

Go to "Connection --> New connection".
Select "Remote" tab and give the IP and port, Click connect.
Go to "Memory" tab.



No comments: