IBM Support

Considerations for capacity planning to avoid OutOfMemory (OOM) errors

Troubleshooting


Problem

A common misconception is to allocate JVM memory occupancy as a multiple of its maximum heap size.

Symptom

Getting OutOfMemory error, or even if not reaching that far, then still getting high CPU due to intense garbage collection activity.

Cause

Incorrect capacity planning, by not taking into consideration JVM (and possibly application's) native memory needs.
The JVM uses/needs native memory in addition to the heap, e.g. for the JIT, to create threads, for loading Java class library classes and native (OS?)libraries, for communications using DirectByteBuffers (DBB), just to give a few examples.
Also applications might use native memory too (e.g directly via JNI).

Diagnosing The Problem

Need to be aware of how many JVMs are running on a single box.

Resolving The Problem

As an example of this problem: let's say that one plans running 4 JVMs on one box, and each JVM is planned to have a 4GB maximum heap, then the misconception is to calculate that 4x4GB = 16GB and to conclude that the box will be provided with 16GB RAM.

The problem with this calculation is that it doesn't take into consideration the fact that a JVM uses system memory not only for the heap, but also for native memory for its own use.
Usually the JVM runtime can take an additional 1GB or more, to load system libraries and using various internal buffers, for creating and managing threads, internal JIT usage etc. and additionally it also depends on application needs as some communications protocols make use of DirectByteBuffers which are allocated from native memory rather than heap.

Here is one example of JVM memory occupancy calculations:
4 JVMs with 4Gb max heap size.  Multiply 4x4x1.25 = 20Gb , then multiply 4x4x1.5 = 24Gb.  Plan for the needed RAM for the WebSphere JVMs to be between 20Gb to 24Gb, and make sure to account for anything else you may have running on the box that needs memory.

"Troubleshooting native memory issues"
https://www.ibm.com/support/pages/node/619631

So in order to have proper capacity planning when deciding on how many JVMs can run on a machine, one has to take into consideration JVM heap size as well as native memory needs.
This is to avoid running into situations like e.g. starting the first three JVMs successfully but when starting the fourth one it gets into OutOfMemory error causing consternation since all four were having same configuration...

Related Information

[{"Type":"MASTER","Line of Business":{"code":"LOB67","label":"IT Automation \u0026 App Modernization"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"ARM Category":[{"code":"a8m50000000CdAmAAK","label":"WebSphere Application Server traditional-All Platforms-\u003EOutOfMemory-\u003ENative"}],"ARM Case Number":"","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.5.0;8.5.5;9.0.0;9.0.5"}]

Historical Number

01753;L6Q;000 30117;999;000 68489;7TD;000 31665;L6Q;000

Document Information

Modified date:
01 February 2024

UID

swg21961513