Disabling atime

n0dalus n0dalus+redhat at gmail.com
Tue Aug 21 17:52:19 UTC 2007


On 8/22/07, Eric Sandeen <esandeen at redhat.com> wrote:
>
> As far as I'm concerned, nobody has done the necessary legwork to
> justify this change.
>
> I have at least one case where noatime actually slows things down.  With
> 66 million inodes on an ext3 filesystem, "find" across the filesystem
> with a fresh mount / cold cache was a few seconds slower with noatime.
> Odd result, but it shows at least that this change shouldn't be made
> based on a hunch, but only after looking at some real results.
>
> -Eric
>

Find will not benchmark atime, as it doesn't open the files for
reading. If you want to test it you would need to read the files as
well.

Out of curiosity, I ran some benchmarks:

# find /data -type f 2>/dev/null | wc -l
105602
# cat readblock.c
#include <unistd.h>
#include <fcntl.h>

int main(int argc, char **argv) {
    int i, fd;
    char buf[1024];
    for(i=1; i<argc; i++) {
        fd = open(argv[i], O_RDONLY);
        if(fd >= 0) {
            read(fd, buf, 1024);
            close(fd);
        }
    }
    return 0;
}
# make readblock
cc     moveblock.c   -o moveblock
# umount /data
# sync && echo 3 > /proc/sys/vm/drop_caches
# mount /data
# time find /data -type f -exec ./readblock '{}' '+'

real    7m28.955s
user    0m0.343s
sys     0m12.870s
# umount /data
# sync && echo 3 > /proc/sys/vm/drop_caches
# mount -o noatime /data
# time find /data -type f -exec ./readblock '{}' '+'

real    6m53.724s
user    0m0.327s
sys     0m12.023s

An 8% improvement, and that's with cleared caches. A bigger
improvement would be expected when there is cache hits, since it
doesn't have to read or write anything to the disk.

Reading a block or so from every file is not an uncommon operation. It
happens when you use grep, it happens when you load a directory in
nautilus (and all the file types are found by scanning the first block
of the file), it happens when you open your photo managing application
(thumbnails), and it happens when icons are loaded for menus. 8% makes
a difference in the desktop and on the server.

n0dalus.




More information about the fedora-devel-list mailing list