Profiling tomcat using jvisualvm
Enabling Eclipse to use JMX listener on tomcat server
- Using the Servers view double click on your server
- Click on "Open Launch Configuration"
- Go to "Arguments" tab
- In "VM arguments" text box (one on the bottom) add following:-Dcom.sun.management.jmxremote=true-Dcom.sun.management.jmxremote.port=9090-Dcom.sun.management.jmxremote.ssl=false-Dcom.sun.management.jmxremote.authenticate=false
- Launch jvisualvm (in the bin directory of your JDK, version 1.5 or newer)
- Under Applications window you should see "local" and "Tomcat", right and "Open"; this will attach it
Using JVisualVM to profile a URL
After attaching to Tomcat process (above) you will have a Tomcat tab with 5 sub-tabs:
Overview - of the attached process
Monitor - of memory usage, threads active, loaded class count (here you can force garbage collector to clean up and generate heap dumps which can be used to do detailed analysys using eclipse with MAT plugin (download by usual Install New Software... in eclipse).
Threads - detailed thread information
Sampler - CPU or Memory can be sampled (method and CPU time logged)
Profiler - CPU or Memory can be profiled (time and invocation count logged)