Possible to cap VFS download speed

I’ve got VFS working fine - as long as I keep an eye on my overall network traffic.

I’ve just been monitoring the bandwidth usage on one of my larger 35GB film and it was spiking at 80-100Mbps. I’m on a 200/200 connection, so 2-3 streams like this will max out my line - and that’s before any other usage!

The movie was roughly 2 hours long so needs around 40Mbps on average by my reckoning (without factoring in any overhead), so it looks like rclone is grabbing way more than it needs because it can.

My current mount is

rclone mount --allow-other --dir-cache-time 48h --vfs-read-chunk-size 32M --vfs-read-chunk-size-limit 2G --buffer-size 512M --umask 002 --bind 172.30.12.2 --cache-dir=/mnt/user/rclone/vfs --vfs-cache-mode writes --log-level INFO --stats 1m gdrive_media_vfs: /mnt/disks/rclone_vfs

If I increase --vfs-read-chunk-size to 64M this seems to reduce bandwidth usage, although this might be my imagination. Are there any other steps I can take to control bandwidth usage?

Thanks in advance

I wouldn’t worry too much.

It spikes to fill up the buffer usually so you should see a more ‘spike’ type graph that goes up and down.

In my example, I had 1 file being played and there is a nice spike and it goes to nothing after the buffer is filled (or pretty low).

image

My traffic spikes for much longer than to just fill up the buffer - for big movies e.g. the 35GB example it never dropped off even when I was about 10 mins in. I’ll double-check when I watch a whole movie over the weekend.

if it was filling the buffer it would drop off in under a minute.

It would spike to fill the buffer and stay pretty consistent on the overall bitrate of the movie:

hmmm I think you’re right

com_tautulli_home

I need to research why Plex thinks it needs twice as much bandwidth

Edit:

Ok now I see why

https://support.plex.tv/articles/227715247-server-settings-bandwidth-and-transcoding-limits/

Note: If the deep analysis for a file hasn’t yet been performed, your Plex Media Server will assume a [2 x average bitrate] value if it’s needed for streaming limitation calculations.

Guess I’m going to have to turn that on in maintenance and hope I don’t get API hits

You do get overhead in transferring the file as well so it’s not a perfect science.

The quality is just the average so it jumps up and down depending on the scene in the movie as well.

That’s just what it assumes for limitations if you configure bandwidth restrictions. It’s not how much actual bandwidth it needs.

But I think Plex thinks that’s the bitrate it needs and hence it reads the file that fast:

Using that information, your Plex Media Server can work together with your Plex app to figure out how much bandwidth is really required to stream something. For example, to direct play that previous “3.5 Mbps average bitrate” file:

an app that has a large buffer might only need ~5.4 Mbps of bandwidth to ensure smooth playback
a different app with a smaller buffer might need ~8.4 Mbps of bandwidth because the smaller buffer can’t tolerate spikes as well

So because I haven’t done a deep analysis, it’s pulling twice the bitrate it needs

No, it isn’t.

image

It’s just for streaming limitations. It’s runs the same transcode command either way so what it actually uses won’t change.

In your logs, you can see the transcode info as an example:

-rwxr-xr-x 1 plex plex   93875 Jul 13 20:02 'Plex Transcoder Statistics.1.log'
-rwxr-xr-x 1 plex plex   76583 Jul 13 20:03 'Plex Transcoder Statistics.log'

Sorry, I’m clearly not getting something here. Or we’re talking about different ‘hops’

I’ve turned off all my bandwidth controls in Plex (limit stream bitrate, limit number of concurrent etc) and 8 mins into my 35GB movie my plex server is still downloading at over 80Mbps on average.

I think you’re referring to the hop from server–>client. I’m not running plex in a VPS like you, so I see the traffic from GD–>Plex.

I think you’re right that the server–>client hop is controlled by the brain and I’m wrong. But, I’m still getting 2x the average bitrate from GD—>plex

I don’t use a VPS either.

Plex is going to grab the file as quickly as it can to get it’s transcode buffer full. It’s doing exactly what it should be doing. You have a really hit bitrate movie that you are streaming and it’s transcoding it to fill up whatever settings you have here as well:

Since your line is a little slower than mine as example, you get a longer spike until it finally throttles the transcode.

What are you using to validate it’s constantly pulling down 80Mb/s of data?

I have a pfsense router so I’m watching the live traffic for my unraid server. It’s trickling along at the moment at around 2Mbps as I assign unique IPs/VLANs to my dockers. As soon as I hit play it jumps to 80-100Mbps and doesn’t drop off for more than a split second even after 8 mins.

I just tried dropping the throttle buffer to 10 (I had 300) - but as I understand it, that’s only at the start of play to give playback a boost, not for the whole duration.

Going to sleep on it to see if I come up with an answer.

Can you share the graph of what you are looking at?

If you download plex media player for your computer, you can bring up the debug window with shift-control-d and see the bitrate. My movie is a 45GB file but the bitrate average is 44Mb/s, but with a little action on the screen it easily goes much higher.

That’s the bitrate between plex server and the client - the bandwidth I’m referring to is between google and the plex server where I’m seeing x2 that bitrate and it doesn’t seem to drop off, even after 8 mins. If I was seeing 100Mbps bitrates to my clients they would start struggling on my wi-fi!!!

I will watch a film all the way through at some point today to see if it drops off e.g. after 30 mins. Even so, 8 mins using that much bandwidth is a lot especially if it doesn’t need that much and my original question stands - is there a way to limit?

The bandwidth between Google and plex server is some what affected by your rclone setting if rclone and plex server reside in the same machine. For example, play with rclone mount or vfs chunk size and buffer-size option, you will find that the bandwidth change. However it’s not exact science because it also depends on plex server operation on that file.
When i chooze vfs-chunk size smaller 4mb during plex analyzing files. Plex analyze much faster at the cost of more api request. The bandwidth used is also much smaller during this period of time, probably around 1mbps spikes for bandwidth between Google to rclone between rclone to plex its even smaller because plex needs smaller chunks here and there to perform analysis. Once i change buffer-size and vfs-chunk size to 128mb etc, the bandwidth spikes and average bandwidth usage is much higher.

You can use --bwlimit to limit the bw rclone is using. I think you are missing the overall concept though. Based on your config, if rclone is serving data and plex is asking for it. Rclone is going to serve it as fast as possible, which is what you want it to do.

Here’s an example from my data last night when I had 5 or so streams going but most of them were low bitrate.

The high bitrate 4k movie was started by me at like 22:00.

You can see near the end of the movie, it drops down.

4MB might be a tad small and inefficient.

128MB would be way too big. If you let Plex analyze a few files and have rclone in debug, you can see how many pieces of the file it get. You really want to find a sweet spot between the # of API calls and what your goal is.

Larger chunks would be probably more efficient for streaming a file but worse for analyzing as that opens up the start and end of a file so if it grabs too much, it is all waste.

For my internet connection 8-16mb yield the fastest plex analysis and general low bitrate playback. But playback is best at around 64-128mb for remux files i have