Monitoring and Tuning Garbage Collection

From AgileApps Support Wiki

To monitor the frequency of Garbage Collection inside the JVM:

$java_home/bin/jstat  -gcutil pid <intervalmillis> 
[root@web1]# /usr/local/java/bin/jstat -gcutil 12929 5000
     S0    S1      E      O      P      YGC   YGCT   FGC   FGCT    GCT   
    0.00  42.66  37.32  12.82  26.96   4845  145.414  26  1.745  147.159
    0.00  42.66  37.78  12.82  26.96   4845  145.414  26  1.745  147.159
    0.00  42.66  57.70  12.82  26.96   4845  145.414  26  1.745  147.159

Tuning parameters are set in catalina.sh under CATALINA_OPTS

Learn More: http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html