mpartel / bindfs

Mount a directory elsewhere with changed permissions.
https://bindfs.org/
GNU General Public License v2.0
449 stars 64 forks source link

Bindfs adding delay while copying the files #118

Closed nmanchinn closed 1 year ago

nmanchinn commented 2 years ago

Issue Type: Bug Version: 1.14.7 OS: Linux Distribution: Debian stretch

We are trying to use bindfs and observed the bindfs performance overhead.

My observations are detailed below:

( observations taken from a simple filesystem (SSD), users are local to the machine and a decent hardware allocation - 4cpu, 16GB RAM )


Create a 1K file for copying

$ dd if=/dev/zero of=/tmp/file1.txt count=1000 bs=1k 1024000 bytes (1.0 MB, 1000 KiB) copied, 0.015898 s, 64.4 MB/s

create test folders

$ mkdir /tmp/test1 /tmp/test1a /tmp/test1b

copy to a local folder

$ cd /tmp/test1; rm -rf foo; mkdir foo; time for i in {1..500}; do cp /tmp/file1.txt foo/file$i.txt; done real 0m1.150s

do a bindfs mount

$ /usr/bin/bindfs -o '' '/tmp/test1' '/tmp/test1a'

copy to a bindfs mount

$ cd /tmp/test1a; rm -rf foo; mkdir foo; time for i in {1..500}; do cp /tmp/file1.txt foo/file$i.txt; done real 0m8.412s

copy to a bindfs mount, additional flags

$ /usr/bin/bindfs -o '' '/tmp/test1' '/tmp/test1b' --read-rate=1T --write-rate=1T $ cd /tmp/test1b; rm -rf foo; mkdir foo; time for i in {1..500}; do cp /tmp/file1.txt foo/file$i.txt; done real 0m17.849s


Note: It's even slow when we share the bindfs from a different fuse mount

Please let me know if you need more details. Thanks in advance!

mpartel commented 2 years ago

It is surprising that the rate limiting flags have such a large impact. That appears to be a bug.

Other than that, it doesn't surprise me that bindfs is by default quite a bit slower than direct filesystem access. Some overhead will always be unavoidable, but I think some of it is due to various caches being disabled, because the source directory's content can in general change independently. You can experiment with the flags documented in man mount.fuse.

Also, Debian Stretch is quite old and has only FUSE 2, but FUSE 3 comes with new perormance-related options, such as writeback_cache.

If you're interested, you can also compare bindfs performance to the example passthrough filesystems that come with FUSE (called fusexmp_fh in the FUSE 2 branch). I'd expect them to be similar, given the same caching flags.

nmanchinn commented 2 years ago

Thank you for the quick response. I will experiment with few fuse flags to see if there are any differences. I will share my findings soon.

nmanchinn commented 1 year ago

Hi Martin,

Thank you for the suggestion and apologies for getting back to you late. Please find our findings below:

These results are not averages and might have some margin of error. However, they are enough to say FUSE 3 is yielding better performance than the default binary available on Debian 11, so thank you for the suggestion!

Also, I'm wondering if bindfs can be compiled and statically linked with libfuse3 and released to apt-get?

mpartel commented 1 year ago

It's interesting that FUSE 3 has such a large impact. Thanks for following up!

Also, I'm wondering if bindfs can be compiled and statically linked with libfuse3 and released to apt-get?

Debian will almost certainly not accept such a change for the stable distro, but for unstable it might. (Static linking is probably unnecessary and counterproductive in this case.)