Web Serving on a UML, in Particular WordPress

I’ve just installed and started playing around with WordPress on my Linode with my brand spanking new domain http://chesterton.id.au, this will be my first post, in fact. Amongst other firsts.

Installing WordPress required installing MySQL, Apache and PHP. That’s a fair amount of software for a small UML with 256M of memory. I wanted to have a quick look into tuning it. There’s no chance I’ll get it right first go, so I guess I’ll watch it and refine it over time. I might have to tweak it as the databases grows.

The biggest bottleneck in a hosted UML is IO, and Linode shapes it to make it fair for everyone. So the goal is to reduce IO.

Swapping causes IO, so limiting the amount of memory MySQL, Apache and PHP uses would be a good start.

With MySQL, it’s a trade off. Give it too little memory, and it uses the disk to perform the query, which obviously causes IO, and slows down the query. Give it too much, and it’s just wasted memory that can’t be used by other processes, which might cause swapping.

You can reduce the number of SQL queries WordPress makes by using WP-Cache. So I chose to base MySQL’s config on my-small.cnf, which is meant for servers with 64Megs. But I figured I’d give the memory saved to apache, and keep an eye on query time in the logs.

I don’t want Apache to take the box down under load, so I configured it fairly conservatively. MaxClients 16 and KeepAliveTimeout 2, this used about 80 Megs under load tested with ab, so there’s plenty of wiggle room if Apache’s processes start consuming more memory.

Under load with 16 concurrent requests, I noticed cpu idle and wait are 0, there is occasional swap activity, an occasional blocked process, and 50 Megs cached, measured with vmstat. This suggests to me it’s CPU bound, rather than IO bound. Requests took 4 seconds. I tried with 32 concurrent processes, requests took 8 seconds. I guess that makes sense.

MySQL had a few slow queries in the logs. The databases are small at the moment, I will check it every few months and probably increase the amount of memory it’s allowed to use as it grows.

This is just a quick look at tuning with a small amount of research, I didn’t look into reducing PHP’s memory usage, or Apache, other than limiting the number of processes it’s allowed to start. I’ll leave that for another day.

Related posts:

  1. lighttpd and fastcgi
  2. MySQL Admin
  3. Back To Apache
  4. WordPress Nginx Admin
  5. Phil Colbourn Writes About The Youtube Blackout

Post a Comment

Your email is never shared. Required fields are marked *

*
*