Limit Apache to 1 request per process

I have several long running processes on apache and when the server gets a little load they all seem to connect in 3-4 processes. I tried setting MaxRequestsPerChild to 1 and it works, but spawning new processes is expensive all the time. So there is a way to limit 1 request per process / thread without breaking it.

Here is my current configuration:

<IfModule prefork.c>
StartServers       25
MinSpareServers    50
MaxSpareServers   50
ServerLimit      512
MaxClients       50
MaxRequestsPerChild  10
</IfModule>
<IfModule worker.c>
StartServers         25
MaxClients        50
MinSpareThreads     50
MaxSpareThreads     125
ThreadsPerChild     50
MaxRequestsPerChild  10
</IfModule>

      

+2


a source to share


2 answers


ThreadsPerChild monitors the number of requests per process. So, here is my resulting configuration:



<IfModule prefork.c>
StartServers       100
MinSpareServers    150
MaxSpareServers   150
ServerLimit      512
MaxClients       150
MaxRequestsPerChild  100
</IfModule>

<IfModule worker.c>
StartServers         100
MaxClients         150
MinSpareThreads     150
MaxSpareThreads     150
ThreadsPerChild     1
MaxRequestsPerChild  100
</IfModule>

      

-2


a source


You want to disable "KeepAlive":

Keepalive off



Disables persistent connections. See http://httpd.apache.org/docs/2.0/mod/core.html#KeepAlive

+2


a source







All Articles