How to reduce I/O on EC2 micro instance running wordpress

z c asked:

I have been running a very small wordpress site on Amazon EC2 for about 2 months, using the free tier micro instance.

I have been getting billed a few dollars each month for going over the disk I/O allowance.

I have looked into how I can reduce the disk I/O, and made some changes such add allowing browser caching of images by changing apache.conf, minimising images and plugins, etc.

I then added APC module to PHP. I expected this to reduce I/O a lot, but it seems to be making no difference.

APC status (apc.php):

vmstat output during the load of a single webpage:

It seems that there is I/O going on during the load of the webpage. I don’t understand why, since the PHP should be in the APC cache and the images are already cached in my browser.

My goal is to simply reduce I/O, and therefore cost. Is there anything I can do to achieve this? For example, is APC setup incorrectly or is there some other technique to avoid I/O?

(PS: W3TC wordpress plugin didnt work for me. I probably didn’t install it correctly – it locked me out of the site, overloaded the CPU and brought the site down.)

My answer:

We can see that your instance is running very low on memory, and is actually swapping. This is disk I/O for which you’ll get billed, and also causes your site to run slower.

Free up some memory by stopping unnecessary processes and tuning your web server to run fewer workers (e.g. Apache or php-fpm).

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.