Jump to content

Emby and rclone are slow


Recommended Posts

Posted

I have an Emby media server where storage is attached via rclone mount. The backend is served through an app called Altmount (similar concept to nzbdav). My goal is to get movies to start playing in 1 second or less. Currently there's a noticeable delay on first play before Emby can start streaming the file. I tried kodi for emby and with webdav and webdav was noticeably faster so is there anyway or config that i can use in rclone to overcome this emby headings and make it faster? 

My rclone setujp is:
```
rclone:
  path: /config
  password: ""
  salt: ""
  rc_enabled: true
  rc_url: ""
  rc_port: 5573
  rc_user: admin
  rc_pass: admin
  rc_options: {}
  mount_enabled: true
  vfs_name: altmount
  mount_options: {}
  log_level: ERROR
  uid: 1000
  gid: 1000
  umask: "002"
  buffer_size: 32M
  attr_timeout: 5s
  transfers: 32
  cache_dir: /config/cache
  vfs_cache_mode: full
  vfs_cache_poll_interval: 10s
  vfs_read_chunk_size: 32M
  vfs_cache_max_size: 100G
  vfs_cache_max_age: 8760h
  read_chunk_size: 32M
  read_chunk_size_limit: 2G
  vfs_read_ahead: 2G
  dir_cache_time: 5s
  vfs_cache_min_free_space: 1G
  vfs_disk_space_total: 1G
  vfs_read_chunk_streams: 4
  allow_other: true
  allow_non_empty: true
  read_only: false
  timeout: 1h
  syslog: true
  no_mod_time: true
  no_checksum: true
  async_read: true
  vfs_fast_fingerprint: true
  use_mmap: true
  links: false
```

bunty_sam
Posted (edited)

I had similar slow start-up issue, I have mounted my seedbox to my home server and play from it. This is my setting, you might need to change the names in it. With this setting its working fine for months, no delay in stream response.

What my settings below does is mounts the seedbox, which is a WebDAV mount, I also have a cache directory setup so that rewinds are faster and its kept for 7 days, so within 7 days if same content is played then there will not be any need to stream from the seedbox again, it will play locally.

You will need to use your user name, group name, mount location, rclone mount name to customise it for yourself.

I think this will solve your issue.

Persistent Rclone Seedbox Mounting through WebDAV automation

[Unit]
Description=Rclone Mount for Seedbox (Jellyfin Optimized)
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=60
StartLimitBurst=5

[Service]
Type=simple
User=bunty
Group=bunty

ExecStart=/usr/bin/rclone mount Seedbox-WebDAV:/ /mnt/Seedbox \
  --config=/home/bunty/.config/rclone/rclone.conf \
  --vfs-cache-mode=full \
  --cache-dir=/media/bunty/CCL-1TB/rclone-cache \
  --vfs-cache-max-size=500G \
  --vfs-cache-max-age=168h \
  --dir-cache-time=1h \
  --vfs-read-chunk-size=16M \
  --vfs-read-chunk-size-limit=1G \
  --vfs-read-ahead=128M \
  --buffer-size=128M \
  --transfers=8 \
  --checkers=8 \
  --allow-other \
  --umask=002 \
  --uid=1000 \
  --gid=1000 \
  --log-file=/home/bunty/rclone-mount.log \
  --log-level=INFO

ExecStop=-/bin/fusermount -uz /mnt/Seedbox

Restart=on-failure
RestartSec=10
LimitNOFILE=65536
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

 

Save the file as rclone-seedbox.service in /etc/systemd/system/


sudo systemctl daemon-reload
sudo systemctl enable rclone-seedbox.service
sudo systemctl restart rclone-seedbox.service
sudo systemctl status rclone-seedbox.service --no-pager

 

 

if everything goes alright then you will see something like this, and then you restart the emby container or the server itself and see if stream start-up time is fixed

image.thumb.png.633f4044bdfc9d77d83a6a54fe26ffce.png

Edited by bunty_sam
kikinjo
Posted

You need to optimize rclone mount. You have many settings that are not needed at all, chunk reading and others. keep it simple and use only  --buffer-size=64M \

esmailelbob
Posted
30 minutes ago, bunty_sam said:

I had similar slow start-up issue, I have mounted my seedbox to my home server and play from it. This is my setting, you might need to change the names in it. With this setting its working fine for months, no delay in stream response.

What my settings below does is mounts the seedbox, which is a WebDAV mount, I also have a cache directory setup so that rewinds are faster and its kept for 7 days, so within 7 days if same content is played then there will not be any need to stream from the seedbox again, it will play locally.

You will need to use your user name, group name, mount location, rclone mount name to customise it for yourself.

I think this will solve your issue.

Persistent Rclone Seedbox Mounting through WebDAV automation

[Unit]
Description=Rclone Mount for Seedbox (Jellyfin Optimized)
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=60
StartLimitBurst=5

[Service]
Type=simple
User=bunty
Group=bunty

ExecStart=/usr/bin/rclone mount Seedbox-WebDAV:/ /mnt/Seedbox \
  --config=/home/bunty/.config/rclone/rclone.conf \
  --vfs-cache-mode=full \
  --cache-dir=/media/bunty/CCL-1TB/rclone-cache \
  --vfs-cache-max-size=500G \
  --vfs-cache-max-age=168h \
  --dir-cache-time=1h \
  --vfs-read-chunk-size=16M \
  --vfs-read-chunk-size-limit=1G \
  --vfs-read-ahead=128M \
  --buffer-size=128M \
  --transfers=8 \
  --checkers=8 \
  --allow-other \
  --umask=002 \
  --uid=1000 \
  --gid=1000 \
  --log-file=/home/bunty/rclone-mount.log \
  --log-level=INFO

ExecStop=-/bin/fusermount -uz /mnt/Seedbox

Restart=on-failure
RestartSec=10
LimitNOFILE=65536
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

 

Save the file as rclone-seedbox.service in /etc/systemd/system/


sudo systemctl daemon-reload
sudo systemctl enable rclone-seedbox.service
sudo systemctl restart rclone-seedbox.service
sudo systemctl status rclone-seedbox.service --no-pager

 

 

if everything goes alright then you will see something like this, and then you restart the emby container or the server itself and see if stream start-up time is fixed

image.thumb.png.633f4044bdfc9d77d83a6a54fe26ffce.png

It took me 2-3s but mostly 2s, can we get lower?

bunty_sam
Posted
3 minutes ago, esmailelbob said:

It took me 2-3s but mostly 2s, can we get lower?

I was happy with 2-3s so I don't know if it's possible to lower it further, but I think it depends on the transfer rate. Though, the cached files will start playing instantly since they are available locally.

esmailelbob
Posted
22 minutes ago, kikinjo said:

You need to optimize rclone mount. You have many settings that are not needed at all, chunk reading and others. keep it simple and use only  --buffer-size=64M \

I tested it wtih:
 

rclone:
  path: /config
  password: ""
  salt: ""
  rc_enabled: true
  rc_url: ""
  rc_port: 5573
  rc_user: admin
  rc_pass: admin
  rc_options: {}
  mount_enabled: true
  vfs_name: altmount
  mount_options: {}
  
  # Set to INFO temporarily per Bunty's setup to verify it works, can change to ERROR later
  log_level: INFO

  # Permissions
  uid: 1000
  gid: 1000
  umask: "002"
  allow_other: true
  allow_non_empty: true
  read_only: false
  
  # ==========================================
  # BUNTY'S CACHE SETTINGS
  # ==========================================
  vfs_cache_mode: full
  cache_dir: /config/cache
  vfs_cache_max_size: 100G       # Kept your 100G limit
  vfs_cache_max_age: 168h        # Bunty's 7 days (168 hours)
  vfs_cache_poll_interval: 10s
  vfs_cache_min_free_space: 1G
  vfs_disk_space_total: 1G
  
  # ==========================================
  # BUNTY'S BUFFER & CHUNK SETTINGS
  # ==========================================
  buffer_size: 64M              # Bunty uses a large RAM buffer
  vfs_read_chunk_size: 16M       # Bunty's sweet-spot for WebDAV TTFB
  vfs_read_chunk_size_limit: 1G  # Caps exponential growth
  vfs_read_ahead: 128M           # Bunty's balanced read-ahead
  vfs_read_chunk_streams: 4      
  
  # ==========================================
  # BUNTY'S METADATA / DIR CACHE
  # ==========================================
  dir_cache_time: 1h             # Bunty's 1-hour directory cache
  attr_timeout: 1h               # Matching dir_cache_time
  
  # ==========================================
  # BUNTY'S NETWORK SETTINGS
  # ==========================================
  transfers: 8
  checkers: 8
  timeout: 1h
  
  # ==========================================
  # SYSTEM TWEAKS (Kept from your setup)
  # ==========================================
  syslog: true
  no_mod_time: true
  no_checksum: true
  async_read: true
  vfs_fast_fingerprint: true
  use_mmap: true
  links: false

but still same results 2-3s

esmailelbob
Posted
13 hours ago, esmailelbob said:

I have an Emby media server where storage is attached via rclone mount. The backend is served through an app called Altmount (similar concept to nzbdav). My goal is to get movies to start playing in 1 second or less. Currently there's a noticeable delay on first play before Emby can start streaming the file. I tried kodi for emby and with webdav and webdav was noticeably faster so is there anyway or config that i can use in rclone to overcome this emby headings and make it faster? 

My rclone setujp is:
```
rclone:
  path: /config
  password: ""
  salt: ""
  rc_enabled: true
  rc_url: ""
  rc_port: 5573
  rc_user: admin
  rc_pass: admin
  rc_options: {}
  mount_enabled: true
  vfs_name: altmount
  mount_options: {}
  log_level: ERROR
  uid: 1000
  gid: 1000
  umask: "002"
  buffer_size: 32M
  attr_timeout: 5s
  transfers: 32
  cache_dir: /config/cache
  vfs_cache_mode: full
  vfs_cache_poll_interval: 10s
  vfs_read_chunk_size: 32M
  vfs_cache_max_size: 100G
  vfs_cache_max_age: 8760h
  read_chunk_size: 32M
  read_chunk_size_limit: 2G
  vfs_read_ahead: 2G
  dir_cache_time: 5s
  vfs_cache_min_free_space: 1G
  vfs_disk_space_total: 1G
  vfs_read_chunk_streams: 4
  allow_other: true
  allow_non_empty: true
  read_only: false
  timeout: 1h
  syslog: true
  no_mod_time: true
  no_checksum: true
  async_read: true
  vfs_fast_fingerprint: true
  use_mmap: true
  links: false
```

I tried to run locally and it was still slow 7s to startup 

Also I ran commands to Bypass Rclone & Emby
 

# Clear caches first!
curl -u usenet:[pass] \
     -r 0-2000000 \
     -o /dev/null \
     -s -w "TTFB (Altmount + Usenet): %{time_starttransfer} seconds\n" \
     "http://localhost:8080/webdav/movies/Forrest.Gump.1994.REMASTERED.1080p.BluRay.X264-AMIABLE/Forrest.Gump.1994.REMASTERED.1080p.BluRay.X264-AMIABLE.mkv"

and ran to Bypass Emby
 

# Clear caches first!
time head -c 2000000 /mnt/altmount/movies/Forrest.Gump.1994.REMASTERED.1080p.BluRay.X264-AMIABLE/Forrest.Gump.1994.REMASTERED.1080p.BluRay.X264-AMIABLE.mkv > /dev/null

and borth results are: TTFB (Altmount + Usenet): 0.000000 seconds and real 0m0.007s user 0m0.000s sys 0m0.004s so I'm not sure anymore what cause the 2s thing

esmailelbob
Posted
6 hours ago, bunty_sam said:

I was happy with 2-3s so I don't know if it's possible to lower it further, but I think it depends on the transfer rate. Though, the cached files will start playing instantly since they are available locally.

yeah seems like it, no matter what i try and i cant break 2s. thank you for sharing config tho ❤️

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...