Releasing Cached Memory for VM startup


Recommended Posts

Hi There

 

I have an unRaid box with 8Gb Ram. I have several dockers running and some VM's I occasionally need to start up.

 

After a fresh boot all is well. all dockers are running and I can start and stop VM's as I need to.

 

However after some time the Cached Ram seems to grow and consume about 50% of my memory which is fine. I believe this is some drive directory cache etc which makes sens as I have about 20tb with plenty of files.

 

The problem is that once this cache ram has grown enough I can no longer start my VM's and the only way I know how to clear the cached memory is a reboot.

 

I don't really want to have to reboot my system just to fire up a VM. The VM is allocated 4Gm of the 8Gm of ram.

 

Any ideas, suggestons. I do plan to add more ram but fear this will just allow the cached memory to grow even more.

 

Thanks.

Link to comment

I am more inclined to think that you simply don't have enough memory for what you are trying to do.  The OS should give back cached RAM on demand.  But, you only have 8GB of RAM.  You're giving 4GB to the VM plus there is significant virtualization overhead taking another big chunk of RAM (I want to say 1.5GB?).  Bottom line is that you're only giving 2+GB to unRAID and all your Dockers.  That's not a lot, and if they take more your VM won't start.  Try temporarily reducing your VM to 2GB and see what happens.

Link to comment

Cached RAM is released as required.  But, there is overhead involved in VM's (for a 4GB vm, you can probably count on at least 5GB being needed)  Add to that the usage by your onboard Video (I have seen many motherboards ship with this set at default to 1GB, when all it really needs to be is <32Meg)

Link to comment

I will play with the VM Memory allocation and see what will/will not start.

 

Interestingly though is that when the VM fails to start there is no indication of cached memory being released and the usage is the same before and after the failed start.

 

If cached memory was released on demand I would expect this to happen and then be at a minimum after the vm failes to start.

Link to comment
1 hour ago, JensU said:

If cached memory was released on demand I would expect this to happen and then be at a minimum after the vm failes to start.

Nope, it doesn't work that way.  If the VM Manager says "I want 4GB" then the OS is either going to say Yes or No.  If the answer is "No, I don't have that much" then you're SOL - no partial recovery will occur.  Again, try it at 2GB.  If you can start and stop freely at 2GB, then you simply need to get more memory.

Link to comment
  • 1 month later...

I'm having a similar issue. 

I have 16GB of RAM and after about a day after a reboot it has allocated over 12GB for cache. I can watch it go up if say I have something sitting on my cache drive and press the mover button, it takes more cache RAM but then never lets it go.

Storage wise I have five 4TB drives in the array (one is parity) and one 500gb ssd as a cache drive. 

 

I am not running any VM's. I only have 4 dockers running. (couch potato, sonarr, sabnzb, plex)

This just started recently too. Before it would only use about 1gb of RAM...so now the problem is if Sabnzb is processing a file I run out of RAM and it slows down. Plus I'm seeing a stuttering from plex during playback that didn't used to exist. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.