Speed up laptop boot & resume times with large MySQL databases

A Tech article with View Comments posted 4 May 2007.
Tags: , ,

I’m in the interesting position of using my laptop for both programming work and day-to-day web surfing. I’m the lead developer for SAGrader, a web-based computationally intelligent essay grading system. We use MySQL for the database, and naturally I run a copy on my laptop to develop with. Unfortunately, MySQL and laptop power-saving goes together like chocolate and arsenic.

Ubuntu solves this problem by stopping MySQL on each suspend and starting it again on each resume. This is horribly bad for performance if you have a large database like I do because each MySQL server startup incurs almost a minute of mysqlcheck running. Rather than disable this, here’s a way to make it hurt less.

  1. Install the schedutils package: sudo aptitude install schedutils
  2. Modify /etc/mysql/debian-start and change the “MYCHECK=…” link to this: MYCHECK="ionice -c3 /usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
  3. Restart the MySQL server to observe the effects

As long as you are using the CFQ kernel scheduler (default on Ubuntu Edgy and newer kernels), ionice can set mysqlcheck’s IO priority to idle, which means your laptop is much more responsive much sooner. Well worth the effort in my opinion!

You might also enjoy:

  1. Crank up your Ubuntu
  2. Fixing segmentation fault in apt upgrade
  3. Koine Greek in Ubuntu Gutsy Gibbon
  4. Installing BackupPC on OpenWRT
  5. Fixing Broken WiFi on Inspiron 9400 in Ubuntu Karmic

    blog comments powered by Disqus