When running Apache HTTP Server 2.2 and / or JBoss Enterprise Application Platform (EAP) 6 on Red Hat Enterprise Linux (RHEL) 6 with a high number of concurrent connections, the user resource limits may need to be changed.
This post highlights two scenarios where the user resource limits may need to be changed: the maximum number of user processes is too low, the maximum number of open files is too low.
The user resource limits can be changed by editing the /etc/security/limits.conf file or via the command line (ulimit). However, changes via the command line are not permanent.
Scenario #1 Apache HTTP Server 2.2
The worker MPM is configured to use up to 16 servers with 64 threads per child.
Error Message
Resource temporarily unavailable: apr_thread_create: unable to create worker thread
If this message is present in the error logs, then the maximum number of user processes is too low. The default maximum number of user processes in RHEL 6 is 1,024. However, the worker MPM configuration stated above requires 1,057 threads.
- 1 thread for the master process (1)
- 1 thread for each child process (16)
- 1 thread for each child process listener (16)
- 1 threads for each child process worker (1,024)
Therefore, the limit (maximum number of user processes) needs to be increased.
ulimit -u 2048
Scenario #2 JBoss EAP 6
The RHEL 6 (x86_64) native components for JBoss EAP 6 have been installed and enabled. The WAIT_FOR_THREAD system property has been set to allow the Apache Portable Runtime (APR) HTTP connector to queue connections / requests until a thread is available.
Error Message
Socket accept failed: org.apache.tomcat.jni.Error: Too many open files
If this message is present in the server logs, then the maximum number of open files is too low.
In order for the APR HTTP connector to queue an increased number of connections / requests, the limit (maximum number of open files) needs to be increased. The default value is 1,024.
ulimit -n 2048 Additional Information The stack size may need to be decreased in order to increase the number of threads on memory bound hardware.
