From fe43f535285d7cf571760df05cf13a25b01aff4f Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 12 Jun 2021 17:01:51 +0200 Subject: [PATCH] mount: enable fuse readahead Apparently readahead was disabled by default. Enable readahead with the Linux default size of 128kB. Larger values seem to have no effect. This can speed up reading from the fuse mount by at least factor 5. Speedup for a 1G random file stored in a local repository: (Only one result shown, but times were quite stable, restarted restic after each command) $ dd if=/dev/urandom bs=1M count=1024 of=rand $ shasum -a 256 tmp/rand 75dd9b374e712577d64672a05b8ceee40dfc45dce6321082d2c2fd51d60c6c2d tmp/rand before: $ time shasum -a 256 fuse/snapshots/latest/tmp/rand 75dd9b374e712577d64672a05b8ceee40dfc45dce6321082d2c2fd51d60c6c2d fuse/snapshots/latest/tmp/rand real 0m18.294s user 0m4.522s sys 0m3.305s before: $ time cat fuse/snapshots/latest/tmp/rand > /dev/null real 0m14.924s user 0m0.000s sys 0m4.625s after: $ time shasum -a 256 fuse/snapshots/latest/tmp/rand 75dd9b374e712577d64672a05b8ceee40dfc45dce6321082d2c2fd51d60c6c2d fuse/snapshots/latest/tmp/rand real 0m6.106s user 0m3.115s sys 0m0.182s after: $ time cat fuse/snapshots/latest/tmp/rand > /dev/null real 0m3.096s user 0m0.017s sys 0m0.241s --- cmd/restic/cmd_mount.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 2dc5367ce..893e9d708 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -122,6 +122,7 @@ func runMount(opts MountOptions, gopts GlobalOptions, args []string) error { mountOptions := []systemFuse.MountOption{ systemFuse.ReadOnly(), systemFuse.FSName("restic"), + systemFuse.MaxReadahead(128 * 1024), } if opts.AllowOther {