What is the problem you are having with rclone?
I have an application that uses range seeks repeatedly to read a 2G+ file from a rclone mount of a sftp remote.
I cannot change the application.
By inspecting the cache directory I see it is not downloading the file by the specified vfs-read-chunk-size or vs-read-ahead (both set to 128M).
The ideal behavior for me would be to cache the chunks that correspond to the range seek ranges.
A compromise would be to cache the entire file on access. What would the rclone mount parameters be then?
What is your rclone version (output from rclone version
)
rclone v1.57.0
os/version: darwin 12.0.1 (64 bit)
os/kernel: 21.1.0 (arm64)
os/type: darwin
os/arch: arm64
go/version: go1.17.2
go/linking: dynamic
go/tags: cmount
Which cloud storage system are you using? (eg Google Drive)
sftp
The command you were trying to run (eg rclone copy /tmp remote:tmp
)
rclone cmount \
-vv \
--cache-dir ~/.cache/rclone/monolayer_data \
--vfs-cache-mode full \
--vfs-cache-max-age 1000h0m0s \
--vfs-cache-max-size 200G \
--vfs-cache-poll-interval 1h0m0s \
--vfs-write-back 5s \
--buffer-size 64M \
--vfs-read-ahead 128M \
--vfs-read-chunk-size 128M \
--vfs-read-wait 1s \
--transfers 16 \
--multi-thread-streams 16 \
:sftp,host="REDACTED",user="REDACTED",port="22",pass="",key_file="":source \
target
The rclone config contents with secrets removed.
See connection string above.
A log from the command with the -vv
flag
out.txt
2021/11/22 13:08:56 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "cmount" "-vv" "--cache-dir" "CACHE_DIR" "--vfs-cache-mode" "full" "--vfs-cache-max-age" "1000h0m0s" "--vfs-cache-max-size" "200G" "--vfs-cache-poll-interval" "1h0m0s" "--vfs-write-back" "5s" "--buffer-size" "64M" "--vfs-read-ahead" "128M" "--vfs-read-chunk-size" "128M" "--vfs-read-wait" "1s" "--transfers" "16" "--multi-thread-streams" "16" ":sftp,host=address,user=REMOTE_USER,port=22,pass=,key_file=:source" "TARGET"]
2021/11/22 13:08:56 DEBUG : Creating backend with remote ":sftp,host=address,user=REMOTE_USER,port=22,pass=,key_file=:source"
2021/11/22 13:08:56 DEBUG : :sftp: detected overridden config - adding "{6VJV_}" suffix to name
2021/11/22 13:08:56 DEBUG : Using config file from "/Users/USER/.config/rclone/rclone.conf"
2021/11/22 13:08:56 DEBUG : sftp://address:port/source: New connection 10.97.53.149:51400->128.40.3.150:22 to "SSH-2.0-OpenSSH_7.4"
2021/11/22 13:08:57 DEBUG : fs cache: renaming cache item ":sftp,host=address,user=REMOTE_USER,port=22,pass=,key_file=:source" to be canonical ":sftp{6VJV_}:source"
2021/11/22 13:08:57 INFO : sftp://address:port/source: poll-interval is not supported by this remote
2021/11/22 13:08:57 DEBUG : vfs cache: root is "CACHE_DIR"
2021/11/22 13:08:57 DEBUG : vfs cache: data root is "CACHE_DIR/vfs/:sftp{6VJV_}source"
2021/11/22 13:08:57 DEBUG : vfs cache: metadata root is "CACHE_DIR/vfsMeta/:sftp{6VJV_}source"
This file has been truncated. show original
I'm not sure I see anything of issue as it's reading from cache.
So it doesn't quite work like that as it depends on your access pattern and what you read from the file.
If you open a file, only read a few bytes and close it, it won't continue to read ahead, because you closed the file.
2021/11/22 13:09:03 DEBUG : vfs cache: looking for range={Pos:287522816 Size:16384} in [{Pos:0 Size:126976} {Pos:285556736 Size:2093056}] - present true
The present true is telling you it read from cache.
None. You have to trigger that behavior. You can cat the file as an example to 'prime' your cache if that's your desire.
So you are caching data and it is working properly based on your logs.
Thanks for the log analysis. If I understand you correctly:
This access pattern (open/close repeatdly) is not covered by rclone then.
cat
-ing the files works, and apparently there's not built-in solution in rclone to do it on demand.
It is I'd say, but it doesn't do what you want it to do. If a file is closed, reading ahead and keeping buffers would be inefficient because the application asked it to be closed. Open/seek/close/open/seek/close is a very inefficient cloud storage use case which mitigated a bit with cache mode full.
Correct. You'd have to use case your flow to cat / work on file / etc.
This might be of interest:
opened 08:14AM - 10 Sep 21 UTC
enhancement
VFS / mount
help wanted
### The associated forum post URL from `https://forum.rclone.org`
https://for… um.rclone.org/t/rclone-mount-buffer-not-filling-when-playing-large-files/26405/
### What is your current rclone version (output from `rclone version`)?
```sh
rclone v1.56.0
- os/version: ubuntu 20.04 (64 bit)
- os/kernel: 5.4.0-1042-raspi (aarch64)
- os/type: linux
- os/arch: arm64
- go/version: go1.16.5
- go/linking: static
- go/tags: none
```
### What problem are you are trying to solve?
```ini
# rclone mount config
Environment=RCLONE_UMASK=002
Environment=RCLONE_ALLOW_OTHER=true
Environment=RCLONE_POLL_INTERVAL=10s
Environment=RCLONE_DIR_CACHE_TIME=1000h
Environment=RCLONE_USE_MMAP=true
Environment=RCLONE_PACER_MIN_SLEEP=10ms
Environment=RCLONE_DRIVE_PACER_BURST=200
Environment=RCLONE_RC_ADDR=0.0.0.0:5801
Environment=RCLONE_RC_ENABLE_METRICS=true
rclone mount crypt: /mnt/rc-crypt \
--vfs-cache-mode writes \
--vfs-read-chunk-size 64M \
--buffer-size 700M --rc
# I've tried variations of the chunk size and buffer size
```
Buffering during playback of high bit rate files on Plex that occur due to the Plex client "dropping" the file, which causes rclone to also drop the in-memory cache for the file.
Since it takes some time to again download the chunks, there's wastage of data due to the dropped buffer and there's buffering visible in the Plex client.
Log file: https://www.dropbox.com/s/i7m51jsjsk6nbie/crypt.txt?dl=0
<img src="https://forum.rclone.org/uploads/default/original/2X/4/44d275dc6e6c777a562094cf190e917fb861d1ec.png" width="500">
Significant data over use (~50%):
<img src="https://user-images.githubusercontent.com/19761269/132956716-69c0f179-206e-43a7-9cc9-48073b423cf3.jpeg" width="500">
### How do you think rclone should be changed to solve that?
An option to set a timeout for dropping in-memory buffers set by `--buffer-size` rather than dropping it immediately, when the file is "closed" by the Plex client.
**EDIT**: Add images and rclone mount config details
**EDIT 2**: Resize images
#### How to use GitHub
* Please use the 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you are affected by the same issue.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
* Subscribe to receive notifications on status change and new comments.
As it is not really an easy 'fix' per se.
system
(system)
Closed
December 22, 2021, 2:56pm
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.