Hitachi

Hitachi Application Server V10 User's Guide (For Windows® Systems)


3.1.2 Memory structure and GC flow for SerialGC

If you select SerialGC as the Java memory management method, CopyGC or FullGC occurs according to the usage of the memory area. When you select SerialGC, specify the -XX:+UseSerialGC option, and the options related to the memory area.

Memory structure of SerialGC

The following figure illustrates the memory structure when SerialGC is selected as the Java memory management method.

[Figure]

The following table shows the roles of each area.

No.

Area name

Role

1

Java heap area

The memory area used by Java programs. This area is divided into the New area and the Tenured area.

2

New area

The area that stores new objects. This area is divided into the Eden area and the Survivor area.

3

Eden area

The area that stores objects immediately after they are created

4

Survivor area

The area that stores Java objects that are in use in the New area, and which were not discarded during execution of CopyGC. This area is divided into the From space and the To space.

5

Tenured area

The area that stores objects to be used for a long time

6

Metaspace area

The area that stores loaded class information and method information

7

C heap area

The area used when Developer's Kit for Java executes the native library. This area is specific to the OS.

8

Thread stack area

The stack area retained for each thread. This area is specific to the OS.

GC flow for SerialGC

The following figure illustrates the GC flow for SerialGC.

[Figure]

  1. First CopyGC

    Generated objects are stored in the Eden area in the New area. When the Eden area is filled with objects, the first CopyGC occurs. The entire New area is the target of the CopyGC. When CopyGC occurs, no longer used objects are deleted, and objects in use are moved to the To space (S1) in the Survivor area.

  2. Second CopyGC

    After the first CopyGC, when the Eden area is filled with objects again, the second CopyGC occurs. Because CopyGC targets the entire New area, objects moved to the To space (S1) in the Survivor area from the Eden area for the first CopyGC are subject to CopyGC. Objects in use stored in the Eden area when the second CopyGC occurs are moved to the To space (S2), and the objects in use in the From space (S1) are moved to the To space (S2).

  3. nth CopyGC

    If objects moved to the Survivor area are being used when CopyGC occurs, they keep moving between the From space and the To space in the Survivor area alternately. If the number of times specified for CopyGC occurrences of an object exceeds the specified number (15 times in the figure), the object is moved from the Survivor area to the Tenured area.

  4. FullGC

    When the Tenured area is filled with objects, FullGC occurs, and no longer used objects in the entire Java heap area are deleted.

Parameters to set for SerialGC

For SerialGC, FullGC, which will stop applications for a long time, will always occur. Therefore, you must design and tune memory so that FullGC will not occur until a time in which it can occur without issues. The following table lists the parameters to set for SerialGC.

[Figure]

No.

Item

Option name

Description

1

SerialGC settings

-XX:+UseSerialGC

Select SerialGC as the memory management method. This parameter is enabled by default.

2

Designing memory

-Xmxmaximum_Java_heap_area_size

Set the maximum size for the Java heap area.

3

-Xmsinitial_Java_heap_area_size

Set the initial size for the Java heap area. For this parameter, we recommend setting the same value as the -Xmx option.

4

-XX:MaxMetaspaceSize = maximum_Metaspace_area_size

Set the maximum size for the Metaspace area.

5

-XX:MetaspaceSize=standard_value_for_FullGC_that_originates_from_the_Metaspace_area

Set the standard value for FullGC that originates from the Metaspace area. FullGC occurs when the Metaspace area size exceeds the standard value, so specify a value estimated from the size of class information required for applications. For this parameter, we recommend setting the same value as the -XX:MaxMetaspaceSize option.

6

-XX:CompressedClassSpaceSize = maximum_Compressed_Class_Space_size

Set the maximum size of the Compressed Class Space area to be created in the Metaspace area when the compressed object pointer functionality is available. For this parameter, we recommend setting the same value as the -XX:MaxMetaspaceSize option.

7

-XX:NewRatio = ratio_of_Tenured_area_to_New_area

Set the ratio of the Tenured area when the New area is assumed to be 1.

8

-XX:SurvivorRatio=ratio_of_Eden_area_to_From_and_To_areas_of_Survivor_area

Set the ratio of the Eden area when the ratio of the From and To spaces of the Survivor area is assumed to be 1.