Jellyfin Forum
Excessive RAM consumption - 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: Excessive RAM consumption (/t-excessive-ram-consumption)

Pages: 1 2 3 4


Excessive RAM consumption - duplikk - 2024-02-27

Jellyfin at idle consumes a crazy amount of RAM. After 2 weeks uptime I have seen it climb to 5GB +. I've started to restart the container weekly to prevent this from happening.

Plex even while being used uses 500mb max.

[Image: SrzoGSA.png]


RE: Excessive RAM consumption - TheDreadPirate - 2024-02-27

This is likely due to Jellyfin's use of .Net, which caches aggressively to speed up Jellyfin's responsiveness. Unused memory is wasted memory. If you aren't running out of memory, I wouldn't be concerned and just leave it alone.

Which image are you using? The official jellyfin/jellyfin image or LSIO's image?


RE: Excessive RAM consumption - duplikk - 2024-02-28

(2024-02-27, 09:45 PM)TheDreadPirate Wrote: This is likely due to Jellyfin's use of .Net, which caches aggressively to speed up Jellyfin's responsiveness.  Unused memory is wasted memory.  If you aren't running out of memory, I wouldn't be concerned and just leave it alone.

Which image are you using?  The official jellyfin/jellyfin image or LSIO's image?

binhex/arch-jellyfin

I would like to use the memory for something else. Jellyfin keeps hogging all of it and causing OOM.

"Unusued memory is wasted memory" is a terrible mantra. Use what you need instead of making unoptimized software. Plex uses a fraction of what Jellyfin does, and is frankly still more responsive.


RE: Excessive RAM consumption - TheDreadPirate - 2024-02-28

Most of the memory jellyfin uses is cache. Memory used for caching and reserved memory for applications and application data behave significantly differently. If another app needs more memory, the cached memory will be immediately released to the other application. Most dashboards, like the screenshot you provided, do not distinguish between reserved memory and cache.


RE: Excessive RAM consumption - 34626 - 2024-02-28

You have 32 GB of ram, what else would you use them on, that requires over 25 GB ram?
Was the 5 GB ram usage while it had been transcoding?

Jellyfin might use more ram, but at least its Open Source and respects it's users privacy and then it's free.


RE: Excessive RAM consumption - Efficient_Good_5784 - 2024-02-28

(2024-02-28, 01:22 PM)duplikk Wrote: I would like to use the memory for something else.
As the @TheDreadPirate states, cached memory will be the first to be overwritten when a new program needs to use some ram. You're GUI screenshot doesn't show what is used and what is cached.

Take a look at this screenshot of my Synology's ram usage: https://imgur.com/fkl7Y4j

You can see that despite only having 150MB free out of 8GB, my ram utilization is only 13%.
I have 6.5GB used just for caching purposes by either the OS or applications running on the NAS.
If it wasn't for this cached data, the NAS would need to keep loading all that data from the slow HDDs each time.
The cached data doesn't count as used data (towards the utilization) since it's there with the expectation that it's the first to go when new programs need ram.

Windows even does this too. Look at this picture of my Windows computer's RAM being used at 37% full: https://imgur.com/UIxxr46
You'll notice that despite 20.4GB being used as cache (out of the 32GB), I still have over 20GB free to use for anything else.
Furthermore, this screenshot shows there's no free memory at all in the memory composition bar (memory that has nothing written to it). It's all either used or cached, but Windows doesn't say I'm out of memory.

(2024-02-28, 01:22 PM)duplikk Wrote: "Unusued memory is wasted memory" is a terrible mantra. Use what you need instead of making unoptimized software. Plex uses a fraction of what Jellyfin does, and is frankly still more responsive.
Jellyfin already does. If you find a memory leak (non-cache memory not being released after it's no longer needed), that's a bug and should be reported.
A lot of people don't understand that memory can be used for caching purposes, and with some GUIs not showing you what part of RAM is cached data, people tend to think high RAM utilization is bad.

You payed for the ram, why not use it all? It's literally in the name of the hardware, Random Access Memory.
It's meant to collect random bits of data to make data processing faster for the CPU. If it wasn't for RAM, you would have to rely on the slower disks to reload commonly used data.


RE: Excessive RAM consumption - WiseWeasel - 2024-02-29

Doesn't look like the binhex/arch-jellyfin image includes the MALLOC_TRIM_THRESHOLD_ environment variable.

https://github.com/binhex/arch-jellyfin/blob/master/Dockerfile#L36

The official image includes the environment variable that drastically reduced RAM usage for me. Went from over 10G after a few weeks of running to ~700M

https://github.com/jellyfin/jellyfin/pull/10454


podman image inspect --format '{{ index (index .Config.Env) 12 }}' docker.io/jellyfin/jellyfin:10.8.13-1


output:


MALLOC_TRIM_THRESHOLD_=131072



RE: Excessive RAM consumption - Petitgnoll6 - 2024-04-14

Hi guys, sorry for the necro thread.
And my question may not be the place but I couldn't find the answer on google.

I'm on LSIO image and I have much memory usage and I was wondering if LSIO image had the MALLOC fix.

I did not see it in https://github.com/linuxserver/docker-jellyfin/blob/master/Dockerfile but I don't know if it's the right place to look for it.

If anyone had the answer, it would be great !

Thanks


RE: Excessive RAM consumption - TheDreadPirate - 2024-04-14

In my experience with LSIO's image, the memory consumption on their current versions comes from ffmpeg. For some reason the LSIO version does not limit the number of ffmpeg processes during a library scan whereas the official image limits ffmpeg to 2x your thread count.

Is that what is going on here? Or do you have non-ffmpeg related memory consumption issues?


RE: Excessive RAM consumption - Petitgnoll6 - 2024-04-16

I actually don't know haha ! How could I check if it's ffmepg related or not ?

The ram amount (and swap too) increases over time, I guess it could be ram caching (the server runs fine) but that's why I wanted to know if the malloc fix was in LSIO (to know if it's only caching or if it could be a leak).

Thanks for you help