Optimizing apache server load

apache-2.2dedicated-serveroptimizationwebalizer

We have an issue with a dedicated server load.

We have 16 processors with 4 core @ 2.40GHz, if I understood correctly cat /proc/cpuinfo output.

Unfortunately, I don't have access to free -m or vmstat.

But from top I got that we have 24 GB.

And snapshot from top about processes:
Top

As far as I see, memory is not used at all. But the cpu is used heavily. Apache consumes most of CPU.

Another useful piece of information:

Every 1.0s: ps u -C httpd,mysqld,php                                                                                                                                                                                                                                                                                                           Tue Mar 27 10:48:19 2012

USER         PID %CPU %MEM    VSZ   RSS TTY  STAT START   TIME COMMAND
root        7476  0.0  0.1 446808 37880 ?        SNs  Mar06   0:43 /opt/zone/sbin/httpd -D SSL -D SLOT_ID0 -f /etc/opt/zone/apache/ssl_httpd.conf
mysql      36061 41.6  2.1 1113672 529876 ?  SNl  Feb20 21503:48 /opt/zone/sbin/mysqld --basedir=/opt/zone --datadir=/srvdata/mysql --user=mysql --log-error=/srvdata/mysql/dn79.err --pid-file=/srvdata/mysql/mysqld.pid --socket=/tmp/mysql.sock --port=3306
root       37257  0.0  0.0 424056 16840 ?        SNs  Mar22   1:03 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       52743  0.0  0.1 447100 30360 ?        SN   10:40   0:00 /opt/zone/sbin/httpd -D SSL -D SLOT_ID0 -f /etc/opt/zone/apache/ssl_httpd.conf
http       52744  0.0  0.1 447100 30360 ?        SN   10:40   0:00 /opt/zone/sbin/httpd -D SSL -D SLOT_ID0 -f /etc/opt/zone/apache/ssl_httpd.conf
http       52745  0.0  0.1 447100 30360 ?        SN   10:40   0:00 /opt/zone/sbin/httpd -D SSL -D SLOT_ID0 -f /etc/opt/zone/apache/ssl_httpd.conf
http       52746  0.0  0.1 447100 30360 ?        SN   10:40   0:00 /opt/zone/sbin/httpd -D SSL -D SLOT_ID0 -f /etc/opt/zone/apache/ssl_httpd.conf
http       52747  0.0  0.1 446956 30324 ?        SN   10:40   0:00 /opt/zone/sbin/httpd -D SSL -D SLOT_ID0 -f /etc/opt/zone/apache/ssl_httpd.conf
http       52980 69.1  1.8 852468 458088 ?   RN   10:41   5:02 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       53483 47.0  0.8 615088 221040 ?       RN   10:43   2:05 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       53641  1.8  0.2 446580 54632 ?        SN   10:45   0:03 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54384 81.2  0.9 625828 229972 ?       RN   10:45   2:14 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54411 47.7  0.5 535992 142416 ?       RN   10:45   1:09 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54470 41.7  0.4 512528 120012 ?       RN   10:46   0:54 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54475  0.1  0.1 437016 41528 ?        SN   10:46   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54486  1.5  0.2 445636 53916 ?        SN   10:46   0:02 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54531  2.5  0.2 445424 53012 ?        SN   10:46   0:02 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54549  0.0  0.0 424188  9188 ?        SN   10:46   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54642  0.0  0.0 424188  9200 ?        SN   10:47   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54651  0.0  0.0 424188  9188 ?        SN   10:47   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54661  0.0  0.0 424188  9208 ?        SN   10:47   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54663  6.9  0.2 449936 58560 ?        SN   10:47   0:03 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54666  6.0  0.2 453356 61124 ?        SN   10:47   0:02 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54667  2.8  0.1 437608 42088 ?        SN   10:47   0:01 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54670  1.5  0.1 437540 42172 ?        SN   10:47   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54672  2.1  0.1 439076 43648 ?        SN   10:47   0:01 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54709  0.0  0.0 424188  9192 ?        SN   10:47   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54711  1.0  0.1 437284 41780 ?        SN   10:47   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54712 11.8  0.2 448172 54700 ?        SN   10:47   0:02 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54720  0.0  0.0 424188  9192 ?        SN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54721  0.0  0.0 424188  9188 ?        SN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54747  9.1  0.2 443568 51848 ?        SN   10:48   0:01 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54782  1.8  0.1 438708 37896 ?        RN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54784  0.0  0.0 424188  9180 ?        SN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54785  0.0  0.0 424188  9188 ?        SN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54789  0.0  0.0 424188  9188 ?        SN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54790  0.0  0.0 424188  9188 ?        SN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54791  0.0  0.0 424188  9188 ?        SN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0
http       54792  0.0  0.0 424056  8352 ?        SN   10:48   0:00 /opt/zone/sbin/httpd -f /etc/opt/zone/apache/httpd.conf -D SLOT_ID0

Webalizer shows following:
Webalizer

What can be done in the following situation? The application is Magento.

Best Answer

You are barking up the wrong tree. Seemingly it's Apache consuming the CPU; in reality there's mod_php which has to serve your Magento pages.

And the latter is your answer: Magento sure is a heavy beast. Don't try to optimize Apache at this point, concentrate on your Magento setup. Do not disappoint if you don't succeed. Many have tried that in Server Fault, not many have succeeded (from what I have seen). A heavy piece of software is a heavy piece of software.