Jellyfin Forum
Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions)
+--- Thread: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve (/t-can-someone-help-me-figure-out-how-to-reduce-jellyfin-s-memory-usage-to-the-same-leve)

Pages: 1 2


Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - 21tc_sea - 2024-04-23

Hello everyone!

I've been running containers for both Jellyfin and Emby using Docker and have mounted the same media library to each. I am working with Jellyfin version 10.8.13 and Emby version 4.8.0.56. After starting the containers, I encountered a couple of issues with Jellyfin that I'm not sure how to resolve and would greatly appreciate any help or guidance from the community.
[Image: jf-start-debug.png]
The first issue is that the Jellyfin container takes a considerable amount of time, around 10-20 minutes, to start up and allow access to the web page. In contrast, the Emby container with the same media library only takes about a minute. I checked the Jellyfin logs and noticed that it always seems to pause at a specific point during startup for a long time before it continues to log output. I've captured a screenshot at this stage to share with you all, hoping someone can help me understand what's happening during this time. What could be causing this delay, and is there an effective way to speed up the process so that Jellyfin can reach the home page as quickly as Emby does?


The second issue is the discrepancy in memory usage between the two. Upon startup, Jellyfin's memory usage is around 4GB, whereas Emby's is under 1GB. How can I address this problem and reduce Jellyfin's memory usage to match Emby's level under the same conditions? I've attached two screenshots showing the resource usage for both for your reference.
[Image: jellyfin-mem.png]
[Image: emby-mem.png]
Thank you in advance for any assistance you can offer!


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - TheDreadPirate - 2024-04-23

Jellyfin only takes about 5 seconds to boot on my system. Both my bare metal "production" instance and all 4 of my docker testing instances. Are your containers running off HDDs or SSDs?

I'd need to see the full log. The section you are showing is only 4 seconds of the boot process. Share via sourcebin or pastebin.

The "vEthernet" message is a default behavior of Jellyfin to ignore virtual interfaces with a particular name.

After Jellyfin was forked from Emby, Jellyfin was migrated to .Net for wider compatibility. .Net aggressively caches data and the docker memory usage gauge does not distinguish between reserved memory usage and cached memory usage. When another app needs memory, Linux will immediately take back cached memory.


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - paulc - 2024-04-23

Ignore the lan bit and the log entries after that and look in your log and see when it starts processing again after a long pause and start troubleshooting the last and next process after the log pause. It could be a plugin. I had like a 20-minute pause and disabled whatever plugin it was and things bounced back normally.

That's all I got to offer as far as troubleshooting this.


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - TheDreadPirate - 2024-04-24

Ah. I recall a couple other users find that some rando plugin was the root cause.


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - paulc - 2024-04-24

(2024-04-24, 01:04 AM)TheDreadPirate Wrote: Ah.  I recall a couple other users find that some rando plugin was the root cause.

Years ago, the anime plugin caused it. That wasn't my issue, though. I can't remember which plugin mine was, but it annoyed the wife whenever I had to restart, and I remember that. Winking-face


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - 21tc_sea - 2024-06-11

(2024-04-23, 04:40 AM)21tc_sea Wrote: Hello everyone!

I've been running containers for both Jellyfin and Emby using Docker and have mounted the same media library to each. I am working with Jellyfin version 10.8.13 and Emby version 4.8.0.56. After starting the containers, I encountered a couple of issues with Jellyfin that I'm not sure how to resolve and would greatly appreciate any help or guidance from the community.
[Image: jf-start-debug.png]
The first issue is that the Jellyfin container takes a considerable amount of time, around 10-20 minutes, to start up and allow access to the web page. In contrast, the Emby container with the same media library only takes about a minute. I checked the Jellyfin logs and noticed that it always seems to pause at a specific point during startup for a long time before it continues to log output. I've captured a screenshot at this stage to share with you all, hoping someone can help me understand what's happening during this time. What could be causing this delay, and is there an effective way to speed up the process so that Jellyfin can reach the home page as quickly as Emby does?


The second issue is the discrepancy in memory usage between the two. Upon startup, Jellyfin's memory usage is around 4GB, whereas Emby's is under 1GB. How can I address this problem and reduce Jellyfin's memory usage to match Emby's level under the same conditions? I've attached two screenshots showing the resource usage for both for your reference.
[Image: jellyfin-mem.png]
[Image: emby-mem.png]
Thank you in advance for any assistance you can offer!

Hello! My Jellyfin is installed on the Synology system using a Docker container. Every time it starts, it gets stuck at the same position and takes a long time to proceed to the next step, often more than ten minutes. You can take a look at the picture I put in the attachment, pay attention to the timestamps of the two log messages. From the logs, you can see that I waited at least 12 minutes for this startup. I’ve tried various methods but have been unable to solve this problem. I’m guessing if it’s because the database file is too large. In the data subdirectory of the config directory, the library.db database file is 3.5GB. My entire system only has 8GB of memory. I used the docker stats command to observe the Jellyfin container and found that it occupies around 4GB of memory as soon as it starts. It doesn’t return memory to the system when necessary, as everyone says. It only releases when the Jellyfin container is closed. However, with the same size of the database file, the Emby container can enter the web interface in less than a minute after startup. If the configuration of the Jellyfin container remains unchanged and only a small media library is mounted, it can quickly complete the startup and enter the web interface. These two problems are really troubling. One is why the startup takes so long, what is Jellyfin doing between those two lines of log messages? The other problem is why is the memory usage so high? Is there really no solution? I look forward to everyone giving me more help! Thank you!
I apologize for my poor English, the above reply is all translated, please forgive any grammatical errors!


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - 34626 - 2024-06-11

Recently i've had some troubles with my Jellyfin, and by running sudo docker stats i saw my Jellyfin used close to 27 GB out of 31 GB - This was 10.9.6

I dont know why it used so much RAM, i tried to run all maintain tasks, but the RAM usage did not go down, i ended up shutting down the server for an hour and when started again and the RAM usage was below 400 MB. Today its gone up to 3 GB, but thats okay for me, but it makes me curious about what Jellyfin uses the RAM for, and an option to "reset" the RAM usage in Jellyfin - It seems like this is not possible currently without going beyond jellyfin and run server commands or just shut it down to start it up again. - With Linux command:

free -h && sudo sysctl -w vm.drop_caches=3 && sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && free -h

The RAM usage is down to below 600 MB by Jellyfin


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - 21tc_sea - 2024-06-12

I seem to have found the reason for the slow startup. I noticed that every time Jellyfin starts, it reads the entire config/data/library.db file into library.db-journal (in version 10.9, it’s library.db-wal). Upon careful observation, the library.db-journal file keeps growing until it becomes slightly larger than the library.db file. Only then does it stop growing, and its size is quickly cleared to 0. Then Jellyfin’s startup proceeds to the next stage.

As I’m using HDD drive, writing to the library.db-journal file is particularly slow each time, and the library.db file is now quite large, at 3.5GB. At its fastest, it takes about 15 minutes to process, and at its slowest, it takes 20-30 minutes. Every startup is too troublesome. I thought that updating to version 10.9 and changing library.db-journal to library.db-wal would solve this problem, but it didn’t.

Although it now adopts the library.db-wal mode like Emby, its startup is too slow. For the same size database file, Emby can complete the startup in about a minute. I really don’t understand why Jellyfin is designed this way, reading the entire library.db into library.db-wal every time it starts (I can’t be sure it’s reading this file, because I found the file sizes to be similar, so I guess it’s reading the library.db file). I believe this is definitely a mistake.

Moreover, the memory usage of 10.9 is more terrifying than 10.8. Without limiting the memory of the Docker container, the same database takes up about 4GB in 10.8, while 10.9 uses up to 5-7GB. This is not user-friendly for users with small memory! I hope the development team can pay attention to and solve this problem! How can it start quickly like Emby, even if the library.db file is large?


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - Efficient_Good_5784 - 2024-06-12

(2024-06-12, 10:49 AM)21tc_sea Wrote: This is not user-friendly for users with small memory!
Barring any possibility of memory leaks, the agressive caching shouldn't be an issue. The cache should be released when something else needs the memory. All this means that on systems with small amounts of memory, Jellyfin will just take more time loading things back from disk because it can't hold more things in the system ram.

Also, I think the cache size depends on size of your libraries. My Jellyfin server (on v10.9) has never taken up more than 900MB on my NAS. I'm sure the cache size will grow as I add more content to my Jellyfin server. Though unlike the point of this thread, I have noticed that its memory usage does go down at times.


RE: Can Someone Help Me Figure Out How to Reduce Jellyfin's Memory Usage to the Same Leve - 21tc_sea - 2024-06-12

(2024-06-12, 01:44 PM)Efficient_Good_5784 Wrote:
(2024-06-12, 10:49 AM)21tc_sea Wrote: This is not user-friendly for users with small memory!
Barring any possibility of memory leaks, the agressive caching shouldn't be an issue. The cache should be released when something else needs the memory. All this means that on systems with small amounts of memory, Jellyfin will just take more time loading things back from disk because it can't hold more things in the system ram.

Also, I think the cache size depends on size of your libraries. My Jellyfin server (on v10.9) has never taken up more than 900MB on my NAS. I'm sure the cache size will grow as I add more content to my Jellyfin server. Though unlike the point of this thread, I have noticed that its memory usage does go down at times.

Could you please check the size of the library.db file in your config/data directory? If you mentioned that your Jellyfin memory usage is only around 900MB, I guess your library.db is probably only a few hundred MBs.