Jellyfin Forum
CPU - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: CPU (/t-cpu)

Pages: 1 2


CPU - thbkk - 2024-10-17

I am running Jellyfin on my Raspberry Pi with all transcoding settings disabled, using it exclusively for direct play. The system has sufficient RAM and generally runs smoothly. However, when I access Jellyfin through
http://192.168.1.69:8096/
and navigate to the settings, the CPU usage spikes dramatically for 1-2 minutes. The same issue occurs when I open the Jellyfin app on an Android device, with multiple peaks of extremely high CPU usage. Unfortunately, this causes the system to become unresponsive, sometimes even resulting in a crash.
Do you know why Jellyfin is unstable and why these CPU spikes occur even when no video is being streamed?


RE: CPU - Fate - 2024-10-17

Try logging into the Pi and watch top (then C) for commandline view and check which jellyfin/ffmpeg process is using the CPU.

Also try to get the error log when jellyfin crashed.


RE: CPU - alleycat - 2024-10-17

You did see this in the documentation? I understand if you had a Pi laying around and wanted to try it... Just using it on a lan, you might get away with it.

"Potentially Problematic Hardware

These hardware platforms might lead to a poor Jellyfin experience. Please be careful to avoid them when shopping for hardware.

    Most SBCs (Single Board Computers): Most SBCs (Including Raspberry Pis and especially the Pi 5) are too slow to provide a good Jellyfin experience. If You really want to run Jellyfin on a SBC, please look at models based on the following platforms: Rockchip RK3588 / RK3588S, Intel Core, Intel 12th gen N series."


RE: CPU - TheDreadPirate - 2024-10-17

Share the log via pastebin. And also describe your setup. What OS? Is there any virtualization (Docker)? If Docker, which image? Linuxserver or official? How is storage setup? Is the Jellyfin database on a local disk?


RE: CPU - thbkk - 2024-10-17

I understand that the Raspberry Pi 4 isn't the most powerful hardware for this purpose, but it should be able to handle the task. I'm using Jellyfin in a Docker container on a Raspberry Pi running Raspbian OS, with storage connected via a NAS. The database, I believe, is stored on the Raspberry Pi itself.

The issue only occurs occasionally. For example, I recently tested playing a 4K movie. Initially, the CPU usage was at maximum, and the playback started lagging. After stopping the movie and starting it again, the playback was smooth, and the CPU usage was normal. This is strange, especially since transcoding is disabled.

Perhaps I should consider using Jellyfin only with an external player like VLC. That way, I can be sure that no unnecessary transcoding is taking place.

Please review my logs and CPU usage data.

Code:
[2024-10-17 16:14:07.851 +02:00] [INF] [3] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "192.168.1.197" request
[2024-10-17 16:14:32.608 +02:00] [INF] [12] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Webhook Item Added Notifier" Completed after 0 minute(s) and 0 seconds
[2024-10-17 16:15:02.608 +02:00] [INF] [3] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Webhook Item Added Notifier" Completed after 0 minute(s) and 0 seconds
[2024-10-17 16:15:21.048 +02:00] [INF] [15] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for "123". EnablePlaybackRemuxing: False EnableVideoPlaybackTranscoding: False EnableAudioPlaybackTranscoding: False
[2024-10-17 16:15:43.170 +02:00] [INF] [23] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Webhook Item Added Notifier" Completed after 0 minute(s) and 0 seconds
[2024-10-17 16:15:44.046 +02:00] [WRN] [10] Microsoft.AspNetCore.Server.Kestrel: As of "10/17/2024 14:15:43 +00:00", the heartbeat has been running for "00:00:16.3524602" which is longer than "00:00:01". This could be caused by thread pool starvation.
[2024-10-17 16:16:54.202 +02:00] [INF] [19] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.
[2024-10-17 16:16:54.203 +02:00] [INF] [19] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Webhook Item Added Notifier" Completed after 0 minute(s) and 0 seconds
[2024-10-17 16:16:54.319 +02:00] [INF] [19] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.
[2024-10-17 16:17:29.555 +02:00] [INF] [12] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Webhook Item Added Notifier" Completed after 0 minute(s) and 0 seconds
[2024-10-17 16:17:29.706 +02:00] [WRN] [10] Microsoft.AspNetCore.Server.Kestrel: As of "10/17/2024 14:17:29 +00:00", the heartbeat has been running for "00:00:27.4382438" which is longer than "00:00:01". This could be caused by thread pool starvation.
[2024-10-17 16:18:02.409 +02:00] [INF] [12] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Webhook Item Added Notifier" Completed after 0 minute(s) and 0 seconds
[2024-10-17 16:18:02.534 +02:00] [WRN] [10] Microsoft.AspNetCore.Server.Kestrel: As of "10/17/2024 14:18:02 +00:00", the heartbeat has been running for "00:00:12.6974712" which is longer than "00:00:01". This could be caused by thread pool starvation.
[2024-10-17 16:18:32.410 +02:00] [INF] [24] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Webhook Item Added Notifier" Completed after 0 minute(s) and 0 seconds
[2024-10-17 16:19:44.597 +02:00] [INF] [11] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app "Android TV" "0.17.6" playing "ABC". Stopped at "106777" ms



RE: CPU - Fate - 2024-10-17

Well that is not really what we need, do you have a transcode log or a log from within jellyfin as well?

Also even if you disable video transcoding this would allow for audio transcoding or burning in subtitles which are CPU tasks.
Thinking about it even just repackaging the container to HLS will be a heavy task for a raspi4

Also Docker within raspi is another performance penalty....


RE: CPU - TheDreadPirate - 2024-10-17

There are multiple ffmpeg processes, which tells me this is either a library scan or trickplays generating.

If you see this again, run this command and share the output.

Code:
sudo ps -aux | egrep "jellyfin|ffmpeg" | cat

If these are ffmpeg processes related to either a library scan or trickplays, there are settings to cap the number of threads.

Dashboard > General > Parallel library scan tasks limit/Parallel image encoding limit
Dashboard > Playback > Trickplay > FFmpeg Threads


RE: CPU - thbkk - 2024-10-17

Currently, no problems. AS I said, sometimes no problem but then another CPU peaks. I keep you updated.

Dashboard > General > Parallel library scan tasks limit/Parallel image encoding limit
Dashboard > Playback > Trickplay > FFmpeg Threads

I already set both to 1.

root 2138 0.0 0.0 208 8 ? S 08:43 0:00 s6-supervise svc-jellyfin
root 2633 4.8 31.5 274847668 1167300 ? Ssl 08:43 33:48 /usr/bin/jellyfin --ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg
raspi 91968 0.0 0.0 6040 640 pts/1 S+ 20:17 0:00 grep -E --color=auto jellyfin|ffmpeg


RE: CPU - TheDreadPirate - 2024-10-17

You'd have to share your full log the next time it happens. The log should container the full ffmpeg command, which would indicate what is spawning the process.


RE: CPU - thbkk - 2024-10-17

Where can I download the whole log? I just see the logs in jellyfin under admin panel.