Tune Java Virtual Machine (JVM) settings
Symptoms of memory allocation errors can vary from intermittent performance problems to the periodic failure and restart of the JVM which does not generate a core dump or error.
Change JVM arguments
WebSphere Commerce is preconfigured with...
-Xk22000 -Xp64k,16k...in the Generic JVM arguments field to minimize the potential of Heap Fragmentation in JVM 1.4.2. This setting may need to be readjusted. For example...
-Xk40000 -Xp10240k,1024k -DinvocationCacheSize=0For further information about using the -Xk and -Xp arguments for your environment, refer to section on "Avoiding Fragmentation" in the Developer Kit and Runtime Environment, Java 2 Technology Edition Diagnostics Guide for version 1.4.2.
Set the initial and maximum heap sizes
For a normal installation of Commerce on a machine with 2GB of physical memory, set...
-Xms 256M -Xmx1290M
Preventing heap fragmentation
The following recommendations might not avoid fragmentation in all cases:
- Start with a small heap. Set -Xms far lower than -Xmx. It might be appropriate to allow -Xms to default, because the default is a low value.
- Increase the maximum heap size, -Xmx.
- If the application uses JNI, make sure JNI references are properly cleared.
All objects being referenced by JNI are pinned and not moved during compaction, contributing significantly to heap fragmentation.
Garbage collection tracing
If you have not enabled garbage collection tracing (verbosegc), the JVM can fail and restart periodically without any visible symptoms other than slow performance. If you have enabled verbosegc, you can find the following errors can be found in the native_stderr.log file:
<AF[2082]: Allocation Failure. need 255768 bytes, 7 ms since last AF>
<AF[2082]: managing allocation failure, action=2 (62667808/536803840)>
<GC(2104): mark stack overflow[1902]>
<GC(2104): GC cycle started Fri Nov 19 21:48:04 2004
<GC(2104): freed 6116120 bytes, 12% free (68783928/536803840), in 4117 ms>
<GC(2104): mark: 1719 ms, sweep: 105 ms, compact: 2293 ms>
<GC(2104): refs: soft 0 (age >= 32), weak 0, final 1, phantom 0>
<GC(2104): moved 2514995 objects, 299673064 bytes, reason=1, used 15808 more bytes>
<AF[2082]: managing allocation failure, action=3 (68783928/536803840)>
<AF[2082]: managing allocation failure, action=4 (68783928/536803840)>
<AF[2082]: managing allocation failure, action=6 (68783928/536803840)>
<AF[2082]: totally out of heap space> <AF[2082]: completed in 4129 ms>
<AF[2083]: Allocation Failure. need 32784 bytes, 1817 ms since last AF>
<AF[2083]: managing allocation failure, action=2 (28528/536803840)>
<GC(2105): mark stack overflow[1903]>
<GC(2105): GC cycle started Fri Nov 19 21:48:07 2004
<GC(2105): freed 67886448 bytes, 12% free (67914976/536803840), in 1702 ms>
<GC(2105): mark: 1601 ms, sweep: 101 ms, compact: 0 ms>
<GC(2105): refs: soft 0 (age >= 32), weak 0, final 120, phantom 0>
<AF[2083]: completed in 1724 ms>
Related Concepts
Performance