Reducing iops on Amazon EC2 micro instance

I have Amazon EC2 micro server in Singapore. It has proven to be quite enough as my own playground. 

I just signed up for 3 year deal to reduce the CPU costs. 

 

The EC2 micro instance has 613MB of memory, which is not much, but seems to be enough. I have few drupal sites (drupal6 and drupal7), which are not quite optimized for CPU usage. Not a lot of load, about 800 hits per day.

  Overall it's fine, except one small thing. Amazon charges for i/o operations. Currently the rate is USD$0.11 per 1 million iops. 

 Earlier months, before optimization I used 55-70 million iops per month. USD6-8, which is not really much, but as the server itself costs about the same I consider this as an project to reduce the iops. 

 

 So far I have managed to reduce the iops to about 400.000 per day or about 12 million per month. Mainly following the advices given how to reduce disk writes on SSD's.

 

Steps which have been done for now. 

 

Tuning apache2 default settings /etc/apache2/apache2.conf

# prefork MPM
<IfModule mpm_prefork_module>
    StartServers          3
    MinSpareServers       2
    MaxSpareServers     5 
    MaxClients          15
    MaxRequestsPerChild   800
</IfModule>
# worker MPM
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      15
    MaxSpareThreads      25 
    ThreadLimit          32
    ThreadsPerChild      15
    MaxClients          15
    MaxRequestsPerChild  800
</IfModule>
# event MPM
<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      15
    MaxSpareThreads      25 
    ThreadLimit         32 
    ThreadsPerChild      15
    MaxClients          15
    MaxRequestsPerChild   800
</IfModule>
 
 

Earlier, these two settings dropped iops from 70M to 55M per month

- Create /tmpfs on RAM 

- adding noatime,noadirtime to fastab for / and /tmpfs 

 

During last weekend following steps, which reduced the iops to 12M per month (400.000/day)

- adding commit=60 for / which is using ext3 filesystem to /etc/fstab

LABEL=cloudimg-rootfs        /               ext3    noatime,nodiratime,defaults,commit=60        0       0
tmpfs /tmp tmpfs defaults,noexec,nosuid,mode=1777 0 0

- Lessening disk writes  and swappiness /etc/sysctl.conf

vm.dirty_ratio = 40

vm.dirty_background_ratio = 1

vm.dirty_writeback_centisecs = 6000

vm.swappiness = 10

 
- Adding boost module for drupal sites (speeded up the load times as well)
 
- Enlarged some mysql buffer sizes. (/etc/mysql/my.cnf)
innodb_log_buffer_size = 32M
tmp_table_size = 32M
max_heap_table_size = 32M
innodb_flush_log_at_trx_commit=2