I recently worked on a J2EE project where pauses due to garbage collection seemed to be causing some problems with response times.
As the project was using the 1.4.2 JRE, they had four different garbage collectors to choose from. A short series of performance tests was conducted to examine their behaviour.
Using the -verbose:gc JVM flag gave visibility into the behaviour of the garbage collector as it logged important information each time the garbage collector ran.[GC 325407K->83000K(776768K), 0.2300771 secs] [GC 325816K->83372K(776768K), 0.2454258 secs] [Full GC 267628K->83769K(776768K), 1.8479984 secs]
Excel was used to create a graph of (roughly) heap used before, heap used after, total heap size, time taken, and whether the gc was a minor collection or a major one.
To save myself time, I wrote a short awk script to filter the logfile so that its contents could be graphed nicely in Excel.
I found the following article especially interesting when learning about the garbage collection options that were available for the version of Java that the project was using…
Tuning Garbage Collection with the 1.4.2 Java Virtual Machine
Comments are closed.
JVMStat is a useful tool for for monitoring what is going on in the Java Virtual Machine (JDK 1.4.1 and above).