J2SE 5.0 supports tools that can be used to provide information on performance and resource consumption for running applications. Two commonly used tools, jconsole and jstat, are discussed in this section.
For a complete list of available tools and their usage, see J2SE 5.0 Trouble-Shooting and Diagnostic Guide.
The JMX based graphical tool jconsole is used to display thread usage, memory consumption, and class loading details. For more information about this tool, see http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html.
To use the tool, you need to:
1. Set the JVM option -Dcom.sun.management.jmxremote in server.xml.
Use the Admin Console or CLI to set this JVM option. For more information, see Configuring Your JVM in Sun Java System Web Server 7.0 Update 4 Administrator’s Guide.
2. Start jconsole.
The binary is available in $JAVA_HOME/bin directory. Specify the pid in the command line when invoking the tool. The pid of the Web Server process is obtained either from the log file or by locating the child webservd process.
You may also invoke jconsole without the pid argument and then select the appropriate VM from the window displaying available VMs.
Thejstat utility can be used to tune the Java heap size and diagnose performance issues related to heap and garbage collection. This utility can be used without any server configuration changes as the VM instrumentation is enabled by default. For more information, see http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jstat.html.