Robert Milkowski
2009-Sep-17 17:12 UTC
[zfs-discuss] stat() performance on files on zfs vs. ufs
Hi,
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%.
Why stat() on the same file in a loop would be faster if file is on UFS compared
to ZFS?
# cat stat_loop.c
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
int main(int argc, char **argv)
{
int i;
int N;
struct stat buf;
if (argc != 3)
{
printf("usage: %s filename N\n", argv[0]);
exit(5);
}
N=atoi(argv[2]);
i=0;
while (i++ < N)
{
if (stat(argv[1], &buf))
{
printf("stat(%s,) failed.\n", argv[1]);
exit(6);
}
}
exit(0);
}
--
Robert Milkowski
http://milek.blogspot.com
--
This message posted from opensolaris.org
