I am getting error and unable to start Apache when I set my ThreadPerChild to 200 , although I still have 60% free RAM. Server is Windows Server 2008 R2 With 4GB RAM. How to utilize more RAM to apache in this case?
My Apache MPM Configuration:
# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum number of requests a server process serves
# Win32DisableAcceptEx: Use accept() rather than AcceptEx() to accept network connections
<IfModule mpm_winnt_module>
ThreadStackSize 8388608
ThreadsPerChild 170
MaxRequestsPerChild 0
#Win32DisableAcceptEx
</IfModule>
What I get in apache's error_log:
[Thu Dec 01 18:23:04.459113 2016] [mpm_winnt:notice] [pid 3396:tid
288] AH00354: Child: Starting 200 worker threads.[Thu Dec 01 18:23:04.459113 2016] [mpm_winnt:crit] [pid 3396:tid 288] (OS 8)Not
enough storage is available to process this command. : AH00355:
Child: CreateThread failed. Unable to create all worker threads.
Created 190 of the 200 threads requested with the ThreadsPerChild
configuration directive.[Thu Dec 01 18:23:04.474714 2016]
[mpm_winnt:notice] [pid 3644:tid 380] AH00422: Parent: Received
shutdown signal —
EDIT: 9 Dec 2016:
Followed this page https://support.microsoft.com/en-us/kb/106167 to change the IRPStackSize in Registry to 20 and 25. Still failed to start Apache server.
Thanks.
Best Answer
The thread configuration of the multi-processing module (mpm) on any system is bound to certain restrictions, system limitations, and compiled fail-safe settings as described in the article Apache MPM Common Directives
ThreadsPerChild Directive
ThreadLimit Directive
And they also point out that...
There is also a hard-coded compiled limit which you can circumvent by recompiling the code as explained here:
ThreadStackSize Directive
Which are...
Solution
If you are going to increase the ThreadsPerChild directive, then you will have to align the ThreadLimit directive to the same value or only slightly higher, while additionally reducing the ThreadStackSize directive to a lower value than default, while still maintaining a stable system.
A possible solution would be:
You will have to play around a bit with these values to determine the setting that will allow you to run a stable system with the max possible ThreadsPerChild setting.