Jump to content

Emby server memory usage


parrish

Recommended Posts

parrish

Care to share the method?

 

​It's fairly simple.  First you just create a batch file with this as the contents:

NET STOP "Emby"

TIMEOUT /t 300

NET START "Emby"

 

Save it as a .bat file to somewhere convenient and where you won't accidently delete it, etc.  This file will be called by the scheduled task.

 

Now, open the Task Scheduler. 

Right-Click on Task Scheduler Library on the menu at the left and choose Create Task.

Enter whatever want to name the task in to the Name field.

Select the 'Run whether users is logged on or not' radio button. 

Check the 'Run with highest privileges' option.

In the Configure For: drop down choose whatever version of OS you are running. 

Now move to the Triggers task. 

Click the New button.

Choose Daily (or however often you want this to happen) then choose the start time. 

Leave all the Advanced settings unchecked except for Enabled. 

Now move to the Actions tab and click the New button.  The action will be 'Start a program'. 

Click Browse next to Program/script and choose the previously created .bat file.  Then click OK.  

Now click OK on the Create Task window. 

It should prompt you to enter a username and password that the task will run under.  This needs to be an administrative level account as it will run the task in elevated mode and when no one else is logged in.  

 

That should be it. 

  • Like 2
Link to comment
Share on other sites

Jdiesel

I don't experience this problem myself but thought I would assist with some troubleshooting. One observation I have made is that the users experiencing high memory usage seem to be running Windows. I do no see this in my Linux environment. Does anyone who is running Emby server on Linux experience this problem? When idling Emby consumes 0.8GB to 1GB of ram and peaks at about 4GB under heaving use in my environment.

Link to comment
Share on other sites

mastrmind11

I don't experience this problem myself but thought I would assist with some troubleshooting. One observation I have made is that the users experiencing high memory usage seem to be running Windows. I do no see this in my Linux environment. Does anyone who is running Emby server on Linux experience this problem? When idling Emby consumes 0.8GB to 1GB of ram and peaks at about 4GB under heaving use in my environment.

Was thinking the same thing, and definitely not.  I peak at 4GB memory usage and I run a bunch of other shit on my 16GB linux box.  

 

And ftw, @@jnheinz, while I agree with you in principal regarding daily reboots, I work at major corporation and weekly reboots of sections of the server farm is a regular practice.  I do a scheduled reboot of my own boxes at least once a week.

Link to comment
Share on other sites

jnheinz

Day 2 (48 hours since changes & last reboot) .. DLNA disabled, removed trakt, Emby Sync, AutoBoxSet & Statistics plugins.  Updated to 3.2.26 & rebooted @ 7/23 @ 10PM CST.


 


Hasn't moved up much since the last screenshot.  No sign of moving down.


 


5977ef65e2342_2017072520_23_58freeportRe


Link to comment
Share on other sites

Spotta

After removing Emby.Kodi sync queue, IPTV & Server Configuration Backup plugins yesterday my mem usage has remained under 300mb.

Link to comment
Share on other sites

Thanks for the feedback. You can add the server backup plugin though, I can't see how that would make a difference.

Link to comment
Share on other sites

jnheinz

Day 2.5 (60 hours since changes & last reboot) .. DLNA disabled, removed trakt, Emby Sync, AutoBoxSet & Statistics plugins.  Updated to 3.2.26 & rebooted @ 7/23 @ 10PM CST.

 

Moved up another 200MB overnight.  No sign of moving down.

 

 

597899735d815_2017072608_28_22freeportRe

Link to comment
Share on other sites

jnheinz

Day 3 (72 hours since changes & last reboot) .. DLNA disabled, removed trakt, Emby Sync, AutoBoxSet & Statistics plugins.  Updated to 3.2.26 & rebooted @ 7/23 @ 10PM CST.


 


Moved up another 200MB+ throughout the day.  No sign of moving down.


 


59795e3a21f62_2017072622_26_01freeportRe


Link to comment
Share on other sites

I notice you're using the Emby for Kodi addon. There is a tremendous amount of database queries being run as part of the addon's sync process. it is essentially pulling the entire database out through the api and that is why you've seen the increase. 

 

Have you considered trying out EmbyCon? it's a new add-on that does not require any syncing? You can check it out here:

 

https://emby.media/community/index.php?/topic/46651-embycon/

 

Apart from this we have some improvements in the pipeline for the Emby for Kodi addon that will reduce the load that the addon puts on the server but they are not ready for release yet.

 

Additionally, although this is spitting in a bucket compared to the activity in your log, but in the next beta server, the entire auto-organize feature will be moved to a plugin, so if you're not using that then that's one less sqlite database and one less scheduled task that will be loaded. But again that's very minor by comparison.

Link to comment
Share on other sites

jnheinz

I notice you're using the Emby for Kodi addon. There is a tremendous amount of database queries being run as part of the addon's sync process. it is essentially pulling the entire database out through the api and that is why you've seen the increase. 

 

Have you considered trying out EmbyCon? it's a new add-on that does not require any syncing? You can check it out here:

 

https://emby.media/community/index.php?/topic/46651-embycon/

 

Apart from this we have some improvements in the pipeline for the Emby for Kodi addon that will reduce the load that the addon puts on the server but they are not ready for release yet.

 

Additionally, although this is spitting in a bucket compared to the activity in your log, but in the next beta server, the entire auto-organize feature will be moved to a plugin, so if you're not using that then that's one less sqlite database and one less scheduled task that will be loaded. But again that's very minor by comparison.

 

 

I did actually add a Fire TV Stick with SPMC 16.7 + Emby for Kodi Addon to my house, so yeah -- I'm sure that showed up in the logs while it synced for about 90 minutes.  This was just last night though, so there were increases in RAM prior to this event.

 

I will check out EmbyCon.  I'm not sure I want to explore something new with this latest Fire TV Stick.

 

I run at least 6-8 clients with Emby for Kodi, I think.  Not more than 10 though.  I am an XBMC/Kodi fan, so I really prefer to stay on it.  Are you inferring this could be the root cause?

 

I will keep reporting back.  My logs should be more quiet; I don't plan on getting any new hardware.  It was just a fluke that I got one during this issue.

Edited by jnheinz
Link to comment
Share on other sites

jnheinz

I will try out EmbyCon on OpenELEC/RPi2 I have that is not in any particular use to assess how it works.

Link to comment
Share on other sites

jnheinz

Tried out EmbyCon on a Fire TV I had.. tried out Kodi 17.3.

 

Must have sent the server over the edge.. RAM usage went up to 1100 (still plenty left on server) & the Emby Server became unresponsive to EmbyCon & Emby for iOS.  Restarted the Emby Server service.  This was about an hour after I sent you my logs.

Link to comment
Share on other sites

jnheinz

Here is a 40 hour graph of the Emby Server process' (only) memory consumption.  @@Luke , do you have any idea what is causing this run-away memory consumption with the add-ons I have enabled or devices connected?  I can continue data mining.

 

5979856548645_2017072701_16_10freeportRe

Edited by jnheinz
Link to comment
Share on other sites

jnheinz

It is most likely going to be the sync process coming from the kodi addon.

 

So what would you suggest we do?  Restart the service daily & wait for improvements to the sync process?  Switch all our Kodi integration to EmbyCon?  I tried it, and I can definitely say I like the Emby for Kodi add-on better in how it integrates with Kodi.  Feels more natural.  It just sounds like this (sync process) has been identified as a weakness & is receiving attention in development.

Link to comment
Share on other sites

jnheinz

Going off a different direction - Someone mentioned using Linux.  I have debated this.  Is there a process to backup/restore if switching instances of Emby?  I would consider Windows a poor OS for resource management personally.  All of my media & metadata is stored on network drives (a NAS).

Edited by jnheinz
Link to comment
Share on other sites

If you wish to make an OS change, you can certainly try it but I'm not convinced it will have an impact on your issue.

 

I run a Windows server that basically never gets restarted (only on major updates) and memory consumption hovers around 400MB.  I do not have any Kodi boxes but run CoverArt, Podcasts, Trailers, Backup, Folder Sync and Genre Cleaner as plug-ins.  Also have Live TV active.

Link to comment
Share on other sites

jnheinz

If you wish to make an OS change, you can certainly try it but I'm not convinced it will have an impact on your issue.

 

I run a Windows server that basically never gets restarted (only on major updates) and memory consumption hovers around 400MB.  I do not have any Kodi boxes but run CoverArt, Podcasts, Trailers, Backup, Folder Sync and Genre Cleaner as plug-ins.  Also have Live TV active.

 

When I look at the memory consumption of the VM, I would agree historically.  But, not lately.

 

To all users experiencing this problem - are we all Kodi users with the Emby for Kodi add-on?  Are there any out there who are experiencing the problem, but you do not use Kodi at all?

Link to comment
Share on other sites

So what would you suggest we do?  Restart the service daily & wait for improvements to the sync process?  Switch all our Kodi integration to EmbyCon?  I tried it, and I can definitely say I like the Emby for Kodi add-on better in how it integrates with Kodi.  Feels more natural.  It just sounds like this (sync process) has been identified as a weakness & is receiving attention in development.

 

The sync process will always come with a cost although we are looking at improvements. But it will never be as efficient as an app that doesn't require syncing such as EmbyCon. 

  • Like 1
Link to comment
Share on other sites

rhodges

I have the sync process enabled on my server with only 1 kodi front end that stays on all the time. A few things get added every day and I don't have a run away memory problem. It shouldn't cause a run away problem. Even if it is pulling the entire database out, it is doing it by pages and it should go back to normal unless connections are left open or something.

 

Do you have a constant sync? I was using Radarr and Sonarr that was creating the Emby nfo files. Every day, it would recreate or update those with user ratings or something. This would cause a ton of stuff to get resync'd every day. I never had a memory runaway, but I disabled that (rather coded my own solution) and fixed that problem.

 

In my opinion, that 40 hour graph totally kills the emby sync addon idea. Nothing should cause a steady increase like that. Something is happening at a regular interval that is not releasing memory.

 

Anyone try a .net memory profiler? Not sure if that would make a difference, but maybe you can get an idea of what objects are sticking around in memory. Maybe grab a free trial on one?

  • Like 1
Link to comment
Share on other sites

jnheinz

@@rhodges - this is precisely my mentality.  I use all sorts of server daemons: seafile (file sync app), TF2, Ultima Online, EverQuest, SyncThing, and many more.  None of them have runaway memory consumption like what has crept up on Emby Server recently.

 

I am going to consider this a bug & would like to file a bug report, @@Luke , is there a method I can use to dump the contents of a runaway Emby Server process from memory to a file -- the word coredump comes to mind, but I am not a developer.

 

I tried EmbyCon, it works great, but it does not integrate well with the Home screen.  There are hacks to try to insert a Home.xml, but this does NOT work easily at all with Kodi 17 & the Fire TV.  The Estuary Skin directory is protected from non-root access, so I can't insert the modified Home.xml without rooting my Fire TV, which a small number of people will actually bother to do.

 

Basically, I think you have a good product that competes well, but eventually the Kodi users will leave if this goes unaddressed in the long term.  EmbyCon must integrate better out of the box with Kodi, or the Emby for Kodi add-on must not render the Emby Server process in a runaway memory condition.  Pick one :)

 

Just being honest.  I don't want to point fingers.  We all want the same goal, for Emby to be the best product available for streaming media.

Link to comment
Share on other sites

rhodges

@@jnheinz I'm playing around with a .net memory profile (first one I found on google search). It has a 7 day trial. I don't have the problem you guys are experiencing, but I'm going to play with the tool and see what I can see. I'm a .net developer, so it will be fun to see how well the tool works.

 

If you have time and patience, you might take a look at it. At this point, I don't know if the tool is worth the bother or not.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...