Feedback
Did this article resolve your question/issue?

   

Article

How to configure max_thread_proc and avoid Java Out of Memory error on HP-UX.

« Go Back

Information

 
TitleHow to configure max_thread_proc and avoid Java Out of Memory error on HP-UX.
URL NameP26400
Article Number000151551
EnvironmentHP-UX
Progress/OpenEdge Product Family
Question/Problem Description
How to configure max_thread_proc and avoid Java Out of Memory error on HP-UX.
What is the max_thread_proc?
What is nkthread?
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
This Solution explains how to configure two HP-UX kernel parameters for JavaTMSupport so that the maximum number of threads per process is not encountered. Reaching the maximum number of threads per process is usually seen as a Java Out of Memory error.

To determine if this is the error causing the problem check the admserv.log for errors relating to the Java Out of Memory error. There should be a note in this log as to which log file will contain details about the resource error. (ie. ads0.exp )

Java programs can use threads and sockets heavily. Server applications commonly spawn one to two threads for each client connected to the server (one socket connection to read and another to write).

According to Hewlett Packard, the default values for HP-UX 11.0 are set too low for most Java applications. Two kernel parameters need to be set so that the limit of the maximum number of threads per process is not encountered.

They are max_thread_proc and nkthread.


To work around the Out of Memory error, the value of the max_thread_proc must be set higher than the expected maximum number of simultaneously active threads for the application.

The number of threads needed by the process can be checked by using the -eprof option available with JDK 1.1.8. Analyze the Java.eprof file using HPjmeter by selecting the threads metric.


For information about HPjmeter, refer to:

http://www.hp.com/products1/unix/java/hpjmeter/

max_thread_proc is the maximum number of threads allowed in each process. The minimum value (and default) is 64, and is often too low for most Java applications. The maximum value is the value of nkthread.
They appear in the kernel as:

Java Generic Server

maxusers 400
max_thread_proc maxusers*3
maxfiles 2048
maxfiles_lim 2048
ncallout 2*((((nproc*7)/4)+16)*2)
nkthread 2*max_thread_proc
nfile (2*nproc)+1000
nproc ((maxusers*5)+64)

nkthread is the total number of kernel threads available in the system. This parameter is similar to the nproc tunable except that it defines the limit for the total number of kernel threads able to run simultaneously in the system.

The value of nkthread must be greater than nproc. The default is approximately twice that of nproc. The maximum is 30000. The suggested value of nkthread is 2*max_thread_proc.

If there are a lot of Java processes running and each running process uses many threads, the value of nkthread must be increased to support the number of processes running.
(Remember, nkthread limit should be based on what the max_thread_proc is set to.)
Workaround
Notes
Last Modified Date9/13/2015 2:23 PM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.