Determining the heap size setting

You must set the Java heap to a value appropriate for your application for optimal performance. This section discusses the guidelines for setting the heap size.

To study the frequency and length of the JVM garbage collection operation, use the -verbose:gc (-Xverbosegc) option in the JVM arguments. Then use this data to tune the heap usage of the JVM based on your application requirements.

NOTE:

JVM allocates the maximum Java heap at start-up. Hence, the swap space considerations for the JVM process are the maximum Java heap space specified in addition to other JVM memory requirements and the memory requirements for all native components.

To identify the swap usage of a process or the swap requirements for a CPU, use the NSKCOM utility.

For example, to identify the swap usage of all the processes or a particular process, enter the following commands at the OSS prompt:

$ gtacl –p nskcom

NSKCOM - T5838H02 BASE (15AUG12) - Jun 13 2012
Copyright 1995 Compaq Computer Corporation

$SYSTEM.SYSTEM.ZSYSCFG
KMS.SWAPFILE = 0 $DATA03.SWAP.CPU0A STOP
KMS.SWAPFILE = 0 $DATA03.SWAP.CPU0B STOP
	 .
	 .
	 .
KMS.SWAPFILE = 5 $SWAP45.SWAP4.CPU05
NSK-status swap-usage 1,525 ,detail

SYSTEM : \SYSTEM1 LOGTIME : June 26, 2012 13:57:14
TYPE : (E=Extensible S=Shared)
(CPU Page size is 16384 Bytes)

Following is the output for the preceded commands:

Process PriUser-IDProgram File Name
1,525 1200,13$JAVDV01.ZYQ00003.Z000Q3GF
KMSF-BACKED SEGMENTS: (Process Space Guarantee =   --  )
-----------------------------------------------------------------------------
SEG-ID TYPE                 SIZE        RESERVATION
                            KBYTE     PAGES    KBYTE
-----------------------------------------------------------------------------
Heap+Global+SRL+Stack       69 MB     1917     29 MB
1068                        16        1        16
1069                        64 MB     16384    64 MB
1065                        64 MB     4096     64 MB
1067                        1088 MB   69636    1088 MB
2100                        8B        1        16
2101                        8B        1        16
------------------------------------------------------------------------------
TOTAL                                 92034    1246 MB

FILE-BACKED SEGMENTS: None
______________________________________________________________________________
NSK-

In the preceding output, the JVM process uses 1246 MB of swap space and has six segments allocated. The JVM process was started with a heap size of 1024 MB, which shows that apart from the Java heap, the process requires about 222 MB of process-specific and application-specific data.

NOTE:

To get an applicable sample of the swap usage for a particular JVM process, check this swap usage at steady state, where all the native components used by the JVM are fully initialized and running.

For related tuning guides, see Tuning Guide for iTP Secure WebServer and NonStop Servlets for JavaServer Pages (NSJSP) on HPE NonStop Servers.