# Max Pages on Linux with rClone/MergerFS

**URL:** <https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724>\
**Category:** Help and Support\
**Created:** [November 2, 2019, 11:59am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724 "2019-11-02T11:59:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [November 2, 2019, 11:59am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/1 "2019-11-02T11:59:17Z")

</div>

@trapexit - I saw you had a pull request for this:

> <https://github.com/trapexit/mergerfs/pull/636>

which moves the 128K up to 1M, but I wasn't sure how to take advantage of that. Is that something that both mergerfs and rclone can take advantage of a kernel newer than 4.20?

That would seem to greatly speed up sequential reads as it would remove a number of calls.

---

<div class="post-metadata">

**Author:** ![trapexit](https://forum.rclone.org/user_avatar/forum.rclone.org/trapexit/32/423_2.png) [@trapexit](https://forum.rclone.org/u/trapexit)\
**Post date:** [November 2, 2019, 1:58pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/2 "2019-11-02T13:58:52Z")

</div>

It needs support in the underlying communication to the kernel. mergerfs will inform the kernel to use 1MB if the kernel says it's supported. It's configurable to allow comparison and testing.

rclone would need to explicitly support it. Not sure what it uses to talk to the kernel but that would need to set the correct flags at the FUSE init stage (and allocate enough memory for incoming buffers).

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [November 2, 2019, 2:04pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/3 "2019-11-02T14:04:31Z")

</div>

@ncw - is that something to look at for rclone?

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [November 2, 2019, 3:00pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/4 "2019-11-02T15:00:37Z")

</div>

Rclone uses

> **[bazil/fuse](https://github.com/bazil/fuse)**
>
> FUSE library for Go.  go get bazil.org/fuse  . Contribute to bazil/fuse development by creating an account on GitHub.

as its fuse library on Linux. I have to say it is looking a bit unmaintained with only 2 commits since 2016 ☹

It does not appear to allow setting of max\_pages.

The alternative library is this one and there is an issue by our very own @darthShadow about this

> <https://github.com/hanwen/go-fuse/issues/309>
>
> Since the Linux Kernel has increased the max allowed write from 128 KB to 1 MB from version 4.20, can this...

I have an experimental branch making rclone work with go-fuse which almost works!

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [November 2, 2019, 4:30pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/5 "2019-11-02T16:30:58Z")

</div>

Yeah, I had a bit of an experiment about this earlier.

Noticed the max\_pages commit when it was pushed to mergerfs and was searching about how to use it in rclone. Figured that it was something that needed to be supported in the fuse backend used by rclone so went looking for it in the corresponding library.

Saw that bazil/fuse was not being maintained so again went looking through the alternative libraries available for rclone. Found the go-fuse library and created this issue there. Unfortunately, haven't been able to make progress there since I am not sure what flag to pass and the author seems stumped too.

Perhaps @trapexit could provide some help here?

---

<div class="post-metadata">

**Author:** ![trapexit](https://forum.rclone.org/user_avatar/forum.rclone.org/trapexit/32/423_2.png) [@trapexit](https://forum.rclone.org/u/trapexit)\
**Post date:** [November 2, 2019, 10:18pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/6 "2019-11-02T22:18:15Z")

</div>

> <https://github.com/trapexit/mergerfs/blob/master/libfuse/include/fuse_kernel.h#L289>

> <https://github.com/trapexit/mergerfs/blob/master/libfuse/include/fuse_kernel.h#L631>

Just like any of the other negotiated features you'd need to check in INIT if FUSE\_MAX\_PAGES is available and if so you would then set it in the flags of the init\_out struct and set the max\_pages field.

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [November 4, 2019, 5:35pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/7 "2019-11-04T17:35:49Z")

</div>

> [@darthShadow](#):
>
> Saw that bazil/fuse was not being maintained so again went looking through the alternative libraries available for rclone. Found the go-fuse library and created this issue there

FYI I revamped the `go-fuse` interface to rclone. You can try it here with `rclone mount2`.

Any testing much appreciated! This will only work on linux and macOS (not on freebsd).

[https://beta.rclone.org/branch/v1.50.1-023-gd0ba9379-mount2-v2-beta/](https://beta.rclone.org/branch/v1.50.1-023-gd0ba9379-mount2-v2-beta/) (uploaded in 15-30 mins)

go-fuse seemed quite a bit quicker in my testing as it does async reads and writes.

I can probably add that to `rclone mount` too...

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [November 5, 2019, 5:59am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/8 "2019-11-05T05:59:04Z")

</div>

Did the builds fail for Linux?

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [November 5, 2019, 8:12am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/9 "2019-11-05T08:12:18Z")

</div>

Yes it looks like they did! That will take a little while to fixup! The tests all pass locally so not sure why they didn't on the CI! [https://github.com/rclone/rclone/runs/287962101](https://github.com/rclone/rclone/runs/287962101)

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [November 11, 2019, 7:42pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/10 "2019-11-11T19:42:52Z")

</div>

Looks like the tests finally succeeded? [https://github.com/rclone/rclone/commit/48de5eb1bd4dd20becaf76fcd0464bd7efff0c47/checks?check\_suite\_id=305489468](https://github.com/rclone/rclone/commit/48de5eb1bd4dd20becaf76fcd0464bd7efff0c47/checks?check_suite_id=305489468)

Excellent work fixing the issues. Will try the new mount out soon. Any suggestions regarding the config flags that you think may require changes with `mount2`?

Current flags:

```auto
   --allow-other \
   --dir-cache-time=96h \
   --drive-chunk-size=64M \
   --vfs-read-chunk-size=128M \
   --vfs-read-chunk-size-limit=2G \
   --vfs-cache-mode=writes \
   --vfs-cache-max-age=30m \
   --vfs-cache-poll-interval=5m \
   --poll-interval=30s \
   --cache-dir=/home/darthshadow/rclone/vfs/TD/ \
   --buffer-size=512M \
   --attr-timeout=1s \
   --umask=002 \
   --log-file=/home/darthshadow/rclone/rclone-td.log \
   --log-level=INFO \
   --stats=30s \
   --stats-log-level=NOTICE \
   --rc \
   --rc-addr=127.0.0.1:5573 \

```

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [November 11, 2019, 9:52pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/11 "2019-11-11T21:52:13Z")

</div>

Yes, here is rclone with a mount2 command for testing

[https://beta.rclone.org/branch/v1.50.1-036-g9aa70582-mount2-v2-beta/](https://beta.rclone.org/branch/v1.50.1-036-g9aa70582-mount2-v2-beta/)

> [@darthShadow](#):
>
> Any suggestions regarding the config flags that you think may require changes with `mount2` ?

Most of those flags are for the VFS layer which is unchanged. Potentially `--attr-timeout` might need tweaking, but `1s` is the default value so probably not. I haven't tried `--allow-other` so that may be broken 😉 I think it should be pretty much 100% compatible flags wise, just change `mount` to `mount2`!

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [November 19, 2019, 7:13am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/12 "2019-11-19T07:13:31Z")

</div>

I have been having pauses with the new async reads feature of VFS. They seem to be coinciding with the waits for 5ms for the in-order read to come it. This seems to be causing issues with the smooth playback of files from the mount.

Do you think 5ms is a little too long to wait for an in-order read?

PS: This is with default mount. Haven't tried mount2 yet.

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [November 19, 2019, 1:16pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/13 "2019-11-19T13:16:16Z")

</div>

Following are the results of transferring a single file via rsync from the mounts of the specified versions. Different files were transferred so the size may vary a little.

Mount Command:

```auto
rclone mount PersonalTD:Media /home/darth/TDMedia --allow-other --dir-cache-time=96h --drive-chunk-size=64M --vfs-read-chunk-size=128M --vfs-read-chunk-size-limit=2G --vfs-cache-mode=writes --vfs-cache-max-age=30m --vfs-cache-poll-interval=5m --poll-interval=30s --cache-dir=/home/darth/rclone/vfs/TD/ --buffer-size=512M --attr-timeout=1s --umask=002 --log-file=/home/darth/rclone/rclone-td.log --log-level=INFO --stats=30s --stats-log-level=NOTICE --rc --rc-addr=127.0.0.1:5573

```

### v1.50.1-mount

```auto
rclone v1.50.1
- os/arch: linux/amd64
- go version: go1.13.4

```

```auto
2019/11/19 11:13:31 NOTICE:
Transferred: 8.076G / 8.076 GBytes, 100%, 34.572 MBytes/s, ETA 0s
Errors: 0
Checks: 0 / 0, -
Transferred: 1 / 1, 100%
Elapsed time: 3m59.2s

```

- No Errors

### v1.50.1-053-g1e627855-mount

```auto
rclone v1.50.1-053-g1e627855-beta
- os/arch: linux/amd64
- go version: go1.13.4

```

```auto
2019/11/19 11:25:46 NOTICE:
Transferred: 9.743G / 9.743 GBytes, 100%, 15.035 MBytes/s, ETA 0s
Errors: 0
Checks: 0 / 0, -
Transferred: 1 / 1, 100%
Elapsed time: 11m3.6s

```

- Had multiple errors: `ReadFileHandle.Read error: low level retry 1/10: EOF`

### v1.50.1-06-g48de5eb1-mount

```auto
rclone v1.50.1-036-g48de5eb1-mount2-v2-beta
- os/arch: linux/amd64
- go version: go1.13.4

```

```auto
2019/11/19 11:25:46 NOTICE:
Transferred: 9.462G / 9.462 GBytes, 100%, 14.520 MBytes/s, ETA 0s
Errors: 0
Checks: 0 / 0, -
Transferred: 1 / 1, 100%
Elapsed time: 11m7.2s

```

- Had multiple errors: `ReadFileHandle.Read error: low level retry 1/10: EOF`

### v1.50.1-06-g48de5eb1-mount2

```auto
rclone v1.50.1-036-g48de5eb1-mount2-v2-beta
- os/arch: linux/amd64
- go version: go1.13.4

```

```auto
2019/11/19 11:46:24 NOTICE:
Transferred: 8.371G / 8.371 GBytes, 100%, 35.709 MBytes/s, ETA 0s
Errors: 0
Checks: 0 / 0, -
Transferred: 1 / 1, 100%
Elapsed time: 4m0s

```

- No Errors

Another observation is that if more than one process is accessing the same file in the mount2, it bring all the existing transfers of that file to a crawl. (~40 MB/s to ~5 MB/s)

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [November 19, 2019, 1:41pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/14 "2019-11-19T13:41:27Z")

</div>

> [@darthShadow](#):
>
> I have been having pauses with the new async reads feature of VFS. They seem to be coinciding with the waits for 5ms for the in-order read to come it. This seems to be causing issues with the smooth playback of files from the mount.

Interesting...

> [@darthShadow](#):
>
> Do you think 5ms is a little too long to wait for an in-order read?

The penalty of a 5ms wait for a read is offset by having to re-open the stream from scratch which takes more like 20ms for me. Rclone will end up doing this three times potentially...

- 1
- 2
- 4 - seek and re-open
- 3 - seek and re-open
- 5 - seek and re-open
- 6

Did the block come in within the 5ms deadline or did rclone do seeking? What does the log say?

Do you think your speed variations are due to the out of order blocks? Can you see seeking in the logs in the slow cases?

I rebased and updated the mount2 branch here:

[https://beta.rclone.org/branch/v1.50.1-056-gd1170db3-mount2-v2-beta/](https://beta.rclone.org/branch/v1.50.1-056-gd1170db3-mount2-v2-beta/) (uploaded in 15-30 mins)

> [@darthShadow](#):
>
> Another observation is that if more than one process is accessing the same file in the mount2, it bring all the existing transfers of that file to a crawl. (~40 MB/s to ~5 MB/s)

Is that the case for `mount` as well? Is there lots of seeking going on?

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [November 26, 2019, 6:30pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/15 "2019-11-26T18:30:23Z")

</div>

> [@ncw](#):
>
> Is that the case for `mount` as well? Is there lots of seeking going on?

There were quite a lot of seeks in the log when I checked, yes.

Unfortunately, this is proving difficult to reproduce and I have already wiped the original log. Will spend some time this weekend, work permitting, to see if I can reproduce this.

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [December 3, 2019, 2:19pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/16 "2019-12-03T14:19:15Z")

</div>

> [@darthShadow](#):
>
> Unfortunately, this is proving difficult to reproduce and I have already wiped the original log. Will spend some time this weekend, work permitting, to see if I can reproduce this.

Did you have any luck with this? I'm just wondering whether to revert the async changes for mount or not...

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [December 3, 2019, 2:50pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/17 "2019-12-03T14:50:11Z")

</div>

Unfortunately, no, I was not able to reproduce the speed issue. I am planning to switch over one of my regular mounts to this build with mount2 and hope that it will get reproduced eventually.

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [February 10, 2020, 5:03am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/18 "2020-02-10T05:03:31Z")

</div>

Hi,

I have sent a PR for the changes for Max Pages, currently with the bazil fuse version. Corresponding PR there is [https://github.com/bazil/fuse/pull/237](https://github.com/bazil/fuse/pull/237)

I have also included the iowait branch changes since I wanted to test with async\_read enabled and disabled to see if there were any issues either way.

The speeds seem to be better for me but more testing will be helpful.

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [February 10, 2020, 10:25am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/19 "2020-02-10T10:25:01Z")

</div>

> [@darthShadow](#):
>
> I have sent a PR for the changes for Max Pages, currently with the bazil fuse version. Corresponding PR there is [https://github.com/bazil/fuse/pull/237](https://github.com/bazil/fuse/pull/237)

Nice one!

> [@darthShadow](#):
>
> I have also included the iowait branch changes since I wanted to test with async\_read enabled and disabled to see if there were any issues either way.

Do you think I should merge these to a point release?

Maybe with the wait time increased to 20 or 50ms?

> [@darthShadow](#):
>
> The speeds seem to be better for me but more testing will be helpful.

🙂 Measurements please!

---

<div class="post-metadata">

**Author:** ![darthShadow](https://forum.rclone.org/user_avatar/forum.rclone.org/darthshadow/32/1322_2.png) [@darthShadow](https://forum.rclone.org/u/darthShadow)\
**Post date:** [February 10, 2020, 11:00am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/20 "2020-02-10T11:00:58Z")

</div>

> [@ncw](#):
>
> Do you think I should merge these to a point release?
> 
> Maybe with the wait time increased to 20 or 50ms?

Probably would be good to merge them into a point release so that people can test what works for them and we can arrive at sane defaults for the same. 20 ms may be a drastic change without getting any solid data from the users.

I think we should just double it to 10ms for and let the users chime in with their observations about what works for them to tune it any further.

> [@ncw](#):
>
> Measurements please!

Any thoughts on what tests should be performed? I was trying out tests with Drive as the remote and was getting increases from 80 MB/s to 110-120 MB/s but that may also be due to varying speeds with Google.

I would ideally like to get some test cases that can be repeated across various setups and various users to see the benefits.

I was thinking about a local mount with rclone. Would that be reasonable?

Possible command for a local mount:

```auto
rclone mount ~/max-pages/source ~/max-pages/test-mount --stats=30s --log-level=INFO --buffer-size=512M --async-read=true --vfs-read-wait=20ms --max-read-ahead=1M --max-pages=256

```

PS: Now that max-write has increased to 1M, I have noticed improvements with setting max-read-ahead to 1M too (from the default 128k), but this may be just placebo.

Is there any way to get binaries built for the PR so I can direct a few folks to it for testing?

[Next page](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724.md?page=2)
