0

I have an apache prefork module http server running on linux machine. The machine has 8GB RAM. I have following in my /etc/httpd/conf/httpd.conf:

<IfModule prefork.c>
    StartServers       8
    MinSpareServers    5
    MaxSpareServers   20
    ServerLimit      512
    MaxClients       512
    MaxRequestsPerChild  4000
</IfModule>

The problem is that no more child processes are getting forked after 256 and the requests are getting queued. I can see the number of child processes stuck at 256 under heavy load.

The average memory of a httpd process is aboout 3.69 MB.

  • When your site is that busy consider using a different MPM. See https://serverfault.com/questions/383526/how-do-i-select-which-apache-mpm-to-use – HBruijn May 31 '19 at 13:05

1 Answers1

2

In addition to increasing the MaxClients and ServerLimit settings to 512 you also need to raise MaxRequestWorkers to 512.

Quoted from the fine manual:

... Sites which need to serve more than 256 simultaneous requests may need to increase MaxRequestWorkers ...

And a little bit further:

MaxRequestWorkers Directive

Description: Maximum number of connections that will be processed simultaneously
Syntax: MaxRequestWorkers number

TheMaxRequestWorkers directive sets the limit on the number of simultaneous requests that will be served. Any connection attempts over the MaxRequestWorkers limit will normally be queued
...
For non-threaded servers (i.e., prefork), MaxRequestWorkers translates into the maximum number of child processes that will be launched to serve requests. The default value is 256; to increase it, you must also raise ServerLimit.

HBruijn
  • 72,524
  • 21
  • 127
  • 192