Gdrive+Cache+Encrypt = Terrible Lag/Buffer with Plex

Is there a particular reason you are using the cache backend? Do you get the same error without using mergerfs to rule that out?

Nope no reason at all other than that's how I thought this whole thing worked haha. I do like the encryption thing though can I still use that without the cache back end? How to I get rid of it? Just delete the cache mount?

Yes, you can mount the encrypt remote directly. You'd have to point the encrypted remote directly to your GD remote.

I probably won't need to redo the mergerfs mounts because they're pointed to the gdrive remote right?

Assuming you don't change your mount point name, it shouldn't matter.

Hmm, I am unable to get this to work. It mounts, but doesn't see the folder structure on the Google Drive.

What if I wiped out the cache remote and redid it? Would that do anything?

You have to change that from cache: to gdrive: and mount the crypt directly.

So if I change the cache mount to equal gdrive:/crypt and then after making that change if my mount script is:

rclone mount --allow-other --dir-cache-time=36h --cache-db-purge --buffer-size=0M --log-level INFO --log-file /home/td001/logs/rclone.log crypt: ~/mnt/gdrive &

That should work right?

Yes, you'd have to share your changes rclone.conf and what your new mount is and we can see what the issue is.

OK so here's the changes I made (hopefully they're correct):

OLD rclone.config

NEW rclone.config*

After making this change, and running that rclone mount script... it mounts successfully but I am unable to actually see any of the files on Gdrive when I try to do an "ls" of them. So of course this means the mergerfs mounts aren't picking anything up either. So it mounts, but we can't see anything.

Totally off topic... you don't think it had anything to do with that new crypt2 you helped me setup a few days ago do you? Like, if I'm uploading files to gdrive via that crypt2 mount, the crypt mount is unable to find certain chunks? Just a theory.

Clarity ninja edit: I wrote this post based solely on your original post, and not taking into account any differences in configuration you may have made since then.

So, I've never used mergerfs with this before, but I have an rclone mount command that has been (basically) lag-free on every single system (Linux Hetzner VPS, to local Windows 10 machine) I've tested it on when accessed by any applicable media program that I've cared to use it for, including but not limited to Plex. It uses the vfs-cache instead of the cache remote. Nobody in this thread suggested a similar one so I figured I'd throw it at you to at least let you try it.

Setup: change the crypt remote from cache:/crypt to gdrive:/secure/crypt/ (or make a second crypt remove to do the same thing; you need to remove the cache remote from the process entirely, you don't need it for the purpose of this command)

Adapting my mount command to you, based on your original post:

rclone mount --allow-other --rc --log-level INFO --log-file /home/td001/logs/rclone.log --vfs-cache-mode writes crypt:/ ~/mnt/gdrive &

Hopefully this works for you! Good luck!

Whoa! Now we're talking! No errors at all in the log and the playback is super smooth. Brief buffering with some of the more high def movies... not sure if I should add a setting that allows Plex to download more of the file - or @Animosity022 suggestion of buffer=0?

But this is day and night improvement. I think I'm a VFS man. Correct me if I am wrong, but VFS utilizes memory over disk space correct?

If using vfs, you'll want a buffer greater than zero. I'm not sure why people still use the cache back end for streaming. I suppose it's because the old guides still reference it.

Like this is a day and night difference! And to add to my small buffer issue... I think that was from running it from my laptop via a wireless connection which is probably not ideal with these larger 1080p/4k type films. When I ran it from my hardwired desktop the buffer was building and building - ZERO stoppages!

@calisro I did set this all up from the guides so yea, most likely. What's a good buffer to set this to? And why should it not be 0?

I use 128M. Zero turns off the buffer and the only reason that was suggested above is because you were using the cache backend.

OK I will play around with it to get the best setting. Should I remove the cache back end entry from my rclone.config?

Doesn't matter. If you're not using you can.

I'm really glad to hear that it worked so well! And yeah, a bunch of old guides still reference the cache backend which would never work for me no matter how much I tried, and I found this alternate (and way better) method in a few random places and dug into it within the online docs, and that brought me to today!

Per the rclone docs - https://rclone.org/commands/rclone_mount/

--vfs-cache-mode writes

In this mode files opened for read only are still read directly from the remote, write only and read/write files are buffered to disk first.

I think that means the buffering is automatic and doesn't need to be set, and honestly since everything works perfectly for me so far I haven't felt the need to experiment at all, but if you find an improved mount command please do post it!

Well sadly, the buffering is back. Albeit it typically after about 15min into a direct play movie (1080p) using the VFS settings and not the cache back end. I will get 15min of pure play time - before it buffers and from there, will buffer every 10 seconds. In saying that, I do believe this to be a Plex problem and not an Rclone problem. I just don't know where else or what else to tinker with in Plex as I feel I've exhausted everything with no real change.

I've tried to increase the buffer-size but doesn't seem to work. It's weird, it's like it starts off great getting lots of buffer and continuing to do so before it just stops bufferring ahead until playback finally catches up and the circle of buffer begins. Doesn't seem to be taxing CPU at all and there is 16gig of RAM devoted to this docker image (LSIO). Could it be because I'm running a docker container within a VM image? Who knows?

rclone mount --allow-other --log-level INFO --cache-db-purge --buffer-size=256M --log-file /home/td00/logs/rclone.log --vfs-cache-mode writes --dir-cache-time 24h crypt:/ ~/mnt/gdrive &

Again, I don't think this is rclone - I used to think it was network but now I'm beginning to think this is Plex just not transcoding properly. If anyone has suggestions I'm all ears.