Instant 10-20% boost in disk performance: the “noatime” option

Many people already know about this option, but it is worth mentioning again. However, a description of what atime is is in order.

The atime is one of the three times associated with a UNIX file: the three are: the ctime (or change time - that is, when the inode was last changed); the mtime (or modified time - that is, when the file is changed); and lastly, the atime (or access time).

It is the continual changes to the atime that cause so much grief. Compared to the mtime and the ctime, the atime changes with alarming frequency. Every single time a file is accessed, the atime is updated to match the current time – whether the file is opened, read, written, or accessed in any manner whatsoever.

There was a Linux kernel mailing list discussion thread that gave rise to some interesting quotes on this topic.

The discussion became quite heated when Ingo Molnar suggested that atime should be the kernel default. He had this to say:

Atime updates are by far the biggest IO performance deficiency that Linux has today. Getting rid of atime updates would give us more everyday Linux performance than all the pagecache speedups of the past 10 years, _combined_.

and:

It’s also perhaps the most stupid Unix design idea of all times. Unix is really nice and well done, but think about this a bit: ‘For every file that is read from the disk, lets do a … write to the disk! And, for every file that is already cached and which we read from the cache … do a write to the disk!’

and later, this:

Measurements show that noatime helps 20-30% on regular desktop
workloads, easily 50% for kernel builds and much more than that (in
excess of 100%) for file-read-intense workloads.

and, this:

Give me a Linux desktop anywhere and i can
tell you whether it has atimes on or off, just by clicking around and
using apps (without looking at the mount options). That’s how i notice
it that i forgot to turn off atime on any newly installed system – the
system has weird desktop lags and unnecessary disk trashing.

Linus had this to say:

yeah, it’s really ugly. But otherwise i’ve got no real complaint about
ext3 – with the obligatory qualification that “noatime,nodiratime” in
/etc/fstab is a must. This speeds up things very visibly – especially
when lots of files are accessed. It’s kind of weird that every Linux
desktop and server is hurt by a noticeable IO performance slowdown due
to the constant atime updates, while there’s just two real users of it:
tmpwatch [which can be configured to use ctime so it's not a big issue]
and some backup tools. (Ok, and mail-notify too i guess.) Out of tens of
thousands of applications. So for most file workloads we give Windows a
20%-30% performance edge, for almost nothing. (for RAM-starved kernel
builds the performance difference between atime and noatime+nodiratime
setups is more on the order of 40%)

Changing a file system to run without atime is simple; use this command on a mounted filesystem:

# mount -o remount,noatime /disk

Don’t forget to change the /etc/fstab to match this.

About these ads

8 Responses to Instant 10-208 boost in disk performance: the “noatime” option

  1. Dennis Jacobfeuerborn says:

    The information presented is quite outdated. The thread mentioned is from 2007 and most current distributions have since switched to use relatime as a default which makes the noatime modification unnecessary for most users.

  2. Craconiia says:

    Dennis: On my Fedora 14 box there’s no “relatime” on any of my partitions.

    1) If I type the “mount” comannd, the relatime option isn’t on any of the listed partitions.

    2) There’s just the “defaults” option in /etc/fstab. By looking at the man page for mount, I can expand the meaning of “defaults” and it isn’t there.

    3) Finally, by looking at the filesystem defaults (with tune2fs -l /dev/sda1) , relatime isn’t still there.

    I guess I’ll have to manually specify relatime in /etc/fstab

    • Matthew Willsher says:

      Relatime is a mount time option so yes, it is specific in the fstab (or via the -o mount option). The mount_ext3 (or mount_ext4) man page givens all the options. As already said relatine is a better option than noatime, especially for /var and /tmp where programs may use it for processing queues, cleaning caches and other operational.

  3. I hate to post a comment to an older posting but I thought I would post my opinion anyway :)

    I’m on the fence about atime and noatime. For my desktop I typically use noatime since I know what files I’m using and which ones are older. However, in my day job I also admin some HPC systems that can have large amounts of data. Given the option users will leave _all_ of their data on the system forevever. So having atime available on the system can help tell me when the data was last accessed. If it’s been a long time since it was last accessed I can make an argument for moving the data from fast expensive storage to something cheaper (about half to a third of the cost). Without atime I can only check when the file was created or modified – not accessed.

    I guess what I’m saying is that sometimes atime does come in handy although Ingo’s comment about the absurdity of writing to a file that you are only reading is a point well taken. But I would rather pay the penalty for having atime turned on so I can find out of the users are actually using the data :)

    Thanks!

    Jeff

    • ddouthitt says:

      Comments are always welcome!

      Some backup programs use atime; certainly it is very useful in forensics. I can understand what you mean.

      You could always partition the drive so that /home is separate, then turn off atime on selected partitions while leaving it on in the /home directory.

  4. Archie says:

    ctime means Creation Time

  5. TK Lee says:

    Hi,

    What I want to know is how to test for his 10-20% performance improvement. I tried recursively stat’ing a directory on a noatime mounted file system and I don’t see any difference compared to a regular atime mounted file system.

    I need to get some proof for this improvement.

    Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 43 other followers

%d bloggers like this: