Since the file creation ops will go through the kernel as well, won't
that clear the negative hit as well?
Please see below.
On Qui, 2008-07-03 at 02:39 -0700, Rudd-O wrote:
> The way to enable caching of negative dentries, is to return success
> instead of ENOENT, but set up 'fuse_entry_param' like this:
>
> e.ino = 0;
> e.entry_timeout = BIG_VALUE;
>
> The ".ino = 0" will tell the kernel that the file doesn't exist, but
> the negative dentry can be cached for the given number of seconds.
>
(...)
> I assume that goes into zfsfuse_access or zfsfuse_access_helper
>
> Why does /* access events always reply_err */ ?
See /usr/include/fuse/fuse_lowlevel.h, search for "access".
You will see the list of valid replies only contains "fuse_reply_err".
> How to do the entry_timeout and ino = 0 part in the context of those
> functions?
To me, it looks like that reply must be sent in the lookup method, not
the access method.
See the patch below, it should do what Miklos said (warning: I've not
tested it at all).
BTW, sorry for being so absent lately, but it's been quite difficult for
me to find time and energy to work on zfs-fuse. I am planning to write a
post this weekend on the zfs-fuse blog about this.
Also, thanks for all the effort you have been spending with this
project, your comments and observations have been very helpful, even if
they haven't translated into concrete improvements yet.
Best regards,
Ricardo
I've tried your negative dentry cache test, but it looks like the vast
majority of lookups are for existing dentries, not negative ones.
You can see this for yourself by adding ",debug" to FUSE_OPTIONS in
zfs-fuse/util.c and starting zfs-fuse with the --no-daemon option. You
can also add the following line to zfs_operations.c right at the start
of function zfsfuse_lookup() in order to see which dentries are being
looked up:
fprintf(stderr, "Looking up %s\n", name);
Anyway, my previous patch was not correct, please revert it and try
applying the attached patch, it should cache negative dentries correctly
now.
Note that it probably won't have much impact in performance in your test
because most of the lookups seem to be for existing dentries. I suspect
it might be because os.walk() is stat()ing files, but I haven't verified
if that's the case.
HTH,
Ricardo
Right.
I was referring to the negative lookups (second code block).
Even if you run only that code block, you will see that zfs-fuse
receives lots of LOOKUP requests from FUSE which are answered with a
successful return code (because they are lookups for existing files).
> How did I miss the missing error = 0 earlier? *slaps forehead*
I'm not sure what you mean by this, note that the patches are different.
The error = 0 in this patch is necessary because we cannot return
ENOENT.
Cheers,
Ricardo
> Done. Just posted cache-dentries.diff to the group. With this,
> perftest (and KDE applications in general, once their icons are warm
> in cache) start almost just as fast in ext3 as in ZFS.
I'd be more than happy to test this on my system here, every night (well,
assuming I remember) I run a script called zsnapshot which effectively
does an rsync to a ZFS filesystem and then snapshots it.
Just need the patch to appear here! :-)
cheers,
Chris
--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC
This email may come with a PGP signature as a file. Do not panic.
For more info see: http://en.wikipedia.org/wiki/OpenPGP
Yes, I was a bit confused at first too :)
Regarding the patch, please note that (if I'm not mistaken) caching
positive dentries may lead to a security flaw if your files or
directories have ACLs (e.g., if you have set them on Solaris), because
zfs-fuse will no longer check for access permission on lookups.
Best regards,
Ricardo
> The patch is on the file list here:
Wow. Last night the rsync took 39 minutes for /home (no major changes I
think, just email going in and out), this morning it took 11 minutes
(again, just email changes).
Just one data point, but it'll be really interesting to see how that
carries on over the next few days with more major stuff going on.
I'll try a bonnie++ just in case it shows anything new.
cheers!
> Wow. Last night the rsync took 39 minutes for /home (no major changes
> I think, just email going in and out), this morning it took 11 minutes
> (again, just email changes).
A better data point would have been my local Subversion repo (372MB).
Yesterday (no changes):
0.01user 0.13system 0:02.48elapsed 5%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+925minor)pagefaults 0swaps
Today (no changes):
0.02user 0.03system 0:00.55elapsed 9%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+925minor)pagefaults 0swaps
> Two steps forward, one step back. The most problematic userspace VFS
> syscall is access() with KDE apps. And that is precisely the
> operation that is not consistently sped up by the cache-dentries.diff
> patch.
>
> Three sequential runs:
>
> [root@karen /]# /backups/perftest a /usr/share/icons
> Positive dentry cache test - existent icon lookup
> File /usr/share/icons: speedup is 1.84371723682
> Negative dentry cache test - missing icon lookup
> File /usr/share/icons: speedup is 1.88145126374
> [root@karen /]# /backups/perftest a /usr/share/icons
> Positive dentry cache test - existent icon lookup
> File /usr/share/icons: speedup is 0.904757233292
> Negative dentry cache test - missing icon lookup
> File /usr/share/icons: speedup is 0.934242021794
> [root@karen /]# /backups/perftest a /usr/share/icons
> Positive dentry cache test - existent icon lookup
> File /usr/share/icons: speedup is 1.18232543167
> Negative dentry cache test - missing icon lookup
> File /usr/share/icons: speedup is 0.967109159875
For comparison here are the ext3 and ntfs-3g averaged numbers
running this test:
ext3 ntfs-3g
Positive dentry cache speedup: 11 33
Negative dentry cache speedup: 12 28
Runtime in second (wall-time): 11 29
The ntfs-3g CPU usage was well under 10% and the reason for the worse
performance is the unoptimal placing/handling of the many files on the
disk, i.e. the most time is spent waiting to finish disk seeks (this issue
is optimized for ext3 but not yet for ntfs-3g). Testing with an SSD could
give a significantly different result in favour of the FUSE file system.
Szaka
--
NTFS-3G: http://ntfs-3g.org