Rackspace Cloud Server: Crude Performance Tuning
I recently migrated this web site to a virtual server at the Rackspace Cloud. I started with the cheapest, 256M slice, but after hitting some performance issues really quickly, I figured that the extra $10/month to grow the slice to 512M was worthwhile. Even so, I don’t think MySQL and Apache are tuned, out-of-the-box, for such “small” systems.
I am running WordPress, a PHP application, on Apache and MySQL, running on CentOS. I am using Munin to track the system health. Since MySQL performance tuning can be extremely complicated I have focussed my initial efforts on Apache.
So, the memory graph would ideally top out at 512MB, but in practice, the system and programs allocate excess memory they rarely touch, and that gets paged out to swap. It is when the swap activity gets high that system performance goes to heck. A spike in system load is a good symptom of possible performance issues.
When things went bad on Wednesday, I tuned Apache down somewhat from the defaults and then enabled the Apache status page, and told Munin to go ahead and graph that. I am new to Munin, but Slicehost has some excellent articles on installing and configuring it in my environment.
This morning Munin sent me e-mail that it was having trouble collecting data, so I took a look, and reset performance values for Apache based on the above graph:
<IfModule prefork.c> StartServers 6 MinSpareServers 3 MaxSpareServers 12 ServerLimit 15 MaxClients 15 MaxRequestsPerChild 4000 </IfModule>
Hopefully, this will hold. I would love to audit the system memory use in greater detail to allow Apache some greater flexibility, but in the interests of achieving a stable system quickly, this will hopefully prove to be a good strategy.