Specifying a sufficient JVM Heap Size is important to Java performance. The JVM has thresholds it uses to manage the JVM's storage. When the thresholds are reached, the garbage collector (GC) gets invoked to free up unused storage. GC can cause significant degradation of Java performance.
Use the administrative console to specify the Initial Heap Size and the Maximum Heap Size for the JVM.
To view this administrative console page, click Servers > Application Servers > server_name > Process Definition > Java Virtual Machine. Access the configuration tab to change these settings.
Example: This is an example of a verboseGC report.
.. <AF[21]: Allocation Failure. need 32784 bytes, 32225 ms since last AF > <AF[21]: managing allocation failure, action=1 (84320/131004928) (3145728/3145728)> <GC(21): GC cycle started Wed Feb 27 22:46:11 2002 <GC(21): freed 99587928 bytes, 76% free (102817976/134150656), in 118 ms> <GC(21): mark: 103 ms, sweep: 15 ms, compact: 0 ms> <GC(21): refs: soft 0 (age >= 32), weak 0, final 878, phantom 0> <AF[21]: completed in 118 ms >. ..
Key things to look for in a verboseGC report are:
Ideally, you want to be spending less than 5% of the time in GC. To determine percentage of time spent in GC, divide the time it took to complete the collection by the time since the last AF and multiply the result by 100. For example,
118/32225 * 100 = 0.366%
If you are spending more than 5% of your time in GC and if GC is occurring frequently, you may need to increase your Java heap size.
To determine this, look at the %free. You want to make sure the number is not continuing to decline. If the %free continues to decline you are experiencing a gradual growth in allocated heap from GC to GC which could indicate that your application has a memory leak.
You can also use the MVS console command, modify display, jvmheap to display JVM heap information. See "Modify command" for details. In addition, you can check the server activity and interval SMF records. The JVM heap size is also made available to PMI and can be monitored using the Tivoli Performance Viewer.