Java profiling with HAT
I’m doing some Java profiling of a Tomcat 5.5 webapp with HAT, The Java Heap Analysis Tool. Here’s some steps to make it work:
- Download HAT from http://hat.dev.java.net/.
- Open the Tomcat Monitor app, click configure, Java tab, and add the following line to Java Options: -Xrunhprof:file=dump.hprof,format=b,heap=all
- You may need to add more memory to Tomcat as well (Maximum memory pool).
- To launch it on the command-line:
java -jar hat.jar -port 7002 “C:\Program Files\Apache Software Foundation\Tomcat 5.5\dump.hprof” - If you run into memory problems w/ hat, give it more:
java -XX:PermSize=128m -XX:MaxPermSize=128M -Xms700M -Xmx700M -jar hat.jar -port 7002 “C:\Program Files\Apache Software Foundation\Tomcat 5.5\dump.hprof” - View the Hat webapp at http://localhost:7002/
- The docs included w/ the HAT download outline the capabilities of the HAT app pretty well.