K
KudosDesigns
Guest
Hi,
We have had major issues with memory and linux running out of swap space. This has caused our servers to completely hang and not process requests.
We are running 150 domains on a P4 3.0Ghz machine with 4Gb RAM and 2Gb SWAP. We process around 10K messages per day with qmail and run around 75 domains with PHP scripted content managed websites.
The machine seems to be using swap space as httpd runs out of memory. We have stabilised the situation by implementing two things to httpd.conf (Apache httpd-2.0.54-10.4 on FC4):
MaxRequestsPerChild 200
RLimitMEM 100663296 1610612736
This should mean Apache processes are re-spawed after 200 requests (rather than 4000) and memory to Apache is top limited to 1.5Gb and each process can only consume 96Mb (we are running 16 httpd processes usually).
Although this has stopped memory running away with itself, we are very concerned that Apache isn't managing this itself. I have heard that PHP 5 shouldn't really be ever run on Apache 2 - is this the reason? If you restart apache gracefully, memory use goes down to dramatically - it is as if Apache isn't giving up its memory properly.
Does anyone know how to control memory on Apache without manually setting it like above? Should we upgrade to FC5 and run Apache 2.22 - would this help? Is it something to do with MPM and PHP - how do i make it safe as the PHP website recommends?
Or maybe we just need more RAM - but we did have 2Gb in the machine until this morning, upgraded it to 4Gb and it still fell over under the same load.
Thanks
Nick
To add to this, I have found out that we are indeed running prefork.c in our Apache version:
apachectl -l
core.c
prefork.c
http_core.c
mod_so.c
and here is our configuration parameters:
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 200
</IfModule>
Maybe we should low MaxClients???? Help!
We have had major issues with memory and linux running out of swap space. This has caused our servers to completely hang and not process requests.
We are running 150 domains on a P4 3.0Ghz machine with 4Gb RAM and 2Gb SWAP. We process around 10K messages per day with qmail and run around 75 domains with PHP scripted content managed websites.
The machine seems to be using swap space as httpd runs out of memory. We have stabilised the situation by implementing two things to httpd.conf (Apache httpd-2.0.54-10.4 on FC4):
MaxRequestsPerChild 200
RLimitMEM 100663296 1610612736
This should mean Apache processes are re-spawed after 200 requests (rather than 4000) and memory to Apache is top limited to 1.5Gb and each process can only consume 96Mb (we are running 16 httpd processes usually).
Although this has stopped memory running away with itself, we are very concerned that Apache isn't managing this itself. I have heard that PHP 5 shouldn't really be ever run on Apache 2 - is this the reason? If you restart apache gracefully, memory use goes down to dramatically - it is as if Apache isn't giving up its memory properly.
Does anyone know how to control memory on Apache without manually setting it like above? Should we upgrade to FC5 and run Apache 2.22 - would this help? Is it something to do with MPM and PHP - how do i make it safe as the PHP website recommends?
Or maybe we just need more RAM - but we did have 2Gb in the machine until this morning, upgraded it to 4Gb and it still fell over under the same load.
Thanks
Nick
To add to this, I have found out that we are indeed running prefork.c in our Apache version:
apachectl -l
core.c
prefork.c
http_core.c
mod_so.c
and here is our configuration parameters:
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 200
</IfModule>
Maybe we should low MaxClients???? Help!