tags:

views:

79

answers:

2

I have a few long running processes on apache and when the server gets a bit of a load they all seem to couple into 3-4 processes. I've tried setting the MaxRequestsPerChild to 1 and that works, but spawning new processes all the time is expensive. So is there a way to limit 1 request per process / thread, without constantly destroying 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>
A: 

ThreadsPerChild control the number of requests per process. So here is my resulting config:

<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     2
MaxRequestsPerChild  100
</IfModule>
Gorilla3D
A: 

You want to disable 'KeepAlive':

KeepAlive off

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

Benjamin Franz
Thank you so much!
Gorilla3D