Visualizing Garbage Collection
The Java Performance Engineering group has released a program called jvmstat which makes it very easy to visualize what is on going with garbage collection within the JVM. This program works with 1.4.1 and 1.4.2. The application you want to monitor must be run with the -XX:+UsePerfData flag. Here is an example..
First, get jvmstat 2.0 and install it. Make sure you are running Java 1.4.2.
Lets start jEdit with the following command line:
/usr/j2sdk1.4.2_04/jre/bin/java -XX:+UsePerfData -mx32m -jar jedit.jar
Now run the 'jvmps' command from the jvmstat/bin directory to see which Java processes are available for analysis.
[/opt/jvmstat/bin]$ ./jvmps
24436 jedit.jar
24467 jvmps.jar
The next step is to attach the 'visualgc' program included with jvmstat to the process we want to analyze.
[/opt/jvmstat/bin]$ ./visualgc 24436
Bada boom, we get this pretty visualization.
From this we can quickly see the sizing of the Survivor spaces, Permanent Generation, Old Generation and so forth. Sure beats reading GC logs.
The jvmstat tool can actually do more than just visualgc, visualgc is just an example of a way to use the data that jvmstat generates. From the website:
"The jvmstat tools provide access to light weight performance and configuration instrumentation exported by the HotSpot JVM and displays the information in various formats. Tools include a general purpose command line tool called jvmstat, a java process list tool called jvmps, and a generational heap visualization tool called visualgc. Remote monitoring is supported via an RMI server application. The jvmstat 1.1 tools can be used to monitor HotSpot 1.4.1 and the jvmstat 2.0 tools can be used to monitor HotSpot 1.4.2."[ref]
|
|
© Copyright
2004
Moazam Raja.
Last update:
6/20/2004; 4:52:42 PM. |
|