XFS for lots of small files

Leszek Dubiel
2008-05-06T16:11:20Z

Hello!

I consider moving server from reiserfs to xfs. In all benchmarks I have
read both file systems have had comparable results.

But I've made a test:

1. formated /dev/hda2 with reiserfs with default options and made 10.000
files
2. formated /dev/hda2 with xfs with default options and made 10.000

Reiserfs created those files in 2 (two) seconds, and xfs created them in
35 (thirty five) seconds.

Is that normal? What I am doing wrong?

My system is Debian, current stable version. Below is a log of operation.

Thanks in advance.

debian:/mnt/hdc2# mkfs.xfs /dev/hdc2 -f; mount /dev/hdc2 /mnt/hdc2; cd /mnt/hdc2; mount | egrep hdc2
meta-data=/dev/hdc2 isize=256 agcount=16, agsize=1220688 blks
= sectsz=512 attr=0
data = bsize=4096 blocks=19531008, imaxpct=25
= sunit=0 swidth=0 blks, unwritten=1
naming =version 2 bsize=4096
log =internal log bsize=4096 blocks=9536, version=1
= sectsz=512 sunit=0 blks
realtime =none extsz=65536 blocks=0, rtextents=0
/dev/hdc2 on /mnt/hdc2 type xfs (rw)

debian:/mnt/hdc2# time for f in `seq 9999`; do echo $f > $f; done

real 0m35.558s
user 0m0.256s
sys 0m1.080s

debian:/mnt/hdc2# time cat * | wc -l
9999

real 0m0.239s
user 0m0.020s
sys 0m0.172s

debian:/mnt/hdc2# cd /; umount /dev/hdc2; mkreiserfs /dev/hdc2 -f; mount /dev/hdc2 /mnt/hdc2; cd /mnt/hdc2; mount | egrep hdc2
mkreiserfs 3.6.19 (2003 www.namesys.com)
[...]
ReiserFS is successfully created on /dev/hdc2.
/dev/hdc2 on /mnt/hdc2 type reiserfs (rw)

debian:/mnt/hdc2# time for f in `seq 9999`; do echo $f > $f; done

real 0m1.075s
user 0m0.232s
sys 0m0.844s

debian:/mnt/hdc2# time cat * | wc -l
9999

real 0m0.257s
user 0m0.028s
sys 0m0.256s

debian:/mnt/hdc2# exit