Hallett_German

KB Preview: ThreadStackSize for Stats/Defect Aggregation

Discussion created by Hallett_German Employee on May 6, 2014

I want to thank APM Sustaining Engineering for providing the content for this:

A more complete look at setting ThreadStackSize JVM Argument for Defects and Statistical Aggregation in tess-default.properties/tess-customer.properties.

For most JVMs, setting the specified thread stack size to 192 (i.e. -XX:ThreadStackSize=192) for defects/stats aggregation is sufficient, but there are JVMs which may need more than 256. These scenarios are discussed below.

Determining a ThreadStackSize for HP-UX:

An example of a JVM needing a larger stack size is HP-UX. See
https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXJAVAHOME , which requires a  minimum stack size for 32-bit of 400 (i.e. -XX:ThreadStackSize=400). So, especially when using custom JVMs (under memory limitation scenarios), it is strongly recommended to use the standalone simple java program. This can check what is the minimal/default stack size needed.

The alternative is specifying a random value for defects/stats aggregation ThreadStackSize, defects/stats separate JVM VM options. This may take time in arriving the minimum value and cause unneeded EM restarts until it finding a minimum value for the  defects/stats JVM command separately by looking at logs.


Determining the default thread stack size in 32-bit:

Get a copy of TestThreadStackSize.java such as from https://gist.github.com/rednaxelafx/1066792 This is a simple java program that sleeps 5 minutes, so one can get then default/query the JVM default/custom values using jinfo jdk utility.

# /opt/java7/jre/bin/java TestThreadStackSize
Running/sleeping…..

Get the PID of TestThreadStackSize :
# /opt/java7/bin/jps -lvm
21524 TestThreadStackSize
21525 sun.tools.jps.Jps -lvm -Dapplication.home=/opt/java7 -Xms8m

Verify the default thread stack size value from the running JVM:
# /opt/java7/bin/jinfo -flag ThreadStackSize 21524
-XX:ThreadStackSize=512


Determining the minimum required thread stack size in 32-bit:

# /opt/java7/jre/bin/java -XX:ThreadStackSize=192 TestThreadStackSize

The stack size specified is too small, Specify at least 200k
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Run the program with the  above recommended setting:

# /opt/java7/jre/bin/java -Xss200k TestThreadStackSize
Running/Sleeping...

# /opt/java7/bin/jps -lvm
21637 sun.tools.jps.Jps -lvm -Dapplication.home=/opt/java7 -Xms8m
21631 TestThreadStackSize -Xss200k

# /opt/java7/bin/jinfo -flag ThreadStackSize 21631
-XX:ThreadStackSize=400


To determine the default thread stack size in 64-bit:
 (For HP-UX JVM, add "–d64" to VM args for 64-bit case):

# /opt/java7/jre/bin/java -d64 TestThreadStackSize
Running/sleeping…..

Get the PID of TestThreadStackSize :

# /opt/java7/bin/jps -lvm
21652 sun.tools.jps.Jps -lvm -Dapplication.home=/opt/java7 -Xms

Outcomes