httpd process grows to 64MB, is that normal? how to reduce Memory/Ram?

janton

Verified User
Joined
Sep 17, 2009
Messages
145
Dear Users or Admins,

I now run my server for 2 years and all still goes very well, recently my website is growing well and it asks more resources. I noticed every httpd process takes around 64MB RAM, I ask my self why so much? Because when i read on other websites i see it only takes around ±7MB.

I restarted apache and i see it takes around 7MB for every process when I restart apache, but when i then visit my php/drupal website it goes up to 64MB RAM (it is a heavy drupal module site)

Is this normal, how could I reduce the 64MB Ram (because i now can only run around 20 processes / MaxClients)
It's not that bad that is grows to 64MB, but then it stays like this all the time and all other processes also have that.. could it shrink again to the ±7MB RAM after some time?
 
Hello,

Make sure, you're running the latest version of software: Apache, PHP, Drupal and all drupal`s modules. Additionally you might need to enable caching module in Drupal (I'm not sure weather it's possible or not), enable PHP optcode (APC, etc), enable query caching in MySQL, etc.
 
Hello,

Make sure, you're running the latest version of software: Apache, PHP, Drupal and all drupal`s modules. Additionally you might need to enable caching module in Drupal (I'm not sure weather it's possible or not), enable PHP optcode (APC, etc), enable query caching in MySQL, etc.

Ok yes most of this I did, but is it normal that the httpd process grows and stays like 60MB for each process, because when i reboot it's just 7MB.. but when i visit my site it goes to 60MB's and then it stays like that. (no clearing or somethin)
 
Normal for what? Or for who?

I've just looked at two of the servers I maintain, and I saw each apache process takes 60-75Mb VIRT and 5-12Mb RES, but since it does not bother me, I can say it's normal for me. Note, one checked server is running Apache+NGINX+suPHP, the other server is running Apache+mod_php. So in my case it's OK, the servers are working fine without any issues with RAM. By the way they are OpenVZ containers with 4Gb RAM and 2Gb RAM.

A newly installed Directadmin powered server with Apache on CentOS 6.3 64 bit with the default configs (with blocked 80,443 TCP incoming with iptables)... and each process takes 198Mb VIRT, 7Mb RES

So, I'd guess you need to lower MaxRequestsPerChild here /etc/httpd/conf/extra/httpd-mpm.conf
 
Normal for what? Or for who?

I've just looked at two of the servers I maintain, and I saw each apache process takes 60-75Mb VIRT and 5-12Mb RES, but since it does not bother me, I can say it's normal for me. Note, one checked server is running Apache+NGINX+suPHP, the other server is running Apache+mod_php. So in my case it's OK, the servers are working fine without any issues with RAM. By the way they are OpenVZ containers with 4Gb RAM and 2Gb RAM.

A newly installed Directadmin powered server with Apache on CentOS 6.3 64 bit with the default configs (with blocked 80,443 TCP incoming with iptables)... and each process takes 198Mb VIRT, 7Mb RES

So, I'd guess you need to lower MaxRequestsPerChild here /etc/httpd/conf/extra/httpd-mpm.conf

Most of my httpd looks like this: VIRT 155m and RES 60m
and my /etc/httpd/conf/extra/httpd-mpm.conf looks like this:

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 2000
</IfModule>

Server has 1.5GB RAM and 2GB SWAP


Should I lower "MaxRequestsPerChild" even more?
I can make my server eat all memory if I holf F5 for a few minutes.:o on a heavy drupal page...
 
Last edited:
I can make my server eat all memory if I holf F5 for a few minutes.:o on a heavy drupal page...
Use iptables to limit connections per IP, although, I am unable to do this :( not sure why
-A INPUT -p tcp -m state -m recent --dport 80 --state NEW --set
-A INPUT -p tcp -m tcp -m state -m recent --dport 80 --state NEW -j DROP --update --seconds 1 --hitcount 15
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state -m recent --dport 443 --state NEW --set
-A INPUT -p tcp -m tcp -m state -m recent --dport 443 --state NEW -j DROP --update --seconds 1 --hitcount 10
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
 
Use iptables to limit connections per IP, although, I am unable to do this :( not sure why

THx! I will use this rule, perhaps it doesn't work for you because you set your IP to the allowed list?

But ok this is perfect! Something I should have done much earlier, but it doesn't explain why my httpd is so big right?
 
Should I lower "MaxRequestsPerChild" even more?

Try it, why not? Note, every single server is a mostly unique one and in your particular case you might need something lower. You can play with its value, as nothing bad will occur to your server. Just change it to 10-300 and see how your server feels like. Note, in this case a graphs of your provider or your own (munin is a good one to start with) would be good as you might able to see the influence of the parameter on your server load.
 
Back
Top