Hitachi

uCosminexus Application Server System Design Guide


7.3.2 Tuning procedure

This subsection describes how to tune the Java heap and Explicit heap to prevent Full GC from occurring.

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

[Figure]

Organization of this subsection

(1) Java heap tuning

Consider how to prevent Full GC by tuning the Java heap. For details about the Java heap tuning, see 7.4 Java heap tuning.

When you do not use the Explicit heap area, implement the J2EE server tests after performing Java heap tuning. If Full GC occurs frequently despite you appropriately estimating the memory size of the Java heap, consider whether there are any issues with the tuning such as the Survivor area becoming 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.

(2) Explicit heap tuning

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.11 Explicit heap tuning.

In J2EE servers, there are default settings to use the Explicit Memory Management functionality. Also, the JavaVM is configured to allocate the objects responsible for increasing the memory size of the Tenured area, such as objects related to the HTTP session, 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.

(3) Confirming the estimation results from statistical information

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.11.4 How to estimate using statistical information.

Reference note

Execute the J2EE server tests and confirm the following points when occurrence of Full GC cannot be reduced.

  • Whether there are any problems in Java heap tuning such as the Survivor area is full

    Check whether the value estimated in step (1) is a correct value.

  • Whether the Explicit heap is full

    Check whether the value estimated in step (2) is a correct value.

  • Whether the Web application configuration is correct

    Depending on the Web application configuration, (How to use APIs in applications) the Explicit Memory Management functionality for the objects related to the HTTP session might not be effective. For details, see 7.14 Precautions for using the Explicit Memory Management functionality in the uCosminexus Application Server Expansion Guide.

If the Explicit Memory Management functionality is not effective even after you re-estimate the memory size of the Java heap and Explicit heap, and the automatic release processing is taking a long time, see Appendix A Efficient Usage of the Explicit Heap Used in an HTTP session to revise the application design. As an efficient usage of the Explicit heap, this appendix describes the points you might consider in an application design in order to efficiently apply the Explicit Memory Management functionality to the HTTP session-related objects and how to check the log for this purpose.

Proceed to step (4) if the problem is not yet resolved after all these confirmations.

(4) Confirming increase in memory size of the Tenured area

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 the extended verbosegc information in the uCosminexus Application Server Maintenance and Migration Guide.

(5) Allocating the objects responsible for increasing the memory size of the Tenured area to the Explicit heap

If steps (3) and (4) confirm that Full GC occurs frequently and the memory size of the Tenured area increases, consider avoiding Full GC by allocating the objects that are causing the increase in memory size 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 frequency with which Full GC occurs. For details on how to identify the objects responsible for increasing the memory size of the Tenured area, see 7.13.2 When the cause of 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 7.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 7.13.2 Using the Explicit Memory Management functionality by using the automatic placement 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).

(6) Reviewing memory size of entire Explicit heap

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.12 Estimating the memory size when using the Explicit Memory Management functionality in the application.

Tip

To use the Explicit Memory Management functionality to effectively suppress the occurrence of Full GC, you need to ensure that objects do not overflow from the Explicit heap. Please confirm the following:

  • Set Discard session (by invoking invalidate method) and appropriate session timeout in the Web application.

  • The Explicit heap area of appropriate memory size can be allocated separately besides the Java heap area.

For details about the confirmation and measures when the Explicit heap overflow occurs, see 7.14.3 Checking and measures when there is an overflow from the Explicit heap.

The further sections describe about the Java heap tuning and Explicit heap tuning. For notes other than those mentioned in this document, see 7. Suppression of Full GC by Using the Explicit Memory Management Functionality in the uCosminexus Application Server Expansion Guide.