Speeding-up Drupal test-runs on Ubuntu 11.04

Submitted by fago on Fri, 07/15/2011 - 14:30
Using a ramdisk for MySQL helps *a lot* to speed up simpletests in Drupal, as well as disabling innodb as described on the according d.o. docu page. While the documentation provides an init.d script, Ubuntu 11.04 comes with an upstart script for MySQL. So I modified the instructions and come up with the following in order to put MySQL on a ramdisk on ubuntu 11.04 (and later): 1. Pre-pare everything
stop mysql
mkdir /var/lib/.mysql
chown -R mysql:mysql /var/lib/.mysql
rsync -a --delete /var/lib/mysql/ /var/lib/.mysql
# confirm files got copied!
rm -r /var/lib/mysql/*
2. Save the original upstart script at /etc/init/mysql.conf and replace it with the one attached to this post. 3. Start MySQL and make sure everything works!
start mysql
cd /var/lib/mysql #(to verify files moved back in)
df -h #(to verify tmpfs is mounted at /var/lib/mysql)
Once you run stop mysql the content of the ramdisk will be saved back to disk again.

Kristen Pol (not verified)

Sun, 06/17/2012 - 06:43

Fago! I'm so happy I found this... as a quick test I found that saving the permissions page went from around 12 seconds to 2 seconds! w00t! I'm a happy Drupaler today :)

Alan (not verified)

Fri, 07/06/2012 - 21:50

This is really awesome. Thank you very much Fago.

Alan (not verified)

Fri, 07/06/2012 - 21:50

This is really awesome. Thank you very much Fago.

Mark Ferree (not verified)

Fri, 07/27/2012 - 20:38

The speed improvements are incredible, but for whatever reason the post-stop portion of the mysql conf wasn't working for me, which meant losing everything that happened since mysql started. I threw that into a shutdown script and everything worked swimmingly after that.

Mark Ferree (not verified)

Fri, 07/27/2012 - 20:39

The speed improvements are incredible, but for whatever reason the post-stop portion of the mysql conf wasn't working for me, which meant losing everything that happened since mysql started. I threw that into a shutdown script and everything worked swimmingly after that.

Mark Ferree (not verified)

Fri, 07/27/2012 - 20:39

The speed improvements are incredible, but for whatever reason the post-stop portion of the mysql conf wasn't working for me, which meant losing everything that happened since mysql started. I threw that into a shutdown script and everything worked swimmingly after that.