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.

On my server with Ubuntu 12.04 LTS server i have Apache 2.2.22.

Serverspecs:

  • Quad-Core AMD Opteron(tm) Processor 1381, 4 cores
  • 4 GB Ram 2x500
  • Harddisk in Raid 1

I have magento 1.7 running on this server.

When i look at the memory usage of the server i see 11 apache processes with a lot of memory:

5348    mysql   2806776 kB  /usr/sbin/mysqld
2499    tomcat6     2595584 kB  /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomc ...
1909    root    2092416 kB  /usr/sbin/console-kit-daemon --no-daemon
15445   www-data    640572 kB   /usr/sbin/apache2 -k start
15484   www-data    638744 kB   /usr/sbin/apache2 -k start
15457   www-data    630252 kB   /usr/sbin/apache2 -k start
15313   www-data    630016 kB   /usr/sbin/apache2 -k start
15514   www-data    629464 kB   /usr/sbin/apache2 -k start
15624   www-data    624932 kB   /usr/sbin/apache2 -k start
15625   www-data    616492 kB   /usr/sbin/apache2 -k start
15628   www-data    616204 kB   /usr/sbin/apache2 -k start
15626   www-data    615848 kB   /usr/sbin/apache2 -k start
15633   www-data    613132 kB   /usr/sbin/apache2 -k start
14457   root    579388 kB   /usr/sbin/apache2 -k start
2280    root    535952 kB   /usr/sbin/sw-collectd -C /etc/sw-collectd/collectd.conf -P /var/run/sw-collectd. ...
8028    postfix     390268 kB   /usr/lib/plesk-9.0/psa-pc-remote -p inet:12768@127.0.0.1
4530    root    338564 kB   sw-engine-fpm: master process (/etc/sw-engine/sw-engine-fpm.conf)
1647    root    301856 kB   php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
1648    www-data    301856 kB   php-fpm: pool www
1649    www-data    301856 kB   php-fpm: pool www
1650    www-data    301856 kB   php-fpm: pool www
1651    www-data    301856 kB   php-fpm: pool www
454     syslog  249864 kB   rsyslogd -c5
15639   root    249856 kB   /usr/bin/sw-engine -c /opt/psa/admin/conf/php.ini -c /opt/psa/admin/conf/php.ini ...
2160    drweb   222240 kB   /opt/drweb/drwebd.real
15659   drweb   222240 kB   /opt/drweb/drwebd.real
2031    root    186596 kB   /usr/lib/policykit-1/polkitd --no-debug

I have got several times that apache killed the server ...

Is it normal that apaches uses this amount of memory? Or how can i reduce it?

My MySQL sever is set to use max of 2Gb Ram.

Apache.conf:

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


    <IfModule mpm_worker_module>
        StartServers          2
        MinSpareThreads      25
        MaxSpareThreads      75 
        ThreadLimit          64
        ThreadsPerChild      25
        MaxClients          250
        MaxRequestsPerChild   0
    </IfModule>

    <IfModule mpm_event_module>
        StartServers          2
        MinSpareThreads      25
        MaxSpareThreads      75 
        ThreadLimit          64
        ThreadsPerChild      25
      MaxClients          256
        MaxRequestsPerChild   0
    </IfModule>

UPDATE 11-12-2013

I have updated the apache2.conf to:

<IfModule mpm_prefork_module>
StartServers 3
MinSpareServers 3
MaxSpareServers 8
ServerLimit             150
MaxClients              150
MaxRequestsPerChild 1000
</IfModule>

But now there are still 8 processes with an average of 620 Mb. So if they all take their memory my apache will get stuck ...

Can i lower the max servers safely? Or how can i reduce the average memory of 1 proces?

share|improve this question
    
That's mostly PHP, or more precisely Magento. Which is well known to be a huge memory hog. You may find Magento's KB article useful. –  Michael Hampton Dec 1 '13 at 20:03
    
I Know magento uses a lot of memory ... but i want to prevent that apache consumes to much memory so the server crashes. The last time was in the middle of the night, with hardly any traffic ... –  Ronny Dec 1 '13 at 20:07
    
Are you using prefork mpm? 700 Clients with 4 GB is brave. –  etagenklo Dec 1 '13 at 22:06
    
i guess i am using prefork. How can i see that ... And what would be better? –  Ronny Dec 2 '13 at 7:47
    
I've heard that NginX is way more economical in terms of memory. –  Sandman4 Dec 11 '13 at 8:14
add comment

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.