Tuesday 20 May 2008 1:49:01 pm
The Apache settings for min/max/spare servers are quite useless if you do not know how many concurrent http connections you have.
To size those appropriately, a simple process is this: enable mod_status, turn it on to full info, then get one of the tools that periodically poll the server-status page and display nice graphs out of the data. Enabling mod-status will increase Apache mem usage, but after you have profiled you can turn it off. There are some other tools that can graph also the number of connections to your db, which is a very important information for tuning, too. Cacti, collectd and rrd are your friends. Having said that, some very general tips (seeing the stats you reported, you probably already know about these, but anyway) - mostly unrelated to cpu usage, unfortunately:
- disable .htaccess files in apache conf
- give enough shmem to your opcoded cache
- MaxRequestsPerChild is a kind of protection against memleaks/segfaults in apache+php. If you have lotsa traffic, 4000 can be low. Check out average age of your Apache process, if it is less than an hour you can raise it
- recompile apache + php as a full static app, no modules. Make sure you have the complete list of apache and php modules needed. Eliminate any you do not need.
- same goes for mysql: recompile statically, include only utf8 charset
- use unix domain socket for connecting to mysql
- You can test if using the intel ICC (not free!) gives faster code
- disable atime registration on the fs partition holding your website
- disable all unnecessary services on the server
- move awstats to another server and ship apache logs to it for processing: when it is parsing the log files is a complete cpu hog!
- configure apache to avoid unnecessary requests from browsers, eg. set Expires headers on css/js/images
- as a last resort, enable eZ static cache - move db to a different server
Principal Consultant International Business
Member of the Community Project Board
|