Download PDF (1.3 MB) - IBM Redbooks
Download PDF (1.3 MB) - IBM Redbooks
Download PDF (1.3 MB) - IBM Redbooks
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Increasing the maximum size of the Java heap might not always solve this type of problem<br />
because the problem might be memory overuse. Conversely, if response times are too long<br />
because of GC pause times, decrease the heap size. If both problems are observed, an<br />
analysis of the application heap usage is required.<br />
4.16.3 Setting the heap size when running multiple JVMs on one system<br />
Each running Java program has a heap associated with it. If you have a configuration where<br />
more than one Java program is running on a single physical system, setting the heap sizes<br />
appropriately is of particular importance. Setting the heap size is also important for 32-bit<br />
systems, where the total amount of addressable memory is limited.<br />
An example of one such configuration is when the Integration Designer is on the same<br />
physical system as a Business Process Manager server using a 32-bit JVM. Each of these<br />
applications is a separate Java program that has its own Java heap. If the sum of all of the<br />
virtual memory usage (including both Java heaps and all other virtual memory allocations)<br />
exceeds the size of addressable physical memory, the Java heaps are subject to paging.<br />
Such paging causes total system performance to degrade significantly. To minimize the<br />
possibility of total system degradation, use the following guidelines:<br />
► First, collect a verbosegc trace for each running JVM.<br />
►<br />
►<br />
►<br />
Based on the verbosegc trace output, set the initial heap size to a relatively low value. For<br />
example, assume that the verbosegc trace output shows that the heap size grows quickly<br />
to 256 <strong>MB</strong>, and then grows more slowly to 400 <strong>MB</strong> and stabilizes at that point. Based on<br />
this change, set the initial heap size to 256 <strong>MB</strong> (-Xms256m).<br />
Also based on the verbosegc trace output, set the maximum heap size appropriately. Be<br />
careful not to set this value too low, or out-of-memory errors occur. The maximum heap<br />
size must be large enough to allow for peak throughput. Using the same example, a<br />
maximum heap size of 768 <strong>MB</strong> might be appropriate (-Xmx768m). Correct sizing of<br />
maximum heap gives the Java heap room to expand beyond its current size of 400 <strong>MB</strong>, if<br />
required. The Java heap grows only if required (for example, if a period of peak activity<br />
drives a higher throughput rate), so setting the maximum heap size higher than current<br />
requirements is generally a good policy.<br />
Be careful not to set the heap sizes too low, or garbage collections will occur frequently,<br />
which might reduce throughput. Again, a verbosegc trace assists in determining garbage<br />
collection frequency. You must ensure that the heap sizes are large enough that garbage<br />
collections do not occur too often. At the same time, you must still ensure that the heap<br />
sizes are not cumulatively so large as to cause the heap to page to the file system. This<br />
balancing act is depends on configuration.<br />
4.16.4 Reducing or increasing heap size if OutOfMemory errors occur<br />
The java.lang.OutOfMemory exception is used by the JVM in various circumstances, so that<br />
finding the source of the exception is difficult. There is no conclusive mechanism for telling the<br />
difference between these potential error sources, but a good start is to collect a trace using<br />
verbosegc. If the problem is a lack of memory in the heap, you can easily see this condition in<br />
the output. For more information about verbosegc output, see 4.16.1, “Monitoring garbage<br />
collection” on page 92. Many garbage collections that produce little free heap space generally<br />
occur preceding this exception. If this lack of free heap space is the problem, increase the<br />
size of the heap.<br />
If there is enough free memory when the java.lang.OutOfMemory exception occurs, the next<br />
item to check is the finalizer count from the verbosegc (only the <strong>IBM</strong> JVM provides this<br />
information). If this count appears high, a subtle effect might be occurring whereby resources<br />
94 <strong>IBM</strong> Business Process Manager V8.0 Performance Tuning and Best Practices