Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a debian squeeze running with apache2 and php5-cgi. Please see the following stats from my munin: http://imageshack.us/photo/my-images/545/multipscharts.png/

I am running these per-process stats since yesterday and I'm surprised to see such intensive use by php and also such high memory use by the apache processes.

More data: avg (1day) apache2: 30 busy servers, 9 idle Avg apache accesses: 340/minute

Now, I was wondering how I could reduce php's cpu usage and/or apache's memory usage. Note that I'm already server almost all static files by nginx (which is not in these stats).

Also, I'm apparently currently using mpm_prefork_module . The general settings of my apache2 look as follows:

LockFile ${APACHE_LOCK_DIR}/accept.lock
PidFile ${APACHE_PID_FILE}

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>


HostnameLookups Off

Include mods-enabled/*.load
Include mods-enabled/*.conf
Include conf.d/

Include sites-enabled/
GracefulShutDownTimeout 3
AddOutputFilter INCLUDES .shtml
AddType text/html .shtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Any ideas on what settings to look at?

Thanks!

share|improve this question
    
Make sure that you're using worker or event MPM for apache (less memory footprint than prefork MPM). As for PHP, are running it in fastcgi mode? Paste your apache/php config so we can say something more. –  FINESEC Nov 27 '12 at 20:57
    
I can confirm PHP is using fastCGI, as checked with this tip: forums.iis.net/post/1895659.aspx –  Steven De Groote Nov 27 '12 at 23:02
    
I also found that mod_php is still loaded. I'll better remove that. Would it reduce memory usage significantly if I disable other unused modules? –  Steven De Groote Nov 27 '12 at 23:10
    
Just for reference... I disabled my unused mod_php and that alone cut apache2 memory use in half. Will change away from prefork_mpm when I find the time –  Steven De Groote Nov 29 '12 at 19:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.