Sun GlassFish Enterprise Server v2.1.1 Performance Tuning Guide

Other Garbage Collector Settings

For applications that do not dynamically generate and load classes, the size of the permanent generation has not effect on GC performance. For applications that dynamically generate and load classes (for example, JSP applications), the size of the permanent generation does affect GC performance, since filling the permanent generation can trigger a Full GC. Tune the maximum permanent generation with the -XX:MaxPermSize option.

Although applications can explicitly invoke GC with the System.gc() method, doing so is a bad idea since this forces major collections, and inhibits scalability on large systems. It is best to disable explicit GC by using the flag -XX:+DisableExplicitGC.

The Enterprise Server uses RMI in the Administration module for monitoring. Garbage cannot be collected in RMI-based distributed applications without occasional local collections, so RMI forces a periodic full collection. Control the frequency of these collections with the property -sun.rmi.dgc.client.gcInterval. For example, - java -Dsun.rmi.dgc.client.gcInterval=3600000 specifies explicit collection once per hour instead of the default rate of once per minute.

To specify the attributes for the Java virtual machine, use the Admin Console and set the property under config-name > JVM settings (JVM options).