# 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:** 2

<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, 12:43pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/21 "2020-02-10T12:43:24Z")

</div>

I will also be submitting a similar PR to the go-fuse library for the mount2 variant, so, can you please rebase that branch with the latest master so that I can test that out too?

Is there anything holding you from adding mount2 as a separate option to the mainstream builds?

Do you think it would help with the iowait's 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:** [February 10, 2020, 2:16pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/22 "2020-02-10T14:16:27Z")

</div>

This is just one of the various tests performed:

### Without the max pages patch:

> `26,224,173,044 100% 397.26MB/s 0:01:02 (xfr#1, to-chk=0/1)`

### With the max pages patch:

> ` 26,224,173,044 100% 509.32MB/s 0:00:49 (xfr#1, to-chk=0/1)`

The mount command was the same as the above, only the binary was changed.

---

<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, 4:38pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/23 "2020-02-10T16:38:58Z")

</div>

> [@darthShadow](#):
>
> I will also be submitting a similar PR to the go-fuse library for the mount2 variant, so, can you please rebase that branch with the latest master so that I can test that out too?

I've pushed it to `go-fuse-mount`

There will be a binary here

[https://beta.rclone.org/branch/v1.51.0-022-gd10cf5fe-go-fuse-mount-beta/](https://beta.rclone.org/branch/v1.51.0-022-gd10cf5fe-go-fuse-mount-beta/) (uploaded in 15-30 mins)

> [@darthShadow](#):
>
> Is there anything holding you from adding mount2 as a separate option to the mainstream builds?

I'd switch from bazil to go-fuse apart from the inconvenient fact that go-fuse doesn't support FreeBSD ☹

I haven't figured out what to do about that yet!

> [@darthShadow](#):
>
> Do you think it would help with the iowait's too ?

I think go-fuse has the same problem - it is where I first noticed it.

The problem is that the kernel delivers out of order reads if you set the async flag.

> [@darthShadow](#):
>
> This is just one of the various tests performed:

Nice!

> [@darthShadow](#):
>
> I have noticed improvements with setting max-read-ahead to 1M too (from the default 128k), but this may be just placebo.

Last time I looked through the kernel source max-read-ahead was limited to 128k. However you should be able to see if it is effective by running with -vv and seeing whether the Read calls ask for more than 128k of data.

---

<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:32pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/24 "2020-02-10T17:32:23Z")

</div>

Just to keep it consolidated in 1 place, the build for this is available from: [v1.51.0-014-g6a86ec70-pr-3949-max-pages-beta](https://beta.rclone.org/branch/v1.51.0-014-g6a86ec70-pr-3949-max-pages-beta/)

> [@ncw](#):
>
> I've pushed it to `go-fuse-mount`

Thanks. Expect a PR for that too in the next few days.

> [@ncw](#):
>
> I'd switch from bazil to go-fuse apart from the inconvenient fact that go-fuse doesn't support FreeBSD

Isn't it possible to add it as a separate option as mount2 on the OS'es it already supports and push that change to master? Or do you see any issues with that approach?

> [@ncw](#):
>
> The problem is that the kernel delivers out of order reads if you set the async flag.

That's disappointing. I had hoped that the fuse library would have handled it better without needing to tweak it so much from rclone, with the read & write wait time(s).

> [@ncw](#):
>
> Nice!

Any suggestions or improvements for the performance testing and the mount command? Or is testing via the local mount the best judge for now?

> [@ncw](#):
>
> Last time I looked through the kernel source max-read-ahead was limited to 128k. However you should be able to see if it is effective by running with -vv and seeing whether the Read calls ask for more than 128k of data

Will do.

---

<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 11, 2020, 11:36am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/25 "2020-02-11T11:36:42Z")

</div>

> [@darthShadow](#):
>
> Isn't it possible to add it as a separate option as mount2 on the OS'es it already supports and push that change to master? Or do you see any issues with that approach?

Sure that is possible. I didn't do it because of code bloat and general user confusion! Do you think I should? I could make the `mount2` command hidden.

> [@darthShadow](#):
>
> Any suggestions or improvements for the performance testing and the mount command? Or is testing via the local mount the best judge for now?

Testing via the local disk is what I usually do.

---

<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 11, 2020, 11:49am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/26 "2020-02-11T11:49:48Z")

</div>

> [@ncw](#):
>
> I could make the `mount2` command hidden

That sounds like a good idea. This will avoid needing to keep the branch constantly up to date and those who want can try both with minimal changes.

---

<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 11, 2020, 12:08pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/27 "2020-02-11T12:08:04Z")

</div>

Adding the mount2 commands adds 524k to to the rclone binary which is 1.3% so that is probably acceptable!

If this builds OK with mount2 hidden then I'll merge it

[https://beta.rclone.org/branch/v1.51.0-024-g02afb74b-go-fuse-mount-beta/](https://beta.rclone.org/branch/v1.51.0-024-g02afb74b-go-fuse-mount-beta/) (uploaded in 15-30 mins)

---

<div class="post-metadata">

**Author:** ![Dual-O](https://forum.rclone.org/user_avatar/forum.rclone.org/dual-o/32/19738_2.png) [@Dual-O](https://forum.rclone.org/u/Dual-O)\
**Post date:** [February 11, 2020, 1:20pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/28 "2020-02-11T13:20:36Z")

</div>

Can I test this new mount2 option with Debian 10.3 (Kernel 4.19) too? Would this speedup my mounts?

---

<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 11, 2020, 1:52pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/29 "2020-02-11T13:52:27Z")

</div>

@ncw I was going through this [thread](https://github.com/rfjakob/gocryptfs/commit/00df0771e3dd9fba0992cbc9a7d347f25aff856a) and trying to understand the logic for async reads.

I had a small question, if you don't mind, do you think there would be any advantage to serializing the requests after an aborted or successful read like suggested and implemented in that thread?

---

<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 11, 2020, 2:35pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/30 "2020-02-11T14:35:55Z")

</div>

> [@darthShadow](#):
>
> I had a small question, if you don't mind, do you think there would be any advantage to serializing the requests after an aborted or successful read like suggested and implemented in that thread?

The rclone implementation works pretty much like that one I think - the use of Cond locks shortens the code a lot so you don't need a central manager of the requests.

I made another implementation (not released yet) which serializes all the read requests into a goroutine which makes for simpler code (less locking!) but it has the great advantage that it doesn't need to wait until the IO has finished before figuring out that the offset is correct, so the io wait times can be shorter. That is much more like the serialize\_reads in that thread.

If you turn on --fuse-debug you can see the problem, the reads come in in the wrong order but usually separated by \<0.1 ms

---

<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 11, 2020, 2:36pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/31 "2020-02-11T14:36:51Z")

</div>

> [@Dual-O](#):
>
> Can I test this new mount2 option with Debian 10.3 (Kernel 4.19) too? Would this speedup my mounts?

I just merged it to [the latest beta](https://beta.rclone.org) (it will be there in 15 mins or so).

It should work find on your machine and it will probably be faster - interested in your feedback.

---

<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 11, 2020, 2:46pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/32 "2020-02-11T14:46:42Z")

</div>

> [@ncw](#):
>
> If you turn on --fuse-debug you can see the problem, the reads come in in the wrong order but usually separated by \<0.1 ms

Yeah, I did notice that which was why I had suggested earlier in the thread to reduce the value by default. I just never read the code to understand that it waits until the whole read is completed to unlock the others.

Should be an excellent improvement w.r.t the iowait. Well done as always.

---

<div class="post-metadata">

**Author:** ![Dual-O](https://forum.rclone.org/user_avatar/forum.rclone.org/dual-o/32/19738_2.png) [@Dual-O](https://forum.rclone.org/u/Dual-O)\
**Post date:** [February 11, 2020, 4:37pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/33 "2020-02-11T16:37:56Z")

</div>

I've done some tests on my VPS...

mount options

```
--allow-other \
--umask 0007 \
--uid 120 \
--gid 120 \
--use-mmap \
--buffer-size 2G \
--fast-list \
--dir-cache-time 96h \
--drive-chunk-size 128M \
--vfs-cache-max-age 4h \
--vfs-cache-mode writes \
--vfs-cache-max-size 50G \
--vfs-read-chunk-size 128M \
--vfs-read-chunk-size-limit off \

```

rclone v1.51.0

```
time mediainfo via mount Test-File1
real 0m1.778s
user 0m0.117s
sys 0m0.042s

time mediainfo via mount Test-File2
real 0m1.429s
user 0m0.350s
sys 0m0.021s

rsync copy via mount Test-File1
79,754,881,798 100% 103.07MB/s 0:12:17 (xfr#1, to-chk=0/1)

rsync copy via mount Test-File2
 6,064,000,647 100% 55.34MB/s 0:01:44 (xfr#1, to-chk=0/1)

copy rclone Test-File1 (--transfers 16)
Transferred: 74.278G / 74.278 GBytes, 100%, 341.912 MBytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 3m42.4s

copy rclone Test-File2 (--transfers 16)
Transferred: 5.648G / 5.648 GBytes, 100%, 160.473 MBytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 36.0s
second one goes faster... coincidence?
Transferred: 5.648G / 5.648 GBytes, 100%, 370.925 MBytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 15.5s

```

rclone v1.51.0-027-gec127181-beta

```
time mediainfo via mount Test-File1
real 0m1.818s
user 0m0.114s
sys 0m0.035s

time mediainfo via mount Test-File2
real 0m1.314s
user 0m0.297s
sys 0m0.018s

rsync copy via mount Test-File1
79,754,881,798 100% 101.23MB/s 0:12:31 (xfr#1, to-chk=0/1)

rsync copy via mount Test-File2
 6,064,000,647 100% 58.34MB/s 0:01:39 (xfr#1, to-chk=0/1)
 
rclone copy Test-File1 (--transfers 16)
Transferred: 74.278G / 74.278 GBytes, 100%, 343.332 MBytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 3m41.5s

copy rclone Test-File2 (--transfers 16)
Transferred: 5.648G / 5.648 GBytes, 100%, 322.325 MBytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 17.9s

```

I think the test says not so much because of the local storage limitation.  
Would be nice if someone with a dedicated-root can test this scenario.

One question: why is copy via vfs-mount so "slow"? Is it because rclone handle these stream connection via mount in an other way?

---

<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 11, 2020, 6:11pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/34 "2020-02-11T18:11:06Z")

</div>

> [@ncw](#):
>
> Last time I looked through the kernel source max-read-ahead was limited to 128k. However you should be able to see if it is effective by running with -vv and seeing whether the Read calls ask for more than 128k of data.

It does look like the max-pages has allowed the read-ahead to be increased to 1MiB.  
Without it or with it set to 32 (i.e. the default value), I am seeing fuse reads of 131072 (i.e. 128k), as expected, in the logs. With it set to 256, the value is 1048576 (i.e. 1 MiB)

* * *

Some performance numbers with the bazil/fuse library:

### For 1G File:

#### Without Max Pages (with 128k Reads)

```auto
darthshadow@server:~/max-pages$ time cp test-mount/1G.img .

real 0m15.251s
user 0m0.005s
sys 0m0.524s

```

#### With Max Pages (with 1M Reads)

```auto
darthshadow@server:~/max-pages$ time cp test-mount/1G.img .

real 0m3.668s
user 0m0.008s
sys 0m0.515s

```

### For 10G File:

#### Without Max Pages (with 128k Reads)

```auto
darthshadow@server:~/max-pages$ time cp test-mount/10G.img .

real 2m25.094s
user 0m0.092s
sys 0m5.416s

```

#### With Max Pages (with 1M Reads)

```auto
darthshadow@server:~/max-pages$ time cp test-mount/10G.img .

real 0m32.152s
user 0m0.051s
sys 0m4.724s

```

The numbers seem to be pretty constant across multiple runs and show almost a 5x improvement w.r.t **read** speeds.

* * *

However, I have been unable to achieve similar results for my write tests. The writes seem to still be limited to 128k for some reason even though the parameters appear to be set properly. Is there any buffer or chunk size in rclone that may be effecting it?

---

<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 12, 2020, 10:45am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/35 "2020-02-12T10:45:41Z")

</div>

> [@Dual-O](#):
>
> I think the test says not so much because of the local storage limitation.

There isn't that much difference between them is there?

You could try `rclone mount2` in the latest beta to see if there is a difference.

> [@Dual-O](#):
>
> One question: why is copy via vfs-mount so "slow"? Is it because rclone handle these stream connection via mount in an other way?

That should be something that @darthShadow's work helps with.

---

<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 12, 2020, 10:50am UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/36 "2020-02-12T10:50:10Z")

</div>

> [@darthShadow](#):
>
> It does look like the max-pages has allowed the read-ahead to be increased to 1MiB.  
> Without it or with it set to 32 (i.e. the default value), I am seeing fuse reads of 131072 (i.e. 128k), as expected, in the logs. With it set to 256, the value is 1048576 (i.e. 1 MiB)

Great 🙂

> [@darthShadow](#):
>
> The numbers seem to be pretty constant across multiple runs and show almost a 5x improvement w.r.t **read** speeds.

That is a lot of difference!

> [@darthShadow](#):
>
> However, I have been unable to achieve similar results for my write tests. The writes seem to still be limited to 128k for some reason even though the parameters appear to be set properly. Is there any buffer or chunk size in rclone that may be effecting it?

max pages should be working for both reads and write I think. Did you change both the send path and the receive path in the bazil library (I didn't check your patch and that question may make no sense!).

---

<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 12, 2020, 12:10pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/37 "2020-02-12T12:10:04Z")

</div>

> [@ncw](#):
>
> max pages should be working for both reads and write I think.

Yeah, I would have thought the same.

> [@ncw](#):
>
> Did you change both the send path and the receive path in the bazil library

There isn't anything to change per request. This is done only once in the initial negotiation with the kernel so this is particularly surprising.

My next step is to test the same with go-fuse instead and see if it works there. If it does, there's additional changes required for the bazil/fuse version. If it doesn't, perhaps I am missing something else that needs to be done too. Let's see...

---

<div class="post-metadata">

**Author:** ![Dual-O](https://forum.rclone.org/user_avatar/forum.rclone.org/dual-o/32/19738_2.png) [@Dual-O](https://forum.rclone.org/u/Dual-O)\
**Post date:** [February 12, 2020, 3:08pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/38 "2020-02-12T15:08:10Z")

</div>

about rclone mount **2** :  
when I change to mount directory I got an error.  
-bash: cd: /mnt/mount/: Permission denied  
ls, mv, or cp commands are possible

with rclone mount all work well.

edit: uid and gid are set to rclone user/group. my personal user is member of this group.

edit2: with command df I got disk information about rclone mounts. When I use mount2 I don't get this... Some of my apps check this disk informations. e.g. Nextcloud. Result: Nextcloud shows failure message "disk full"

---

<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 12, 2020, 3:41pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/39 "2020-02-12T15:41:37Z")

</div>

> [@darthShadow](#):
>
> My next step is to test the same with go-fuse instead and see if it works there.

I have pushed the changes for go-fuse too. The read performance has similar improvements with max-pages cranked up but writes are still 128k.

I am out of ideas about what else may be causing this issue.

@trapexit Is there anything else that is required to be done for increasing the writes to 1 MiB instead of 128 KiB? The reads have increased to 1 MiB after increasing the max pages to 256 but the writes are still 128k. And yes, big writes are already enabled.

---

<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:** [February 12, 2020, 4:42pm UTC](https://forum.rclone.org/t/max-pages-on-linux-with-rclone-mergerfs/12724/40 "2020-02-12T16:42:49Z")

</div>

The only thing that I can think of is ensuring that fuse\_init\_out.max\_write is appropriately set.

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

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