HP-UX HB v13.00 Ch-11 - Software Development

HP-UX Handbook Rev 13.00 Page 95 (of 101)
Chapter 11 Software Development
October 29, 2013
java_q4p
> 2400m
text + private data
private
private
private
4 GB
The IA64 platform knows another address space model, which is used by the JVM for
applications that need a large java heap. Here only 2 java executables are shipped:
Executable
-Xmx values
Quadrant Usage
private
address
space
Q1
Q2
Q3
Q4
java
< 1600m
text + private data
private
shared
shared
2 GB
java_q4p
> 1600m
text + private data
private
mostly
private
mostly
private
4 GB
The limits for the Xmx option might change with different java versions.
These Xmx limits try to make sure that there is enough private address space left for the JVM
itself (for the process heap, thread stacks etc) after the java heap has been allocated. There might
however be cases where the remaining space is not sufficient, e.g. because the java application
has a native (JNI) part which needs a lot of space on the process heap, or because the java
application creates many threads which require a lot of space for the thread stacks.
In such a case, chatr(1) can be used on PA-RISC to change the quadrant usage of the java
executables. On IA64 java knows the command line option Xmpas:on, which makes the JVM
invoke java_q4p, no matter what the Xmx value is.
To solve JVM out of memory problems, one has to balance the memory requirements of the java
application and the JVM, and use the precious address space carefully.
The JVM doesn’t need a large process stack, so maxssiz should be kept small. The default of 8
MB is plenty for java, but consider that this affects all processes on the system, and other
processes might require a larger maxssiz.
If the java application creates a lot of threads, the thread stack size may become crucial. E.g. if
there are 1000 threads (which is not so unusual for a large server application), a thread stack size
of 512k means the thread stacks will occupy 512MB of the address space. Reducing the the stack
size carefully with the Xss option can save several 100MB in such a case.
Note that the environment variable PTHREAD_THREAD_STACK_SIZE has no effect on the stacksize
of java threads. The JVM will use its own defaults (128k on PA-RISC and 512k on Itanium, but
this might vary between different java versions), or the Xss command line setting.
Especially on Itanium, with a high number of threads it might save a lot of space if the thread
stacksize is slightly reduced from 512k to 508k. Because of the guard page, a 512k stacksize
results in a 516k mapping, and because of the granularity used by the kernel for such mappings,
a 516k mapping will in reality occupy 768k (512k+256k), with 252k wasted per thread. With a