Memory ballooning not functioning

masterjuggler

Dabbler
Joined
Jan 19, 2022
Messages
10
I've had some Ubuntu VMs running for the past couple years and was just playing around with the "minimum memory size", but can't seem to get it working properly. For example when I set a max of 6GiB and a min of 2GiB, Ubuntu thinks it's already using 4GiB and won't get any more allocated from Truenas, even when I fill it and the swap up to a freeze state. This is a fresh install of ubuntu server minimal with no extra services installed.

1709264480502.png


Running virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" dominfo [VMname] consistently shows only 2GiB used. Is there something I'm forgetting to set up? I tried installing qemu-quest-agent though I don't believe it's required, and the Truenas docs don't mention any requirement other than setting minimum memory size.

TrueNAS-SCALE-23.10.2
Guest: Ubuntu Server 22.04.3 fully updated
 

GyulaMasa

Dabbler
Joined
Aug 6, 2023
Messages
18
Set both values to the same during you create the VM. (changing it in an already existing VM does not seem to work)
Memory ballooning is buggy.
 

masterjuggler

Dabbler
Joined
Jan 19, 2022
Messages
10
Set both values to the same during you create the VM. (changing it in an already existing VM does not seem to work)
Memory ballooning is buggy.
I just tried setting up a new vm and fresh installing ubuntu server with max and min memory sizes set in truenas. Didn't change the result though, ubuntu still thinks it's already using all the extra memory that could have been allocated to it, as in the screenshot above.
 

chuck32

Guru
Joined
Jan 14, 2023
Messages
623
Can you post the output from htop?

Recreate the VM, do not touch min memory at all.

Question: What is the point of ballooning memory here anyway? If I'm not completely mistaken the allocated memory isn't blocked completely anyway. I just set the max values and keep track of them so I don't overcommit.
 

probain

Patron
Joined
Feb 25, 2023
Messages
211
I filed a Jira about it quite some time ago
Here

It didn't get that much traction though. And I've since, managed to get better results in my VMs and their memory after updates. But feel free to log a bug report and reference back to mine as well. So maybe they will have more data to go on.
 

masterjuggler

Dabbler
Joined
Jan 19, 2022
Messages
10
Can you post the output from htop?
I assume this is what you're looking for, from the vm I created fresh with min memory set:
1709475955750.png

Recreate the VM, do not touch min memory at all.
This has been my setup until now. VMs were created and have been running without min memory set in truenas at all.
Question: What is the point of ballooning memory here anyway? If I'm not completely mistaken the allocated memory isn't blocked completely anyway. I just set the max values and keep track of them so I don't overcommit.
So I was going to say something about comparing to thin provisioned virtual disks, but now that I go and actually test it, the memory allocation doesn't work the way I had expected until now. On my ubuntu desktop with a qemu kvm, all assigned memory is allocated from startup. Now I see that in truenas, memory is dynamically allocated to the guest, just without a way to release it back to the host. I don't know how it's doing that, but it's definitely a better situation than I I had assumed. I'd still like to have proper ballooning capability but thanks for bringing this up!
It didn't get that much traction though. And I've since, managed to get better results in my VMs and their memory after updates. But feel free to log a bug report and reference back to mine as well. So maybe they will have more data to go on.
I saw your thread before posting mine but figured I have a different issue since you got it working as you mentioned, and your free -h reports the minimum memory set in truenas as the total memory, where mine shows the maximum memory. I don't think I know enough about this issue yet to be able to intelligently create a bug report though.
 
Top