Jellyfin Forum
Troubleshooting high memory usage (>10Gb idle) - 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: Troubleshooting high memory usage (>10Gb idle) (/t-troubleshooting-high-memory-usage-10gb-idle)

Pages: 1 2


Troubleshooting high memory usage (>10Gb idle) - volcs0 - 2024-07-26

My Jellyfin is idling with a high RAM usage - see attached.
Most of the time 10Gb-12Gb of RAM. Normally, I don't notice, but when other demands are put on the server, Jellyfin starts to glitch, and sometimes the whole system will seize up.

UnRAID 6.12.4
AMD Ryzen 5 7600 6-Core @ 3800 MHz
32 GiB DDR5 

lscr.io/linuxserver/jellyfin:latest

I've not doing anything special with any configuration.

How can I start chasing this down? I read about limiting Jellyfin RAM usage - not sure if that's the right approach.

Thanks.


RE: Troubleshooting high memory usage (>10Gb idle) - Efficient_Good_5784 - 2024-07-26

Most likely normal behavior, especially if you have a lot of content on your server. Jellyfin uses ram a lot to cache data.

Some of the devs have been investigating for a possible memory leak, but even then if something like that is found and fixed, Jellyfin will still cache a lot of data into ram.

Also, Jellyfin being a server, idling doesn't mean much. It's not supposed to release ram if nobody is using it. It's supposed to be running 24/7 waiting for a client to connect and stream, so having the cached data remain in ram is necessary for whenever a client decides to reconnect. It saves time from having to wait for the server to refetch the data again from the storage disks.

And it being cached data, it's supposed to be released whenever any other application needs to use ram.


RE: Troubleshooting high memory usage (>10Gb idle) - toytown - 2024-07-26

I'm using the official Jellyfin docker with only the "Playback Reporting" plugin installed extra. Jellyfin has been up 14 days so far has streamed/transcoded multiple films and is using 1.3GB of ram, my movie collection is over 13000 films, although no chapter or trickplay images are enabled. So i don't think having a large library is the culprit, could be a bad plugin.


RE: Troubleshooting high memory usage (>10Gb idle) - TheDreadPirate - 2024-07-26

Are you able to break out the processes running in the container? Is there a library scan in progress? Trickplays being generated? Either can spawn a lot of ffmpeg processes and consume memory.

In LSIO's image for 10.8.13 there was an issue where it did not honor the limit on the number of ffmpeg processes it can spawn when doing library scans/chapter image extraction. In my testing it spawned up to 200 ffmpeg processes and used 15GB of RAM. Like reserved RAM, not cache. I'm not sure if that also true for their 10.9 image.

Also, can you list out the docker environment variables for the jellyfin container? Do you have this env variable set?

MALLOC_TRIM_THRESHOLD_=131072


RE: Troubleshooting high memory usage (>10Gb idle) - volcs0 - 2024-07-26

(2024-07-26, 01:40 PM)TheDreadPirate Wrote: Are you able to break out the processes running in the container?  Is there a library scan in progress?  Trickplays being generated?  Either can spawn a lot of ffmpeg processes and consume memory.

In LSIO's image for 10.8.13 there was an issue where it did not honor the limit on the number of ffmpeg processes it can spawn when doing library scans/chapter image extraction.  In my testing it spawned up to 200 ffmpeg processes and used 15GB of RAM.  Like reserved RAM, not cache.  I'm not sure if that also true for their 10.9 image.

Also, can you list out the docker environment variables for the jellyfin container?  Do you have this env variable set?

MALLOC_TRIM_THRESHOLD_=131072

The only environment variables I have set are
JELLYFIN_PublishedServerUrl and NVIDIA_VISIBLE_DEVICES

How could I break out the processes running in the container? See attached for what I see in the container with top.

This could be related to Trickplay, I guess. My library has about 2500 movies and 2000 TV shows. And on a daily basis, I'm only adding 1-2 new items at most.

List of plugins attached.

Thanks for the help and ideas.


RE: Troubleshooting high memory usage (>10Gb idle) - TheDreadPirate - 2024-07-26

You set those two variables, but the container should come with its own. On the command line this command will list out all the environment variables, including any you added in the docker config.

Code:
sudo docker exec jellyfin env

I don't know about Unraid, but top/htop/btop on the host should list all the processes spawned by a container. You could also open a bash shell into the container. The container may not have top installed, but the LSIO image of Jellyfin does allow you to install packages.

Code:
sudo docker exec -t jellyfin bash

That should drop you in the container's shell. If top is not installed.

Code:
sudo apt install top



RE: Troubleshooting high memory usage (>10Gb idle) - volcs0 - 2024-07-26

(2024-07-26, 04:32 PM)TheDreadPirate Wrote: You set those two variables, but the container should come with its own.  On the command line this command will list out all the environment variables, including any you added in the docker config.

Code:
sudo docker exec jellyfin env

I don't know about Unraid, but top/htop/btop on the host should list all the processes spawned by a container.  You could also open a bash shell into the container.  The container may not have top installed, but the LSIO image of Jellyfin does allow you to install packages.

Code:
sudo docker exec -t jellyfin bash

That should drop you in the container's shell.  If top is not installed.

Code:
sudo apt install top

See attached for top command and my environment variables


RE: Troubleshooting high memory usage (>10Gb idle) - TheDreadPirate - 2024-07-26

That is not the correct env command.

You have to run the env command I provided from the HOST and not inside the container.

Also, wtf. 9.8G ffmpeg process?! I have never seen it use that much.

Run this command and it should output the full ffmpeg command so we can see what that is doing.

Code:
ps -aux | grep ffmpeg



RE: Troubleshooting high memory usage (>10Gb idle) - volcs0 - 2024-07-26

(2024-07-26, 05:01 PM)TheDreadPirate Wrote: That is not the correct env command.

You have to run the env command I provided from the HOST and not inside the container.

Also, wtf.  9.8G ffmpeg process?!  I have never seen it use that much.

Run this command and it should output the full ffmpeg command so we can see what that is doing.

Code:
ps -aux | grep ffmpeg

See attached screenshots for ENV and FFMPEG.
Thanks again for the help.


RE: Troubleshooting high memory usage (>10Gb idle) - TheDreadPirate - 2024-07-26

First, add this to your environment variables in the docker config. It should trigger jellyfin/docker to more aggressively conserve memory.

MALLOC_TRIM_THRESHOLD_=131072

Does the terminal not word wrap? The rest of the command is cut off.

Code:
ps -aux | grep ffmpeg > ffmpeg.txt
cat ffmpeg.txt