[Bugs] [Bug 1478411] Directory listings on fuse mount are very slow due to small number of getdents () entries

bugzilla at redhat.com bugzilla at redhat.com
Sun Sep 17 00:01:08 UTC 2017


https://bugzilla.redhat.com/show_bug.cgi?id=1478411

nh2 <nh2-redhatbugzilla at deditus.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|needinfo?                   |



--- Comment #9 from nh2 <nh2-redhatbugzilla at deditus.de> ---
I have now written a kernel patch for fuse that makes the readdir use 32 pages
(128 KiB) instead of 1 page (4 KiB):

  https://github.com/nh2/linux/commit/bedbf74a1a6d2958e719ed77a6a4f0baac79deab

(on my branch https://github.com/nh2/linux/compare/v4.9-fuse-large-readdir).

For sshfs (another FUSE program) this brings an immediate improvement:

With 1M files prepared like this:


  mkdir sshfsmount-1M sshfsdir-1M
  cd sshfsdir-1M
  seq 1 1000000 | xargs touch
  cd ..
  sshfs localhost:sshfsdir-1M sshfsmount-1M


and my example program adapted from the getdents() man page (code here:
https://gist.github.com/nh2/6ebd9d5befe130fd6faacd1024ead3d7) I get an
immediate improvement for `./getdents-silent sshfsmount-1M/`:

Without kernel patch (1 page): 0.267021
With 32-page kernel patch:     0.179651

(You have to run twice in quick succession to get these results, because sshfs
discards its cache very quickly and we want to measure FUSE syscall overhead,
not it fetching the data over sshfs. If you wait too long it may take a minute
for a full fetch.)

That's a 1.5x speedup for the entire program run; but because sshfs does some
initialisation work, we should look at the actual strace outputs instead:

Without kernel patch (1 page):

# strace -tttT -f -e getdents ./listdir-silent sshfsmount-1M/
1505605898.572720 getdents(3, /* 128 entries */, 131072) = 4064 <47.414827>
1505605945.992171 getdents(3, /* 128 entries */, 131072) = 4096 <0.000036>
1505605945.992311 getdents(3, /* 128 entries */, 131072) = 4096 <0.000031>

With 32-page kernel patch:

# strace -tttT -f -e getdents ./listdir-silent sshfsmount-1M/
1505605890.435250 getdents(3, /* 4096 entries */, 131072) = 130776 <60.054614>
1505605950.494406 getdents(3, /* 4096 entries */, 131072) = 130736 <0.000153>
1505605950.494693 getdents(3, /* 4096 entries */, 131072) = 130728 <0.000157>

Here you can see first the initial fetching work (depends on what's in SSHFS's
cahe at that point), and then the real syscalls.

Using 32 pages has increased the bytes per syscall by 32x, and the time by ~5x,
so it's approximately:

  6x faster

So landing such a patch seems beneficial to remove syscall overhead.

It would certainly help SSHFS cached directory listings.

Next, back to gluster.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list