08.06.2014 Views

Download PDF (1.3 MB) - IBM Redbooks

Download PDF (1.3 MB) - IBM Redbooks

Download PDF (1.3 MB) - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.16.2 Setting the heap size for most configurations<br />

This section contains guidelines for determining the appropriate Java heap size for most<br />

configurations. If your configuration requires that more than one JVM run concurrently on the<br />

same system, see 4.16.3, “Setting the heap size when running multiple JVMs on one system”<br />

on page 94. For example, you might need more than one JVM if you run both a Business<br />

Process Manager server and Integration Designer on the same system. If your objective is<br />

designed to support large business objects, read 4.7.2, “Tuning for large objects” on page 63.<br />

When the heap size is too low, OutOfMemory errors occur. For most production applications,<br />

the <strong>IBM</strong> JVM Java heap size defaults are too small, so increase them. When the heap size is<br />

too low, OutOfMemory errors occur. In general, the HotSpot JVM default heap and nursery<br />

size are also too small so increase them also.<br />

There are several approaches to setting optimal heap sizes. Here we describe the approach<br />

that most applications can use when running the <strong>IBM</strong> JVM on AIX. The essentials can be<br />

applied to other systems. Set the initial heap size (-Xms option) to a typical value (for example,<br />

768 <strong>MB</strong> on a 64-bit JVM, or 256 <strong>MB</strong> on a 32-bit JVM). Set the maximum heap size (-Xmx)<br />

option to a typical value, but large (for example, 3072 <strong>MB</strong> on a 64-bit JVM, or 1024 <strong>MB</strong> on a<br />

32-bit JVM). The maximum heap size must never force the heap to page. The heap must<br />

always stay in physical memory. The JVM then tries to keep the GC time within reasonable<br />

limits by growing and shrinking the heap. The output from verbosegc is used to monitor<br />

garbage collection (GC) activity.<br />

If Generational Concurrent GC is used (-Xgcpolicy:gencon), you can also set the new area<br />

size to specific values. By default, the new size is a quarter of the total heap size or 64 <strong>MB</strong>,<br />

whichever is smaller. For better performance, set the nursery size to half of the heap size or<br />

larger, and do not cap the value at 64 <strong>MB</strong>. You can set new area sizes by using the following<br />

JVM options:<br />

► -Xmn<br />

► -Xmns<br />

► -Xmnx<br />

You can use a similar process to set the size of HotSpot heaps. In addition to setting the<br />

minimum and maximum heap size, also increase the nursery size to a range of 1/4 to 1/2 of<br />

the heap size. Never increase the nursery to more than half the full heap.<br />

You can set the nursery size by using the MaxNewSize and NewSize parameters:<br />

► -XX:MaxNewSize=128m<br />

► -XX:NewSize=128m<br />

If you are using a 64-bit <strong>IBM</strong> JVM, use the -Xgc:preferredHeapBase parameter to avoid native<br />

out-of-memory issues because of exhaustion of memory addresses below 4 GB (for example,<br />

classes and threads are allocated in this region). The -Xgc:preferredHeapBase option can be<br />

used to move the Java heap outside of the lower 4 GB address space. See the <strong>IBM</strong> JVM<br />

information center for a more detailed description of the solution:<br />

http://ibm.co/10CGjeT<br />

After the heap sizes are set, use verbosegc traces to monitor GC activity. After analyzing the<br />

output, modify the heap settings accordingly. For example, if the percentage of time in GC is<br />

high and the heap has grown to its maximum size, you might improve throughput by<br />

increasing the maximum heap size. As a general guideline, greater than 10% of the total time<br />

spent in GC is generally considered high.<br />

Chapter 4. Performance tuning and configuration 93

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!