2009-09-27 12:27:54

by wbrana

[permalink] [raw]
Subject: ext4/reiser3/btr directory create/read perf

Hello,

I executed benchmark which creates and reads 10000 directories.
It is much slower with ext4 than with reiser3 or btrfs.

ext4 without dir_index
void cfs::vdirs_create(): 7754 msec
void cfs::vdirs_read(): 3363 msec

reiser3
void cfs::vdirs_create(): 1173 msec
void cfs::vdirs_read(): 421 msec

btrfs
void cfs::vdirs_create(): 1331 msec
void cfs::vdirs_read(): 567 msec

MD RAID10-f2, 64 kB chunk size

Source code:
http://www.sendspace.com/file/bconaa
depends on Qt Core, has hard-coded paths


2009-09-28 14:29:03

by Theodore Ts'o

[permalink] [raw]
Subject: Re: ext4/reiser3/btr directory create/read perf

On Sun, Sep 27, 2009 at 02:27:55PM +0200, [email protected] wrote:
> Hello,
>
> I executed benchmark which creates and reads 10000 directories.
> It is much slower with ext4 than with reiser3 or btrfs.

What precisely is your benchmark doing/measuring? What are the times
if you enable dir_index?

- Ted

2009-09-30 19:05:56

by wbrana

[permalink] [raw]
Subject: Re: ext4/reiser3/btr directory create/read perf

On Mon, Sep 28, 2009 at 4:29 PM, Theodore Tso <[email protected]> wrote:
> On Sun, Sep 27, 2009 at 02:27:55PM +0200, [email protected] wrote:
>> Hello,
>>
>> I executed benchmark which creates and reads 10000 directories.
>> It is much slower with ext4 than with reiser3 or btrfs.
>
> What precisely is your benchmark doing/measuring?  What are the times
> if you enable dir_index?
>
>                                        - Ted
>

I reduced benchmark to 10 directories and executed with strace

ext4
void cfs::vdirs_create(): 1047 msec
void cfs::vdirs_read(): 123 msec

vdirs_create():

mkdir("/mnt/md8/4", 0777) = 0
mkdir("/mnt/md8/3", 0777) = 0
mkdir("/mnt/md8/2", 0777) = 0
mkdir("/mnt/md8/1", 0777) = 0
mkdir("/mnt/md8/0", 0777) = 0
sync() = 0


vdirs_read():
QDir::entryInfoList() measured

stat("/mnt/md8", {st_dev=makedev(9, 8), st_ino=2,
st_mode=S_IFDIR|0755, st_nlink=8, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:29,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
lstat("/mnt/md8", {st_dev=makedev(9, 8), st_ino=2,
st_mode=S_IFDIR|0755, st_nlink=8, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:29,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
open("/mnt/md8", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 10
fstat(10, {st_dev=makedev(9, 8), st_ino=2, st_mode=S_IFDIR|0755,
st_nlink=8, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8,
st_size=4096, st_atime=2009/09/30-20:42:29,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
fcntl(10, F_GETFD) = 0x1 (flags FD_CLOEXEC)
statfs("/mnt/md8", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096,
f_blocks=15484285, f_bfree=15438246, f_bavail=14651667,
f_files=3940352, f_ffree=3940336, f_fsid={-1324527978, -609145826},
f_namelen=255, f_frsize=4096}) = 0
getdents(10, {{d_ino=16386, d_off=399366477, d_reclen=24, d_name="1"}
{d_ino=8194, d_off=770605380, d_reclen=24, d_name="3"} {d_ino=11,
d_off=783174169, d_reclen=32, d_name="lost+found"} {d_ino=2,
d_off=1078596639, d_reclen=24, d_name="."} {d_ino=2, d_off=1358450504,
d_reclen=24, d_name=".."} {d_ino=8193, d_off=174337
5275, d_reclen=24, d_name="4"} {d_ino=16385, d_off=1786832028,
d_reclen=24, d_name="2"} {d_ino=24577, d_off=2147483647, d_reclen=24,
d_name="0"}}, 4096) = 200
stat("/mnt/md8/1", {st_dev=makedev(9, 8), st_ino=16386,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/1", {st_dev=makedev(9, 8), st_ino=16386,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/3", {st_dev=makedev(9, 8), st_ino=8194,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/3", {st_dev=makedev(9, 8), st_ino=8194,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/lost+found", {st_dev=makedev(9, 8), st_ino=11,
st_mode=S_IFDIR|0700, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=32, st_size=16384, st_atime=2009/09/30-20:42:29,
st_mtime=2009/09/30-20:42:29, st_ctime=2009/09/30-20:42:29}) = 0
stat("/mnt/md8/lost+found", {st_dev=makedev(9, 8), st_ino=11,
st_mode=S_IFDIR|0700, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=32, st_size=16384, st_atime=2009/09/30-20:42:29,
st_mtime=2009/09/30-20:42:29, st_ctime=2009/09/30-20:42:29}) = 0
stat("/mnt/md8/.", {st_dev=makedev(9, 8), st_ino=2,
st_mode=S_IFDIR|0755, st_nlink=8, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:29,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/.", {st_dev=makedev(9, 8), st_ino=2,
st_mode=S_IFDIR|0755, st_nlink=8, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:29,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/..", {st_dev=makedev(9, 2), st_ino=16,
st_mode=S_IFDIR|0755, st_nlink=36, st_uid=0, st_gid=0,
st_blksize=4096, st_blocks=1, st_size=952,
st_atime=2008/09/14-18:00:33, st_mtime=2009/09/19-17:44:10,
st_ctime=2009/09/19-17:44:10}) = 0
stat("/mnt/md8/..", {st_dev=makedev(9, 2), st_ino=16,
st_mode=S_IFDIR|0755, st_nlink=36, st_uid=0, st_gid=0,
st_blksize=4096, st_blocks=1, st_size=952,
st_atime=2008/09/14-18:00:33, st_mtime=2009/09/19-17:44:10,
st_ctime=2009/09/19-17:44:10}) = 0
stat("/mnt/md8/4", {st_dev=makedev(9, 8), st_ino=8193,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/4", {st_dev=makedev(9, 8), st_ino=8193,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/2", {st_dev=makedev(9, 8), st_ino=16385,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
getdents(10, {}, 4096) = 0
close(10) = 0
stat("/mnt/md8/2", {st_dev=makedev(9, 8), st_ino=16385,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0
stat("/mnt/md8/0", {st_dev=makedev(9, 8), st_ino=24577,
st_mode=S_IFDIR|0755, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=8, st_size=4096, st_atime=2009/09/30-20:42:45,
st_mtime=2009/09/30-20:42:45, st_ctime=2009/09/30-20:42:45}) = 0


Times with 10000 directories and dir_index enabled

/mnt/md8: 64 kB chunks
ext4
void cfs::vdirs_create(): 4996 msec
void cfs::vdirs_read(): 5100 msec


Times with 10000 files and dir_index enabled

/mnt/md8: 64 kB chunks
reiser3
void cfs::vfiles_create(): 1239 msec
void cfs::vdirs_read(): 409 msec
ext4
void cfs::vfiles_create(): 1464 msec
void cfs::vdirs_read(): 501 msec
btrfs
void cfs::vfiles_create(): 1295 msec
void cfs::vdirs_read(): 585 msec

2009-09-30 19:44:04

by wbrana

[permalink] [raw]
Subject: Re: ext4/reiser3/btr directory create/read perf

On Wed, Sep 30, 2009 at 9:05 PM, <[email protected]> wrote:
> I reduced benchmark to 10 directories and executed with strace
I meant 5 directories.

>
> Times with 10000 directories and dir_index enabled
>
> /mnt/md8: 64 kB chunks
> ext4
> void cfs::vdirs_create(): 4996 msec
> void cfs::vdirs_read(): 5100 msec
>

Times with 1000 directories and dir_index enabled
/mnt/md8: 64 kB chunks
reiser3
void cfs::vdirs_create(): 973 msec
void cfs::vdirs_read(): 60 msec
ext4
void cfs::vdirs_create(): 2435 msec
void cfs::vdirs_read(): 3326 msec
btrfs
void cfs::vdirs_create(): 1036 msec
void cfs::vdirs_read(): 155 msec

ext4 was 55 times slower than reiser3 in vdirs_read()

2009-09-30 22:34:48

by Theodore Ts'o

[permalink] [raw]
Subject: Re: ext4/reiser3/btr directory create/read perf

On Wed, Sep 30, 2009 at 09:44:04PM +0200, [email protected] wrote:
>
> Times with 1000 directories and dir_index enabled
> /mnt/md8: 64 kB chunks
> reiser3
> void cfs::vdirs_create(): 973 msec
> void cfs::vdirs_read(): 60 msec
> ext4
> void cfs::vdirs_create(): 2435 msec
> void cfs::vdirs_read(): 3326 msec
> btrfs
> void cfs::vdirs_create(): 1036 msec
> void cfs::vdirs_read(): 155 msec
>
> ext4 was 55 times slower than reiser3 in vdirs_read()

On a micro brenchmark, simply creating an empty directory will much
faster in pure b-tree oriented filesystems, since it's just a node
insert. So yes, reiser3 will always be faster for mkdir(), and
there's not much that can be done about it.

I suppose we could implement XFS-style short-form directories (where
the directory is stored in i_blocks, which would work for directories
with 4 or fewer directory entries with short names), but it's not
clear it's really worth it, since in practice, there are very few
directories that have really small number of entries, and there's a
lot more regarding real-world performance than just creating empty
directories.

- Ted