Profiling using JVisualVM
Below the steps required to profile Tomcat at runtime.
-
Add the following to
sentenv.bat
if windows andsetenv.sh
in Unix file inTOMCAT_HOME/bin
SET CATALINA_OPTS= %CATALINA_OPTS%
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8888
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
In windows, the above should be in the same line, in Unix, you can add forward slash |
-
Open JDK_HOME/bin/JVisualVM (assuming Oracle JDK)
-
Add JMX connection and fill the host field
127.0.0.1:8888
(assuming that you are locally troubleshooting Tomcat) -
Connect.
You should see something like this:

The above shall be used carefully due to performance and security concerns, authentication and SSL should be added as needed. |