In a continued effort to keep this site online all the time I’m looking for some help in tuning apache2. Earlier today we ran into some serious performance issues based on what I had it tuned to, which caused 3/4 of the total swap to be used. NOT a good idea.
In the meantime I have turned things down a bit in the prefork MPM section, but I’m wondering what other tips the community has. What values do you suggest in prefork MPM for performance tuning?
The box is a quad-core xen vps with 512M. I have 5,000+ unique visitors a day on this site in addition to the dozen other blogs hosted (none near as popular). What can I do to keep up with the traffic, yet keep the load down on the machine for performance?
Might I suggest lighttp w/fcgi php. I am using it on a site that has several hundred thousand visitors a day and it works a treat.
Have a look at Yahoo’s performance tips.
You might want to also install the YSlow Firefox plug in… it currently gives this site an F… so there’s a lot you can do to optimize what, how, and how often things are served.
http://developer.yahoo.com/performance/index.html#rules
1. If your VPS uses cpanel or plesk or any of that sillyness, ditch it. It’s using a huge chunk of your ram.
2. Make sure you need all the apache modules you have loaded.
3. Make sure you need all the php modules you have loaded.
4. Use a php cache
Here’s what I’m using for a 256 meg VZ VPS running debian etch
Timeout 200
KeepAlive On
maxKeepAliveRequests 100
KeepAliveTimeout 3
MinSpareServers 10
MaxSpareServers 20
StartServers 15
MaxClients 250
MaxRequestsPerChild 0
HostnameLookups Off
Look at your bottlenecks. Are you sure it is just apache? Maybe it is wordpress or the mysql database it writes to. you can get a HUGE win by installing wp-cache. WordPress is a beast as far as resources go when you get many concurrent visitors.
Do you have sar set up? May I suggest you take a look at atop? It helps you visualize things from interrupts to context switches to disk IO all at the same time. atop is like a better top + vmstat + mpstat + a few more.
wp-cache is a huge win if you aren’t using it already though.
ONLY five thousand visitors and the machine is bogging down? May I suggest my tutorial on improving WordPress performance? (concepts there are applicable to any PHP app running on Apache).
It helped me survive a combined two-day slashdotting/diggdown/reddit/delicious onslaught. On 512 MB RAM.
> Rudd-O,
from a visitors point of view I liked your story v much.
Give up on prefork MPM and use worker with fcgid. That will help a lot with RAM issues. But be sure to check that apache is taking all the RAM.
If you think maybe it’s your media or image files, you could serve the media files with thttpd. This gives you the opportunity to throttle them down and save your bandwidth for the wordpress stuff.
Of course, you’d have to change all the URLs to your media (oh gawd) and set up redirectors in Apache for those folks that linked to them directly from outside.
http://www.acme.com/software/thttpd/
Dump apache, use nginx instead: http://wiki.codemongers.com/Main
I’m handeling some 250k+ pageviews a day. The easy way out is to use the frontend-cache varnish. http://varnish.projects.linpro.no/
Article about mod_deflate settings like on Amazon EC2 AMI
http://railsgeek.com/2008/12/16/apache2-httpd-improving-performance-mod_deflate-gzip