i've been on quite a search to figure out if i can make a VM in unraid that dynamically gets memory assigned when it needs it, or when the host doesnt need it. Either way will work really.
In short, my goal is to consolidate some tasks from another server into a VM on my unraid machine.
Because of some long-winded requirements i cant use a docker container, and i dont have enough RAM in my server to dedicate the amount the VM 'could' use, while still having enough memory spare for what other services on my box 'could' use. Having a shared 'pool' is fine however.
For solving this problem, i got interested in the ways behind the "Initial Memory" and "Max Memory" settings in the VM settings. However, the behavior doesnt seem to make much sense in my testing.
My current setup is a host machine with 32GB RAM, running unraid 6.9.2
The virtual machine is running debian 11.2, configured with 2GB Initial memory and 16GB Max memory.
Other services currently running are consuming approximately
The behavior i'm experiencing here is as follows:
- once the VM starts, it shows to have 16GB memory allocated
- as the system has started up, the memory allocation depicted by unraid, and in the VM as listed by htop, lowers down to around the initial memory configruation: 2GB in unraid, and about 1.6GB in debian (i'm assuming driver losses here.)
- when i run a memory intensive application in the VM, it'll start eating into swapfile, and eventually crashes with an out of memory error, the VM never gets any additional memory past what it dropped down to after startup.
- i can manually assign the VM more memory in the 2 to 16GB memory range trough terminal commands on unraid, but past the initial shrink it doesnt appear to take any automatic action in either direction.
Is this how it is intended to work with unraid?
Is there supposed to be any sort of automated process that allocates memory as needed, and it just appears broken for my exact setup?
i've dug trough every bit of documentation i could find on the topic, and have come up short unfortunately.