Linux – How to setup prefork mpm in the m4.xlarge AWS instance with 16GB RAM

apache-2.4httpdlinuxmpm-preforkmpm-worker

Background: I have six webservers behind an ELB, each webserver running 2 virtual host sites. My httpd.conf file doesnt have the configuration for prefork mpm or worker mpm or event mpm.

I tried: I checked under below path and found the default config for prefork mpm
path: usr/share/doc/httpd24-2.4.23/httpd-mpm.conf

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of connections a server process serves
#                         before terminating

    <IfModule mpm_prefork_module>
        StartServers            10
        MinSpareServers          8
        MaxSpareServers         10
        MaxRequestWorkers      250
        MaxConnectionsPerChild   0
    </IfModule>

I have created prefork.conf file under /etc/httpd/conf.d and later restart the httpd service, but I got below error saying:

AH00180: WARNING: MaxRequestWorkers of 400 exceeds ServerLimit value of 256 servers, decreasing MaxRequestWorkers to 256. To increase, please see the ServerLimit directive.

Someone please let me know what values I need to set inorder to get prefork mpm working. I have 16GB of RAM in my servers and only 100MB of space is left.I dont think that much of configuration is needed for just two virtual host sites. Let me know how could I optimize the memory usage and get prefork mpm working

Best Answer

Below config worked for me

<IfModule mpm_prefork_module>
    StartServers            10
    MinSpareServers         8
    MaxSpareServers         10
    ServerLimit             400
    MaxClients              400
    MaxConnectionsPerChild  0
</IfModule>

Thankyou