This subsection describes the tuning procedures for Java heap and Explicit heap to prevent the occurrence of full garbage collection.
Execute the Step (1) always. Execute the Step (2) to (4) after Step (1) when you use the Explicit Memory Management functionality for Explicit heap. From step (5) onwards, check the description for the respective step and implement the step as and when required.
The following figure shows the tuning procedure of Java heap and Explicit heap:
Figure 7-9 Tuning procedure of Java heap and Explicit heap
Determine how to prevent the occurrence of a full garbage collection by tuning the Java heap. For details about the Java heap tuning, see 7.3 Java heap tuning.
When you do not use the Explicit heap area, implement the J2EE server tests after performing Java heap tuning. If a full garbage collection occurs frequently even after proper estimation of Java heap memory, confirm that there are no problems in tuning such as the Survivor area is full. If the problem occurs even after reviewing the Java heap tuning, determine the usage of Explicit heap using the Explicit Memory Management functionality. Proceed with step (2) for using Explicit heap.
To use the Explicit heap area by the Explicit Memory Management functionality, estimate the memory of the Explicit heap area. For details about the Explicit heap tuning, see 7.10 Explicit heap tuning.
In J2EE servers, there are default settings to use the Explicit Memory Management functionality. Also, the objects responsible for increasing the memory size of the Tenured area, including the HTTP session-related objects and the objects for communication with the redirector, are set in such a way so that they are allocated to the Explicit heap. Therefore, always estimate the Explicit heap memory size required for the objects allocated by J2EE server. However, it is not effective if the Explicit Memory Management functionality is used without properly estimating the memory size of Explicit heap.
When using the Explicit Memory Management functionality, execute the J2EE server tests after estimating the JavaVM memory properly in step (1) and step (2). Confirm the use status of Explicit heap by collecting the statistical information obtained in the tests. For details about estimating the Explicit heap based on statistical information, see 7.10.5 How to estimate using statistical information.
Start the application and check the memory size of the Tenured area. While checking, use the statistical information acquired in step (3) or the information acquired in extended verbosegc information. For details about how to acquire the extended verbosegc information, see 5.7.2 Acquiring extended verbosegc information in the uCosminexus Application Server Maintenance and Migration Guide.
If the frequency of full garbage collection and an increase in the memory size of the Tenured area is checked in step (3) and (4) and the full garbage collection needs to be controlled, consider allocating the objects responsible for increasing the memory size of the Tenured area to the Explicit heap. The objects to be studied here are not the "objects that a J2EE server allocates to the Explicit heap by default", but the other "objects created on a Java application". By allocating these objects to the Explicit heap instead of the Java heap, you can expect to reduce the occurrence frequency of a full garbage collection. For details on how to identify the objects responsible for increasing the memory size of the Tenured area, see 7.12(2) When the cause of an increase in the used size of the Tenured area is not known.
The method of allocating the objects responsible for increasing the memory size of the Tenured area to the Explicit heap, includes the following two types:
For details on how to use the APIs of the Explicit Memory Management functionality, see 8.12 Implementing a Java program using the APIs of the Explicit Memory Management functionality, and for details on how to use the automatic allocation functionality of the Explicit Memory Management functionality, see 8.13.2 Using the Explicit Memory Management functionality with the automatic allocation configuration file in the uCosminexus Application Server Expansion Guide.
If you use this functionality to allocate new objects to the Explicit heap, the memory size of the Explicit heap increases. Therefore, you must review the memory size of the Explicit heap again. Proceed to step (6).
Run the application modified in step (5), and review the memory size of entire Explicit heap used by J2EE servers and applications. For details about the review methods, see 7.11 Estimating the memory size when using the explicit management heap functionality in the application.