6.4 Heap sizing

Heap sizing is a very important factor in improving an application's performance. Determining the proper initial and maximum heap sizes can greatly improve an application's performance. Heap must always be kept within the physical memory space. If the heap is larger than what is available in physical memory and pages to disk, performance will be severely degraded.

Note: Always keep the heap within physical memory.

The following steps provide an overview on heap sizing. Detailed descriptions of each step are provided in the sections that follow.

1. Run the application with verbose:gc turned on.

2. Run the application with no load to determine the heap size at steady state. This will be a rough estimate of the initial heap size.

3. Run the application under stress to determine the maximum heap size.

4. Run the application under normal usage to determine if the heap expands or contracts, or if a steady state is achieved.