-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on btrfs, gocryptfs is significantly slower than encfs #63
Comments
Hi tyrak, thanks for the report! I definitely want gocryptfs to be fast on
hdds as well. I'll go find one and get back to you late next week, as I'm
abroad right now.
Gocryptfs uses 4kb blocks for writing and I expected the kernel to merge
them to bigger blocks before it hits the disk, but that's probably not good
enough on hdds.
|
Thanks for the quick reply. I did some further tests. As it turns out, the culprit is not the fact that I am using a (spinning) hard drive, but rather the file system I am using, namely
As you can see, |
This improves performance on hdds running ext4, and improves streaming write performance on hdds running btrfs. Tar extract slows down on btrfs for some reason. See #63
@tyrak I have pushed a change that coalesces small writes into bigger blocks now. If you get to it, please check out the "btrfs" branch and post the benchmark results. BTW benchmark.bash now takes a path argument :) |
Thanks for the patch. I tried it and the numbers have improved, but the
|
What gocrypts is doing differently than EncFS is that it preallocates the space before writing a block. This makes sure it does not run out of space in the middle of a write. I have timed how long that takes on ext4 and btrfs during the tar extract benchmark: ext4:
btrfs generally looks like this:
and every now and then I see sequences of this:
In summary, preallocation on btrfs is much slower than on ext4. And this is the reason gocryptfs is slow on btrfs. |
Preallocation is very slow on hdds that run btrfs. Give the user the option to disable it. This greatly speeds up small file operations but reduces the robustness against out-of-space errors. More info: #63
@tyrak I have just pushed another commit to the btrfs branch. It adds the Anyway, if you want to benchmark this, pull the btrfs branch and add In my testing, this gives a massive speedup. |
Awesome! I just tested it, and it makes |
This improves performance on hdds running ext4, and improves streaming write performance on hdds running btrfs. Tar extract slows down on btrfs for some reason. See #63 Benchmarks: encfs v1.9.1 ============ $ ./benchmark.bash -encfs /mnt/hdd-ext4 Testing EncFS at /mnt/hdd-ext4/benchmark.bash.u0g WRITE: 131072000 bytes (131 MB, 125 MiB) copied, 1,48354 s, 88,4 MB/s UNTAR: 20.79 LS: 3.04 RM: 6.62 $ ./benchmark.bash -encfs /mnt/hdd-btrfs Testing EncFS at /mnt/hdd-btrfs/benchmark.bash.h40 WRITE: 131072000 bytes (131 MB, 125 MiB) copied, 1,52552 s, 85,9 MB/s UNTAR: 24.51 LS: 2.73 RM: 5.32 gocryptfs v1.1.1-26-g4a7f8ef ============================ $ ./benchmark.bash /mnt/hdd-ext4 Testing gocryptfs at /mnt/hdd-ext4/benchmark.bash.1KG WRITE: 131072000 bytes (131 MB, 125 MiB) copied, 1,55782 s, 84,1 MB/s UNTAR: 22.23 LS: 1.47 RM: 4.17 $ ./benchmark.bash /mnt/hdd-btrfs Testing gocryptfs at /mnt/hdd-btrfs/benchmark.bash.2t8 WRITE: 131072000 bytes (131 MB, 125 MiB) copied, 6,87206 s, 19,1 MB/s UNTAR: 69.87 LS: 1.52 RM: 5.33 gocryptfs v1.1.1-32 =================== $ ./benchmark.bash /mnt/hdd-ext4 Testing gocryptfs at /mnt/hdd-ext4/benchmark.bash.Qt3 WRITE: 131072000 bytes (131 MB, 125 MiB) copied, 1,22577 s, 107 MB/s UNTAR: 23.46 LS: 1.46 RM: 4.67 $ ./benchmark.bash /mnt/hdd-btrfs/ Testing gocryptfs at /mnt/hdd-btrfs//benchmark.bash.XVk WRITE: 131072000 bytes (131 MB, 125 MiB) copied, 3,68735 s, 35,5 MB/s UNTAR: 116.87 LS: 1.84 RM: 6.34
Preallocation is very slow on hdds that run btrfs. Give the user the option to disable it. This greatly speeds up small file operations but reduces the robustness against out-of-space errors. Also add the option to the man page. More info: #63
Ok good. I have merged the changes to master and dropped the "btrfs" branch. |
Preallocation on Btrfs is broken ( #395 , https://lore.kernel.org/linux-btrfs/CAPv9Zmk46As_P9Gyf_icET53xRda63h7iC1meES9xbdDEt9qow@mail.gmail.com/ ) and slow ( #63 ).
Hi,
I just discovered this project and I am considering to use it to replace
encfs
, but it's write performance is significantly worse thanencfs
on my laptop. This is a sandy bridge laptop with a 5400 rpm (spinning) hard drive running 64-bit linux. I tried the provided precompiled binary for debian as well as compiling it myself (both with and without openssl support) and the results are very similar.Here are some benchmarks:
and
The text was updated successfully, but these errors were encountered: