Thursday, September 17, 2009

Improved stat() performance on files on zfs

Bug ID: 6775100 stat() performance on files on zfs should be improved was fixed in snv_119.
I wanted to do a quick comparison between snv_117 and snv_122 on my workstation to see what kind of improvement there is. I wrote a small C program which does a stat() N times in a loop. This is of course a micro-benchmark. Additionally it doesn't cover a case if doing stat() on not cached entries in DNLC has been improved too.

So I run the program several times on each build after a fresh restart. These were the numbers I was getting on average:

snv_117/ZFS# ptime ./stat_loop test 1000000

real 1.941163151
user 0.219955617
sys 1.707997800

snv_122/ZFS# ptime ./stat_loop test 1000000

real 1.089193770
user 0.199055005
sys 0.889680683

snv_122/UFS# ptime ./stat_loop test 1000000

real 0.905696133
user 0.187513753
sys 0.716955921
This is over 40% improvement in performance of stat() on ZFS - nice.
Still stat() on UFS is faster by about 17%.

The fix could also help some very busy NFS servers :)
AFAIK it has not been backported to Solaris 10 so if you think you need it either go for Open Solaris or open a case with Sun's support and ask for a fix for S10.