Speed up laptop boot & resume times with large MySQL databases

Friday, May 4th, 2007

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!

Inspiron 5150 Owners - rejoice!

Friday, October 20th, 2006

I got a letter on Friday telling me that my just-past-extended-warranty Dell Inspiron 5150 that died of overheating would be repaired for free by Dell. Apparently, they decided to settle the class action lawsuit, rather than fight the legal battle (which they would have lost, as my overheated lap and broken computer can attest).

So instead of a painful call to technical support involving a woman trying to sell me a new battery (hint: when the computer won’t start with or without the battery, it’s probably not the battery), I told them to send me a box, and they said “OK.”

So, about that “working perfectly”

Monday, October 9th, 2006

Well, I have to admit that I was blinded by love for my laptop. But when I said that 1920×1200 was working perfectly on my Inspiron 9400, I was wrong. I didn’t even really check - it just looked sooo good.

But then I went to take a screenshot of the next generation of SAGrader, running for the first time under Linux, and noticed a strangely… smaller screenshot than I expected. About 320 pixels smaller, horizontally speaking.

To make a long story short, to get 1920×1200 instead of 1600×1200, I needed to add a Modeline to X.org. Add this in your Monitor Section:

# 1920×1200 @ 60.00 Hz (GTF) hsync: 74.52 kHz; pclk: 193.16 MHz
Modeline “1920×1200″ 193.16 1920 2048 2256 2592 1200 1201 1204 1242 -HSync +Vsync

And make sure that your Screen section contains an entry for “1920×1200″. Then restart your X server - viola! - instant screen real estate.

Edit: I also needed the 915resolution package installed, but I didn’t have to edit any startup files.

Dell Inspiron 9400 with Ubuntu Dapper Drake

Sunday, October 1st, 2006

A few weeks ago I bought a new Dell Inspiron 9400 laptop after my three year old Dell died, 37 days out of warranty. I was running Dapper on that laptop, and I wanted to continue that with this new machine.

The good news: everything works. (Intel) Wireless, Bluetooth, CD/DVD burning, suspend, hibernate, touchpad, brightness dimming, all of the special buttons, USB. I haven’t tried the modem, but I don’t really care about it.

I picked the Intel 945 graphics, so I’m running the experimental xserver-xorg-air-core Xserver. That means that all of the shiny wobbly windows and compositing work well too. However, be sure to switch back to metacity (the default GNOME window manager) before attempting the Quit Gnome screen - the screen becomes active, but it doesn’t work with the compositing so you can never see it. Also, if you use the suspend or hibernate buttons with compiz, usually the system won’t come back - again, switch to metacity using compiz-manager before suspending or hibernating.

Graphics-wise, I was worried that I’d have trouble with the WUXGA screen (1920×1200) on this laptop, but that hasn’t been the case - it worked out of the box with Dapper.

The centrino CPU frequency scaling works well. I went for the Core 2 Duo, so I have independant control of frequencies and frequency governors on the two CPU cores. Thermal monitoring works, so I can get neat graphs.

Altogether, I definitely recommend this configuration to anyone who wants a capable Ubuntu laptop.