New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow direct play startup #873
Slow direct play startup #873
Comments
I'm having the same problem. It's far worse when the server has 200ms ping, it often takes longer than a minute to start. |
I finally narrowed mine down to being caused by a poor NFS mount in my library. Something in my NAS/NFS exports was causing massive slowdowns where jellyfin was concerned, but had fine performance in other tests. I've temporarily fixed it by using sshfs mounts instead of nfs mounts to my library. I'm planning on going back and doing more tests to see if I can pinpoint exactly what's causing it, though. |
My current suspects would be slow syscalls on such shares, would be great if you could |
I'm hoping to get a good |
I'm running my Jellyfin on Google Drive mounted with rclone, so I assume I'm also having the same problem. I can also do some profiling soon. |
Ran several tests, mostly searching for specific open or read calls that were taking a lot of time, but I couldn't find any. I finally ran with
Each api call/direct play stream has about a 12.5 second response time still, according to the JF logs, but none of the syscalls indicate that. The futex has ~11 seconds total, but it didn't seem to be being called in real time as a direct play was started. I didn't see any new calls when a direct play was started, actually. |
Issues go stale after 60d of inactivity. Mark the issue as fresh by adding a comment or commit. Stale issues close after an additional 7d of inactivity. If this issue is safe to close now please do so. If you have any questions you can reach us on Matrix or Social Media. |
Update: Reports from users on matrix that this is still happening. FreeBSD host, Linux VM. Probably needs to be reopened |
Received reports of similar issues when using Open Media Vault from dinki on matrix |
Syscalls (and their timings) gathered by |
This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments. |
Discussed in chat again. Still happening in rare circumstances. Josh ran into a likely related issue when setting up https://github.com/joshuaboniface/rffmpeg. Quote from chat:
|
I'm also running into this issue on an Ubuntu server with a NFS mounted library. Transcoding streams start almost immediately but direct play streams take between 5-15 seconds to start. |
I have the same behavior and it seems possible to reproduce on at least my system. I cannot reinstall the host-machine this has been tried on, but the slow behavior is repeatable and has a strace attached Setup is on a single machine:
Latency between VM and host is <1ms NFS share mount-options: rw,noatime,vers=3,rsize=32768,wsize=32768,hard,proto=udp,timeo=11,retrans=3,sec=sys,mountvers=3,mountproto=udp,local_lock=none
strace collected via:
CPU during these tests remain below 5%
I also noticed that you can cause an even higher response-times by pressing play on a few files without waiting for the audio to start playing.
Give me a shout if you want specific traces.. This jellyfin VM is setup for testing/debugging.. |
Since I had this issue in a few of my other .NET applications I went ahead and created an issue in the .NET repository: It's reproducible even with a blank C# project so I assume the fault doesn't lie with Jellyfin in this case. That also explains why transcoding doesn't have this issue since ffmpeg accesses the file directly. |
I think I have identified the problem, my NFS share points to a mergerfs mount. Recently I had an issue with stale file handles and applied the options listed here. The problem is now gone and my C# applications (including JF) no longer have a 6 second delay. Can anyone comment if they use any other fuse file systems or even mergerfs? This would still be a .NET problem but at least there's a way to work around it. |
I use mergerfs with snapraid and have immediate DirectPlay playback |
I had the same problem as above also and filed a separate issue before finding this (#6559). I ended up mounting the drives as SMB and passing through the directories as a workaround. |
The issue in the .NET-repo now received an update which should solve the performance issues: dotnet/runtime#48757 (comment)
For me mounting with the nolock-option solved the problem. Is the first option something which should/could be added in jellyfin (don't really know anything about .NET)? Else it might be good to add these solutions to the storage-documentation. |
Adding it to the docs is probably the best solution for the time being. Feel free to open a PR adding for it here if you're willing. |
Describe the solution causing slow directplay startup issues with NFSv3, which is discussed in this issue on the jellyfin-repository jellyfin/jellyfin#873 Fixes jellyfin/jellyfin#873
Had this exact problem today when moving my library from a freenas nfs share to a truenas scale nfs share. All the server side mount settings were alike so was the client mount options (nfs 3). The nolock option did however solve the problem straight away. |
I too was sharing from truenas scale and this has fixed it for me. Thank you! |
Describe the bug
Direct play from the server has large initial slowdowns, taking an average of 12 seconds to send a response to the client.
To Reproduce
Trigger a direct play using the API:
http://192.168.0.200:8096/emby/Videos/{{ item_id }}/stream?static=true
Expected behavior
The video starts playing immediately, or within a few seconds
Logs
System (please complete the following information):
Additional context
Direct streaming works with almost no initial delay, the problem seems to be limited to Direct Play features
The text was updated successfully, but these errors were encountered: