My Tests and the Results Mergerfs with Cache vs Without

These are my notes for the tests i've done with rclone/mergerfs, cache backend and no cache backend. I'm not sure if it's legible enough so i'll explain;

I started off with the top listed drive.service and rclone.conf which includes cache backend.
I then only changed the chunk size at first and tested 1 movie with .ass soft embeded subtitles in jellyfin and counted the seconds it would load if i chose the 'burn subtitles' option which loads movie really slowly.
I then opened 1 song and counted, then another and counted.(movie and songs were the same every time).
Keep in mind i did delete my cache and restart rclone mount and mergerfs and jellyfin before starting each test.
It was easy to count seconds as the jellyfin preloader spins was decent at gauging it.

I also tried changing the workers option in the rclone.conf which sped things up as well.

In the end, it seems drive.service number 2, the first set of mergerfs options, and adding buffer-size 1g to drive.service number 2 ended up loading the video second fastest(35 second) and removing buffer-size completely(using rclone default) loaded the video fastest in 29 seconds.


drive.service 1

ExecStart=/usr/bin/rclone mount cache: /mnt/drive \
--allow-other \
--gid=1000 \
--uid=1000 \
--bind xx.xx.xx.xx \
--dir-cache-time 6570h \
--fast-list \
--cache-chunk-path=/data/.cache/rclone \
--cache-db-path=/data/.cache/rclone \
--log-file /opt/rclone/logs/rclone.log \
--umask 002 \
--log-level INFO \
--user-agent rclone

rclone.conf(with cache)

[cache]
type = cache
remote = drive:
chunk_size = 64M
info_age = 8760h
chunk_total_size = 50G
db_path = /data/.cache/rclone
chunk_path = /data/.cache/rclone
chunk_clean_interval = 5m
workers = 8

mergerfs.service options

-o rw,async_read=false,use_ino,allow_other,func.getattr=newest,category.action=all,category.create=ff,cache.files=auto-full,dropcacheonclose=true

changed options in rclone.conf and test results

workers = 8
chunk_size =128M
57 seconds to load movie
4 seconds to load song 1
4 seconds to load song 2
workers = 8
chunk_size =16M
47 seconds to load movie
9 seconds to load song 1
6 seconds to load song 2
workers = 8
chunk_size =256M
100 seconds to load movie
4 seconds to load song 1
5 seconds to load song 2
workers = 8
chunk_size =64M
43 seconds to load movie
3 seconds to load song 1
4 seconds to load song 2
workers = 8
chunk_size =32M
45 seconds to load movie
5 seconds to load song 1
4 seconds to load song 2
workers = 1
chunk_size =64M
100 seconds to load movie
4 seconds to load song 1
5 seconds to load song 2
workers = 4
chunk_size =64M
43 seconds to load movie
4 seconds to load song 1
4 seconds to load song 2

new drive.service 2 without cache backend

ExecStart=/usr/bin/rclone mount drive: /mnt/drive \
--allow-other \
--gid=1000 \
--uid=1000 \
--bind xx.xx.xxx.xxx \
--dir-cache-time 6570h \
--log-level INFO \
--log-file /opt/rclone/logs/rclone.log \
--poll-interval 15s \
--timeout 1h \
--umask 002 \
--user-agent rclone \
--rc \
--rc-addr 127.0.0.1:5572

test results with new drive.service

42 seconds to load movie
2 seconds to load song 1
3 seconds to load song 2

options changed in new drive.service

--buffer-size 1G
35 seconds to load movie
2 seconds to load song 1
2 seconds to load song 2
***remove buffer size completely(using default)
29 seconds to load movie
2 seconds to load song 1
2 seconds to load song 2

mergerfs options changes

this produces 53 seconds for the movie to load but not sure what mergerfs has to do with it. i checked twice and both times were 53 and 54 seconds

-o rw,async_read=false,use_ino,allow_other,func.getattr=newest,category.action=all,category.create=ff,cache.files=partial,dropcacheonclose=true

What do you mean by load a movie? When the first image appears on the player? What does a direct play image appear? I'd break it out from direct playing things and transcoding.

Just to give you an idea, I normally get an image at home with direct play in 2 seconds. On my iPhone over Celluar, a full transcode of 4k takes about 5 seconds to start playing.

image

Direct play is always instant no matter what.
Direct stream is what i test.
'Load a movie' means from the time the video starts playing sound and things start moving.
Don't worry about it being really slow. If i loaded the same video in plex as i did jellyfin, direct streaming would open it within 5 seconds every time. It's just an issue with jellyfin being slow. It was a 'true test' for me to see how slow/fast the same video loaded in jellyfin.
Also, if i loaded a non subtitle in jellyfin, it'd take 5 -8 seconds to load every time despite any settings i changed.
The true test is always problematic slow loading videos and music.
Music was fastest in my final test loading a song at 2 seconds.

But when i say instant for direct play(not stream) i actually 2 seconds. The time i press play to video moving is 2 seconds.

Direct play and direct stream should be about the same as it's just remuxing the container and not transcoding anything. Do you see major differences there?

I have both Plex and Emby lifetimes so I haven't tested nor planned to do anything with Jellyfin as it sounds great, but really isn't mature and based off an older version of Emby (which Emby is already buggy enough as it is).

Does Emby work ok? You should see the ffmpeg logs in Jellyfin and I'd think they'd be able to shed some light on the slowness.

I was going to give jellyfin a try but 30+ seconds. :weary: What is it that jellyfin is doing so differently as to take so long I wonder. What does the debug logs look like? (very off-topic i suppose)

Oh trust me, jellyfin is quite alpha.
It's a known issue that it doesn't know how to handle subtitles and it's buggy all over the place.
The things you take for granted on plex are things jellyfin struggles with.
Scanning for instance seems to be quite the task for them to overcome as well.
I wouldn't try jellyfin for another year minimum if you just like to use things that work.

1 Like

yeah emby is fine

So no cache is better and --buffer-size 16M (the default) is the fastest?

I suspect the cache might be quicker second time you loaded the song?

yes seems buffer-size 16m is faster even when loading a 10gb movie.
cache is absolutely faster the second time around, but unless there was a way to permanently tap/touch 100tbs of data i don't want to rely on that.

as for the default buffer-size(16m), i was confused so i did it a couple more times just to be sure.
However, i noticed minor stopping/stuttering of some video on 16m, so i went back to 1g

It really really depends on what the player is doing and how it's handling the file in terms of opening and closing it. It the file remains open, having a large buffer size and it direct playing will definitely help as rclone will read ahead the buffer size and give you some relief on the server in terms of using memory to keep the data there in case of a network blip or something.

If the player is direct streaming or transcoding (plex terms which both cause the file to be run through the transcoder), it really doesn't matter too much on the buffer size as in Plex/Emby there is a setting for the transcoder to read ahead and transcode up to x seconds. I usually keep that at 5 minutes / 300 seconds as that gives a buffer for that.

Some players though with direct play close/open the file repeatedly so having a large buffer would be bad since it reads ahead, closes the file and repeats the process so you get a lot of waste in there.

In Plex, music files are done this way from what I've tested and it's annoying so the cache backend works well for small music files since you can keep them on disk in the cache and it works well.

I've spent a lot of time over many months testing my Plex/Emby and my devices to make it work the best for my use case and my players. It definitely takes a bit of tinkering and exploring on what works best.