7.10.2 Mechanism of reducing time required for automatic release processing
The Explicit Memory Management functionality suppresses occurrence of Full GC by moving long-life objects that become unnecessary in a certain period of time to the Explicit heap so that they will be reclaimed by release processing. In this mechanism, because survival time matches easily, the objects placed in an Explicit heap and the objects in reference relationship are moved from the Java heap to the Explicit memory block on the basis of a reference relationship and managed collectively in an Explicit heap.
However, depending on the operation, objects, which are moved to the Explicit memory block, might greatly increase size of the Explicit memory block and automatic release processing might take long time due to that. Because the system stops during automatic release processing of the Explicit memory block, long time of automatic release processing might create a problem in the system. Explicit memory blocks having large size are called huge blocks. Depending on the movement based on a reference relationship, the objects having different life span move to one block and repetition of this makes the block huge. When a reference relationship is complex and an application developer cannot understand it, huge blocks will generate easily.
- Important note
-
The following table describes the types of Java objects. Life span of Java objects varies depending on the type and some objects might be appropriate and some not for placing in an Explicit heap.
Table 7‒8: Types of Java object Sr.No.
Category
Type of object
Release timing
Appropriate memory area for placement
1
Short-lived objects
Objects temporarily used in request processing and response processing
When copy GC occurs
Java heap (New area)#1
2
Long-lived objects
Objects that become unnecessary over a certain period of time
When executing automatic release processing
Explicit heap
3
Objects required for operating the application and used until the application stops
When application stops
Java heap (Tenured area)#2
#1 If you place the objects in the Explicit heap, generation and automatic release processing of an Explicit memory block occurs frequently and it causes overhead. Hence, an Explicit heap is not appropriate.
#2 If you place the objects in the Explicit heap, huge blocks generate and automatic release processing takes a long time. Hence the Java heap is not appropriate.
The following subsections describe the mechanism of reducing the time required for automatic release processing, by comparing the cases of using and not using the functionality.
- Organization of this subsection
(1) If not using the functionality for controlling object movement to the Explicit memory block and functionality for specifying classes to be excluded from the application of the Explicit Memory Management functionality
This subsection describes the mechanism if you are not using the functionality for controlling object movement to the Explicit memory block and functionality for specifying classes to be excluded from the application of the Explicit Memory Management functionality. The following figure shows an example of three Explicit memory blocks that move objects on the basis of a reference relationship.
|
If neither functionality is used, objects are moved from the Java heap to Explicit memory blocks based on reference relations when GC occurs. In case of the Explicit memory block 1, moved object is the object, which is used until the application stops. Because this object is not reclaimed in automatic release processing, it continues to remain in the Explicit memory block. Because the total size of the object in the Explicit memory block 1 is not huge as shown in this figure, there is no problem at this stage. However, the objects might move to the Explicit memory block each time GC occurs, depending on the reference relations. Because the movement based on this reference relationship continues until the application stops, the Explicit memory block 1 might become a huge block. In the case of the Explicit memory block 2, because the moved object is huge, it becomes a huge block. Thus, if the objects that are not appropriate are placed in large numbers in the Explicit heap, the Explicit memory block becomes huge block and automatic release processing takes a long time.
(2) If using the functionality for controlling object movement to the Explicit memory block
This subsection describes the mechanism if you are using the functionality for controlling object movement to the Explicit memory block. The following figure shows an example of three Explicit memory blocks that move objects on the basis of a reference relationship.
|
If the functionality for controlling object movement to Explicit memory blocks is used, no objects move from the Java heap to Explicit memory blocks based on reference relations even when Full GC occurs. If you use this functionality, you might have to reset the memory size of the Java heap area because the objects placed in the Java heap increase.
If huge blocks are generated even if you use this functionality, use the functionality for specifying classes to be excluded from the application of the Explicit Memory Management functionality.
(3) If using the functionality for specifying classes to be excluded from the application of the Explicit Memory Management functionality in addition to the functionality for controlling object movement to the Explicit memory block
This subsection describes the mechanism if you are using the functionality for specifying classes to be excluded from the application of the Explicit Memory Management functionality in addition to the functionality for controlling object movement to the Explicit memory block. The figure below shows an example of three Explicit memory blocks that move objects on the basis of a reference relationship. Here, assume that the classes of objects, which are moved to the Explicit memory block 1 and Explicit memory block 2, are set in the configuration file for Explicit Memory Management functionality application exclusion.
|
The functionality for specifying classes to be excluded from the application of the Explicit Memory Management functionality provides the configuration file for Explicit Memory Management functionality application exclusion. The objects of the classes specified in this file are excluded from the targets of Explicit Memory Management. If this functionality is used, these objects do not move from the Java heap to Explicit memory blocks when copy GC occurs. These objects move to Tenured area at the time of rising. If you use this functionality, you might have to reset the memory size of the Java heap area because the objects placed in the Java heap increase.
Configuration files for Explicit Memory Management functionality application exclusion used in the functionality for specifying classes to be excluded from the application of the Explicit Memory Management functionality have the following two types:
-
Configuration file for Explicit Memory Management functionality application exclusion provided by the system (sysexmemexcludeclass1100.cfg)
-
Configuration file for Explicit Memory Management functionality application exclusion, for which file path is provided in the option -XX:ExplicitMemoryExcludeClassListFile (exmemexcludeclass.cfg or any file name)
If you perform settings (specifying -XX: ExplicitMemoryUseExcludeClass option) for using the functionality for specifying classes to be excluded from the application of the Explicit Memory Management functionality, the classes specified in sysexmemexcludeclass1100.cfg are excluded from the application of the Explicit Memory Management functionality and the objects of those classes do not move to Explicit heap. If you want to specify more objects to be excluded from the application of the functionality, specify classes of the objects to be excluded from application in exmemexcludeclass.cfg or in a configuration file for Explicit Memory Management functionality application exclusion having any file name. If you want to apply Explicit Memory Management functionality to objects of classes specified in sysexmemexcludeclass1100.cfg, specify those classes in the configuration file for disabling application exclusion of the Explicit Memory Management functionality (exmemnotexcludeclass.cfg). Thus, you can reduce the objects to be moved to the Explicit heap depending on the classes specified in configuration file. The classes excluded from the application of the Explicit Memory Management functionality specify object release rate of the Explicit heap information, which is output in thread dump, for reference. For details on object release rate, see 7.10.3 Using object release rate information of the Explicit memory block.
From among the objects, for which reference path passes through the objects excluded from the application of the Explicit Memory Management functionality, the objects that are not referenced from the path of objects other than Explicit Memory Management functionality application exclusion are also excluded from the application of the Explicit Memory Management functionality. The following figure shows an example of multiple reference paths from objects, which are targeted for exclusion from the application of the Explicit Memory Management functionality.
|
In this figure, object B is an object excluded from the application of the Explicit Memory Management functionality. The following are the reference paths passing through object B:
-
A->B->C1
-
A->B->C2
-
A->B->C3
Among these, because there is a reference path D->C1 for object C1 and E->C3 for object C3, these objects move to the Explicit memory block on the basis of a reference relationship. On the other hand, because object C2 does not have a reference path other than the path passing through object B, it is excluded from the application of the Explicit Memory Management functionality and does not move to the Explicit memory block.