Skip to content

Commit

Permalink
add cache mode options
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Baker committed May 9, 2019
1 parent f47b77b commit 9408f81
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 40 deletions.
8 changes: 8 additions & 0 deletions functions/deployblitz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ ansible-playbook /opt/pgclone/ymls/mount.yml -e "\
vfs_bs=$vfs_bs
vfs_dcs=$vfs_dcs
vfs_dct=$vfs_dct
vfs_cm=$vfs_cm
vfs_cma=$vfs_cma
vfs_cms=$vfs_cms
vfs_rcs=$vfs_rcs
vfs_rcsl=$vfs_rcsl
drive=gdrive"
Expand All @@ -38,7 +40,9 @@ ansible-playbook /opt/pgclone/ymls/mount.yml -e "\
vfs_bs=$vfs_bs
vfs_dcs=$vfs_dcs
vfs_dct=$vfs_dct
vfs_cm=$vfs_cm
vfs_cma=$vfs_cma
vfs_cms=$vfs_cms
vfs_rcs=$vfs_rcs
vfs_rcsl=$vfs_rcsl
drive=tdrive"
Expand All @@ -49,7 +53,9 @@ ansible-playbook /opt/pgclone/ymls/crypt.yml -e "\
vfs_bs=$vfs_bs
vfs_dcs=$vfs_dcs
vfs_dct=$vfs_dct
vfs_cm=$vfs_cm
vfs_cma=$vfs_cma
vfs_cms=$vfs_cms
vfs_rcs=$vfs_rcs
vfs_rcsl=$vfs_rcsl
drive=gcrypt"
Expand All @@ -61,7 +67,9 @@ ansible-playbook /opt/pgclone/ymls/crypt.yml -e "\
vfs_bs=$vfs_bs
vfs_dcs=$vfs_dcs
vfs_dct=$vfs_dct
vfs_cm=$vfs_cm
vfs_cma=$vfs_cma
vfs_cms=$vfs_cms
vfs_rcs=$vfs_rcs
vfs_rcsl=$vfs_rcsl
drive=tcrypt"
Expand Down
4 changes: 4 additions & 0 deletions functions/deploymove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ ansible-playbook /opt/pgclone/ymls/mount.yml -e "\
vfs_bs=$vfs_bs
vfs_dcs=$vfs_dcs
vfs_dct=$vfs_dct
vfs_cm=$vfs_cm
vfs_cma=$vfs_cma
vfs_cms=$vfs_cms
vfs_rcs=$vfs_rcs
vfs_rcsl=$vfs_rcsl
drive=gdrive"
Expand All @@ -40,7 +42,9 @@ ansible-playbook /opt/pgclone/ymls/crypt.yml -e "\
vfs_bs=$vfs_bs
vfs_dcs=$vfs_dcs
vfs_dct=$vfs_dct
vfs_cm=$vfs_cm
vfs_cma=$vfs_cma
vfs_cms=$vfs_cms
vfs_rcs=$vfs_rcs
vfs_rcsl=$vfs_rcsl
drive=gcrypt"
Expand Down
54 changes: 28 additions & 26 deletions functions/mountnumbers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ VFS RClone Mount Settings ~ vfs.pgblitz.com
RClone Variable Name Default ~ Current Settings
[1] Buffer-Size 16M [$vfs_bs] MB
[2] Drive-Chunk-Size 64M [$vfs_dcs] MB
[2] Drive-Chunk-Size 256M [$vfs_dcs] MB
[3] Dir-Cache-Time 2M [$vfs_dct] Minutes
[4] VFS-Read-Chunk-Size 64M [$vfs_rcs] MB
[5] VFS-Read-Chunk-Size-Limit 2G [$vfs_rcsl] GB
[6] VFS-Cache-Mode off [$vfs_cm]
[7] VFS-Cache-Max-Age 168H [$vfs_cma] Hours
[6] VFS-Cache-Mode writes [$vfs_cm]
[7] VFS-Cache-Max-Age 1H [$vfs_cma] Hours
[8] VFS-Cache-Max-Size 100G [$vfs_cms] GB
[Z] Exit
Expand Down Expand Up @@ -68,20 +68,19 @@ mountset () {
name="Buffer-Size"
sizeSuffix="MB"
start="8"
end="1024"
end="8096"
note="Open files will be buffered to RAM up to this limit. This limit is per opened file.
The buffer size should be a relatively small amount. It's intended to smooth out network congestion and blips.
The buffer will get cleared when you seek in plex or when the file is closed.
Having a larger buffer may cause slower video start times.
The buffer size should be a relatively small amount. It's intended to smooth out network congestion and blips.
The buffer will get cleared when you seek in plex or when the file is closed.
Having a larger buffer may cause slower video start times.
WARNING: This is highly dependent on the amount of RAM and number of opened files.
Plex opens several files during library scans and each file open will consume up to the amount of RAM specified.
If you set this too high and don't have enough free RAM, you will cause the mounts to crash!
WARNING: This is highly dependent on the amount of RAM and number of opened files.
Apps open several files during library scans and each file open will consume up to the amount of RAM specified.
If you set this too high and don't have enough free RAM, you will cause the mounts to crash!
RECOMMENDATIONS: 2GB RAM: 8MB | 4GB RAM: 16MB | 8GB RAM: 16-32MB | 16GB+ RAM: 64MB-128MB
This value must be less than the vfs-read-chunk-size to prevent 'too many open file requests' errors!
"
RECOMMENDATIONS: 2GB RAM: 8MB | 4GB RAM: 16MB | 8GB RAM: 32-64MB | 16GB RAM: 64-128MB | 32GB RAM: 512-1024MB
"

fi

Expand All @@ -90,9 +89,12 @@ mountset () {
sizeSuffix="MB"
start="8"
end="1024"
note="Upload chunk size, increasing the chunk size may increase upload speed, however it uses more RAM.
Input must be one of the following numbers (power of 2)!
[8] [16] [32] [64] [128] [256] [512] [1024]"
note="Upload chunk size, increasing the chunk size increases upload speed, however it uses more RAM.
128-256MB will max out a 1G upload connection, it's recommended to set the BWLimit to prevent consuming all bandwidth.
Input must be one of the following numbers (power of 2)!
[8] [16] [32] [64] [128] [256] [512] [1024]"
fi

if [[ "$mountselection" == "3" ]]; then
Expand All @@ -101,8 +103,8 @@ mountset () {
start="1"
end="7620"
note="This controls the cache time for remote directory information and contents.
This may delay external changes (such as from gdrive website) from being seen on your server until the cache expires.
You should set this high unless you make lots of external changes."
This may delay external changes (such as from gdrive website) from being seen on your server until the cache expires.
You should set this high unless you make lots of external changes."
fi

if [[ "$mountselection" == "4" ]]; then
Expand All @@ -111,7 +113,7 @@ mountset () {
start="16"
end="1024"
note="This allows reading the source objects in parts, by requesting only chunks from the remote that are actually read at the cost of an increased number of requests.
Must be greater than the buffer-size to prevent too many open file requests!"
Setting this too small will result in API bans for too many reads, setting this too high will waste download quota and it will take longer to start playback."
fi

if [[ "$mountselection" == "5" ]]; then
Expand All @@ -120,7 +122,7 @@ mountset () {
start="1"
end="100"
note="The chunk size for each open file will get doubled for each chunk read, until the specified value is reached.
This limit must be greater than vfs-read-chunk-size and it's only used when the vfs-cache-mode is not set to full."
This limit must be greater than vfs-read-chunk-size and it's only used when the vfs-cache-mode is not set to full."
fi

if [[ "$mountselection" == "6" ]]; then
Expand All @@ -137,12 +139,12 @@ mountset () {
◽️ Files opened for read/write will be buffered to disks.
◽️ Files opened for write only can’t be seeked
3) writes:
3) writes (recommended):
◽️ Write only and read/write files are buffered to disk first.
◽️ This mode should support all normal file system operations.
4) full:
◽️ All files are buffered to and from disk.
4) full (not recommended, scanning issues):
◽️ All files are buffered to and from disk, files are fully downloaded on open, even on scans.
◽️ When a file is opened for read it will be downloaded in its entirety first.
◽️ This mode should support all normal file system operations."
fi
Expand All @@ -169,10 +171,10 @@ tee <<-EOF
Setting Variable >>> $name
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Type a number between [$start] and [$end] $sizeSuffix
$note
Type a number between [$start] and [$end] $sizeSuffix
Quitting? Type >>> exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
Expand Down
14 changes: 7 additions & 7 deletions functions/variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,25 @@ else dversionoutput="None"; fi
variable /var/plexguide/vfs_bs "16"
vfs_bs=$(cat /var/plexguide/vfs_bs)

variable /var/plexguide/vfs_dcs "64"
variable /var/plexguide/vfs_dcs "256"
vfs_dcs=$(cat /var/plexguide/vfs_dcs)

variable /var/plexguide/vfs_dct "2"
vfs_dct=$(cat /var/plexguide/vfs_dct)

variable /var/plexguide/vfs_cm "writes"
vfs_cm=$(cat /var/plexguide/vfs_cm)

variable /var/plexguide/vfs_cma "1"
vfs_cma=$(cat /var/plexguide/vfs_cma)

variable /var/plexguide/vfs_cms "100"
vfs_cms=$(cat /var/plexguide/vfs_cms)

variable /var/plexguide/vfs_rcs "64"
vfs_rcs=$(cat /var/plexguide/vfs_rcs)

variable /var/plexguide/vfs_rcsl "2"
vfs_rcsl=$(cat /var/plexguide/vfs_rcsl)

variable /var/plexguide/vfs_cm "off"
vfs_cm=$(cat /var/plexguide/vfs_cm)

variable /var/plexguide/vfs_cms "100"
vfs_cms=$(cat /var/plexguide/vfs_cms)

}
10 changes: 6 additions & 4 deletions mounts/crypt.service
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ User=0
Group=0
ExecStart=/usr/bin/rclone mount {{drive}}: /mnt/{{drive}} \
--config /opt/appdata/plexguide/rclone.conf \
--cache-db-purge \
--allow-non-empty \
--allow-other \
--size-only \
Expand All @@ -24,13 +25,14 @@ ExecStart=/usr/bin/rclone mount {{drive}}: /mnt/{{drive}} \
--log-file=/var/plexguide/logs/rclone-{{drive}}.log \
--log-level INFO \
--timeout 1h \
--vfs-cache-mode writes \
--dir-cache-time {{vfs_dct}}m \
--drive-chunk-size {{vfs_dcs}}M \
--buffer-size {{vfs_bs}}M \
--vfs-cache-mode {{vfs_cm}} \
--vfs-cache-max-age {{vfs_cma}}h \
--vfs-cache-max-size {{vfs_cms}}G \
--vfs-read-chunk-size {{vfs_rcs}}M \
--vfs-read-chunk-size-limit {{vfs_rcsl}}G \
--drive-chunk-size {{vfs_dcs}}M \
--buffer-size {{vfs_bs}}M
--vfs-read-chunk-size-limit {{vfs_rcsl}}G

ExecStop=/bin/fusermount -uz /mnt/{{drive}}
TimeoutStopSec=20
Expand Down
9 changes: 6 additions & 3 deletions mounts/drive.service
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ User=0
Group=0
ExecStart=/usr/bin/rclone mount {{drive}}: /mnt/{{drive}} \
--config /opt/appdata/plexguide/rclone.conf \
--cache-db-purge \
--allow-non-empty \
--allow-other \
--size-only \
Expand All @@ -25,11 +26,13 @@ ExecStart=/usr/bin/rclone mount {{drive}}: /mnt/{{drive}} \
--log-level INFO \
--timeout 1h \
--dir-cache-time {{vfs_dct}}m \
--drive-chunk-size {{vfs_dcs}}M \
--buffer-size {{vfs_bs}}M \
--vfs-cache-mode {{vfs_cm}} \
--vfs-cache-max-age {{vfs_cma}}h \
--vfs-cache-max-size {{vfs_cms}}G \
--vfs-read-chunk-size {{vfs_rcs}}M \
--vfs-read-chunk-size-limit {{vfs_rcsl}}G \
--drive-chunk-size {{vfs_dcs}}M \
--buffer-size {{vfs_bs}}M
--vfs-read-chunk-size-limit {{vfs_rcsl}}G

ExecStop=/bin/fusermount -uz /mnt/{{drive}}
TimeoutStopSec=20
Expand Down

0 comments on commit 9408f81

Please sign in to comment.