not idle

Linux speed up

by Mariano Cecowski

There has been an interesting discussion in the kernel mailing list on a subject that even though is not new, it never hit the masses because of ignorance and misjudgment. After all, anyone setting up a Linux server probably already makes use of the noatime fstab option whenever possible. atime is the culprit of writing to disk the last access timestamp to every file read, what becomes in a huge disk overhead and in-memory cache killer.

But the speed-up is not without side effects, and that’s why it probably never took off. Some programs (specially notification ones such as “new mail”,and some backup applications) relay on the last-read timestamp, and might not work properly without this option. A relative improvement over the current atime implementation is relatime, which is already available, in some distributions such as Ubuntu Hardy, that doesn’t break the atime functionality, but still has some overhead.

Nevertheless, you can safely use the noatime mount option for most purposes achieving a very interesting speed boost, specially in read-intensive or read/write-intensive processes such as compilation or backup, with reported speed-ups of between 10% to 50%.

Here is what to do:

  • sudo cp /etc/fstab /etc/fstab.backup
  • sudo “edit” /etc/fstav (where edit is either vim, nano, gedit, mousepad, or your favourite editor)
  • for every ext3, add the noatime and data=writeback properties: (i.e. defaults,errors=remount-ro,noatime,data=writeback)
  • reboot.
  • if you have any problems, revert back your fstab with “sudo cp /etc/fstab.backup /etc/fstab”

Furthermore, there’s the option of partitioning your disk in order to have different mounting points for your disk intensive stuff (source code, programs with numerous small files, etc) and your (probably less disk intensive) atime-dependent files such as mutt’s. Thus, you can have most of your stuff in a “noatime” mounted partition, and still have all your atime-dependent applications working just fine. (thought this might be complicated, as you are not splitting “home” in two…)

Anyhow, the speed boost is worth the try.

4 Responses to “Linux speed up”

  1. Tested with reiserfs

    defaults mount: read of 1000 small files from random 500000 took 37 seconds

    defaults,noatime,notail:read of 1000 small files from random 500000 took 16 seconds

    Damjan Pipan

  2. Thanks Damjan!
    I didn’t expect such an improvement on reiser, thought it was more of an ext3 thing, but it’s always good to know.

    And if you think of how many little icons are read every time you use something in GNOME, you realize this is not just a Servers’ thing…

    Mariano Cecowski

  3. “edit” can only be one: emacs!

    jaKa

  4. [...] going to dig a bit on the threaded-reads regression; I think I'll mount my partition with "noatime” and try running the tests again; will keep you [...]

    XLAB Tech » Blog Archive » Ubuntu 9.10 Karmic Koala – Should I update?

Leave a Reply