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).
Tuning the Java Heap
This section discusses topics related to tuning the Java Heap for performance.
"Guidelines for Java Heap Sizing" on page 87
■
"Heap Tuning Parameters" on page 88
■
Guidelines for Java Heap Sizing
Maximum heap size depends on maximum address space per process. The following table
shows the maximum per-process address values for various platforms:
Maximum Address Space Per Process
TABLE 4–1
Operating System
Redhat Linux 32 bit
Redhat Linux 64 bit
Windows 98/2000/NT/Me/XP
Solaris x86 (32 bit)
Solaris 32 bit
Solaris 64 bit
Maximum heap space is always smaller than maximum address space per process, because the
process also needs space for stack, libraries, and so on. To determine the maximum heap space
that can be allocated, use a profiling tool to examine the way memory is used. Gauge the
maximum stack space the process uses and the amount of memory taken up libraries and other
Chapter 4 • Tuning the Java Runtime System
Managing Memory and Garbage Collection
Maximum Address Space
Per Process
2 GB
3 GB
2 GB
4 GB
4 GB
Terabytes
87
Need help?
Do you have a question about the Sun GlassFish Enterprise Server 2.1 and is the answer not in the manual?
Questions and answers