Slow Start / Buffering with Plex

I think I’m past all my cache and other related items but I’m trying to figure out what’s going on with playing anything via the mount.

My rclone config is GD->Cache->Crypt:

type = drive
client_id = clientid
client_secret = secret
token = {"access_token":"token","expiry":"2018-03-25T09:22:00.421861587-04:00"}

type = cache
remote = GD:media
chunk_total_size = 64G

type = crypt
remote = gcache:
filename_encryption = standard
password = password
password2 = password
directory_name_encryption = true

I’ve played around with moving the cache-chunk-size from 16M to 32M to super large values. I’ve played around with doing the same from the -buffer-size. I’ve tried move the cache-workers around a little. In the end, I can’t seem to figure out a combination that gives me playback that actually functions:

ExecStart=/usr/bin/rclone mount gmedia: /gmedia \
   --allow-other \
   --dir-cache-time=1m \
   --cache-chunk-size=32M \
   --cache-info-age=168h \
   --cache-workers=5 \
   --buffer-size=256M \
   --attr-timeout=1s \
   --log-level DEBUG

I’m on gigabit FIOS and my plexdrive config is almost defaults. I shared before that I use mergerfs over unionfs as that gives me a better ability to write locally first and keep my read/write mount for things as well.

I map a /data/local/movies or tv first in my path to write things to and my GDrive second:

usr/bin/mergerfs -o defaults,allow_other,use_ino,category.action=all,category.create=ff /data/local/movies:/media/Movies /Movies

My overall plexdrive setup has been working since Aug-2017. If I start a movie on GD, it almost feels if it was local. I can’t tell the difference. I’ve had ~6 streams going via my GDrive without an issue. My goal was to remove an extra layer from the puzzle to simplify things but haven’t been able to do that yet.

Logfile is posted at:

Do you think this might be the cause of the problem? Some bad interaction between rclone mount and mergerfs/unionfs? Have you tried it without?

Hmm. It definitely does seem to play better via a direct mount, but can’t say I’m sure why that would be the case.

Is there anything obvious in the logs that show what might be misbehaving? I’m just confused as the same config runs with plexdrive so I’m not sure what the difference would be.

Hmm, seems to be something related back to the defaults:

defaults: a shortcut for FUSE's atomic_o_trunc, auto_cache, big_writes, default_permissions, splice_move, splice_read, and splice_write. These options seem to provide the best performance.

I flipped back to something a bit more specific for unionfs and I’m letting my scan finish now but some test plays really seemed be working better.

I changed from the # to the second item:

#ExecStart=/usr/bin/mergerfs -o defaults,allow_other,category.action=all,category.create=ff /data/local/movies:/gmedia/Movies /Movies
ExecStart=/usr/bin/mergerfs -o allow_other,direct_io,auto_cache,sync_read,category.action=all,category.create=ff /data/local/movies:/gmedia/Movies /Movies

I think the option most likely to have made a difference here is sync_read

It would be interesting if you’ve got the time to narrow it down a bit.

I expect it will be some bad interaction with buffering which might be very difficult to spot in the log if you don’t already know what the problem is!

Yes, sync_read definitely seems to be it.

I left it to:

ExecStart=/usr/bin/mergerfs -o defaults,sync_read,allow_other,category.action=all,category.create=ff /data/local/movies:/gmedia/Movies /Movies

And everything is playing and streaming properly. I tested with small files and some 4K huge bitrate files as well. I can continue testing now with just rclone :slight_smile:


So for future reference if using mergerfs with rclone the sync_read option should be avoided. Is that correct?

Should be used. When I added the option, it started to work properly for me.

i am using mergerfs with rclone for quite a while now, never had any problems with this:

mergerfs -o defaults,ro,allow_other,use_ino,dropcacheonclose=true,symlinkify=true,symlinkify_timeout=10,fsname=mymount /path/to/local/files:/path/to/rclone/mount

Not sure. With my particular command, I couldn’t get anything to play for more than ~5 second without buffering and not working at all.

Once I made some tweaks, it worked fine.

I’ve removed the merger bit completely thought by using the cache upload with cache-writes so my whole config is just with rclone at the moment so no more mergerfs.