ACD + fuse mount: still not working with Plex

I’d vote for upping the default --max-read-ahead
I’m going to test today with:
rclone mount --max-read-ahead 200M --checkers 40 --read-only --allow-other acd:folder /folder

Or perhaps it be made a factor rather than a preset value. I was reading this in the linux kernel. That way it is small for small reads and large for large reads by some factor. Perhaps make the flag take something like 4x or 8x in addition to static 4M or 8M parameters. In streaming that would help high bit rate movies pull larger read aheads while smaller bitrates would use less. Something like this:

There are three phases in a typical readahead sequence:
initial When there exists no current_window or ahead_window, the size of initial readahead
is mainly inferred from the size of current read request. Normally readahead_size will be 4 or 2 times read_size.
ramp-up When there is a previous readahead, the size is doubled or x4.
full-up When reaching max_readahead.

It is possible to jump directly into full-up phase, if the request size is large enough (e.g. sendfile(10M)).

ref: https://www.kernel.org/doc/ols/2007/ols2007v2-pages-273-284.pdf

1 Like

That makes sense. According to this document the max_readahead is determined by the kernel.

http://manpages.ubuntu.com/manpages/xenial/man8/mount.fuse.8.html

Yes. In our implementation I would just say we optionally control the “max” with a flag as well with some sane default…

What you’re talking about is file cache heuristics, which indeed would be a neat addition for cacheing (acd_cli already does this). I’m sure @ncw would want an issue at Github to track it properly :slight_smile:

Normally an heuristics anticipates if more data is needed and adjusts the cache accordingly (by upping the cache limit and requesting more data from the source to fill the cache)

Nice work

I set mine too --max-read-ahead 400M, I was still getting choppy playback at times.

So I set the system buff/cache to use 45G now I have smooth playback.

really happy have watched 5 movies no issues .

Can you explain now to adjust the cache?

I have 60 GB ram in the box so really you want to allocate about 75% of free ram max

how much memory do you have ?

Only issue I have now, is I need faster internet at home :slight_smile:

#buff/cache change

I just added this to my crontab so at reboot it runs

@reboot root dd if=/dev/zero of=~/plex bs=1M count=45000

#rclone

I use crypt

rclone/rclone mount --max-read-ahead 400M secret: /Plex/Media

#Plex

Plex setting due to some 4k content had to transcode.
(still testing but look good so far)

Segmented transcoder timeout
50
Timeout in seconds segmented transcodes wait for the transcoder to begin writing data.

Transcoder temporary directory
Directory to use when transcoding for temporary files.

Transcoder default duration
120
Duration in minutes to use when transcoding something with an unknown duration.

Transcoder default throttle buffer
300

I’ve got two questions:
(1) If I only have 8GB of RAM you’d still recommend me setting the cache to 5-6GB?
(2) How do I add that to a mac?

use 5 and see how it goes

I follow this guide to tune my Linux server and it seem to help with buffer also:

http://www.nateware.com/linux-network-tuning-for-2013.html

1 Like

I’ll give it a go once I figure out how to change it in macOS.
Any hints?

Do you have a reference for this? This seems to just create a file called plex in a home directory. I’ve been trying to find a reference that plex will use this as a bufffer but have been unable to.

Yes that’s correct splice to disk pagefile. Post it later when home . But look up dd buffer cache .

And plex is using It.

Before I play a movie I have a few k Listed under buffer when I play a movie it grows too the size of the movie

You need to actually add it to swap to use it. This is just adding more swap to linux. Here is a reference for people who want to add more.

https://wiki.archlinux.org/index.php/swap#Swap_file_creation

from your link ip: UUIDs and LABELs should be favoured over the use of the device names given by the kernel as the device order could change in the future. See: fstab.
Note:

The fstab-entry is optional if the swap partition is located on a device using GPT. See the next subsection.
If using an SSD with TRIM support, consider using defaults,discard in the swap line in fstab. If activating swap manually with swapon, using the -d or --discard parameter achieves the same. See swapon(8) for details.

Warning: Enabling discard on RAID setups using mdadm will cause system lockup on boot and during runtime, if using swapon.
Activation by systemd

systemd activates swap partitions based on two different mechanisms. Both are executables in /usr/lib/systemd/system-generators. The generators are run on start-up and create native systemd units for mounts. The first, systemd-fstab-generator, reads the fstab to generate units, including a unit for swap. The second, systemd-gpt-auto-generator inspects the root disk to generate units. It operates on GPT disks only, and can identify swap partitions by their type code 82.

This can be solved by one of the following options:

Removing the swap entry from /etc/fstab
Changing the swap partition's type code from 82 to an arbitrary type code
Setting the attribute of the swap partition to "63: do not automount"

with what you advised you will end up with a full hard drive ,

i want the file to :
be created newly on boot,
deleted on reboot,
never synced to disk .

it will work and will be used even if not added to Fstab well it does in centos7

you suggest adding it to Fstab yes i would agree if i wans’t dumping 100G+ into the file daily .
I ran out of space if i sync, and other stuff.
main reason for my way is the wife rings the plex server said full cant play movie . I remotely reboot, fixed back to work .

the page is handled by systemd and has functions to detect it .

i will post other link on weekend not home this week.

https://linuxconfig.org/learning-linux-commands-dd

Sorry to breakup the technical talk (way over my head) but I notice that if 2 users are watching the same movie, there’s a significant increase in buffering. Anyone else notice it?

Anyone with any update on this topic?

I’ve been testingstrong text rclone crypt mount for Plex. Despite the above tweaks, video playback works at times but would buffer very randomly, making it unusable in a production setting. I know network speed either from my home to the server and server to ACD isn’t an issue. When downloading with rclone copy/move I’m getting 30-40Mbps when copying 1 file. Seems to be if rclone can intelligently buffer files it can help resolve this issue.

Looks like there’s already a git issue created for this: https://github.com/ncw/rclone/issues/898

Same here! I tried about every trick possible. Nothing really made a difference. I love rclone! I use it with OneDrive. When I “copy” (upload or download) I get around 40Mbps so I know its not a bandwidth issue.

buff/cache change
I just added this to my crontab so at reboot it runs
@reboot root dd if=/dev/zero of=~/plex bs=1M count=45000

I don’t understand this! All this does is create a Swap file. But regardless, I did create a swap file and that still doesn’t really improve anything! In my case, Swap is not even being used! I only have 4GBs of RAM, 1GB is being used, about 2GB on Average is cached and 1GB free, so not sure how creating a Swap file helps here.

I also have Amazon Drive account. When testing that with rclone and acd_cli, acd_cli is about twice as fast as rclone when streaming with Plex. However, downloading and uploading files are about the same speeds.

1 Like

I dont get this?
are we allocating swap to plex somehow?