Memory Ballooning

djx

Member
Aug 11, 2020
10
2
8
37
I have a Proxmox 6.0-4 host with 32 GB of memory. I have two guest machines, each that will do work and I want to be able to share the RAM between them.

Neither machine will be using 100% of the RAM at a time. So my goal is to configure each one with a Max of 28 GB of RAM, and the minimum of 4 GB.

I have them set like this:
1600374431117.png

One guest is Windows 10, and the other guest is Linux Mint 20. I have ensured that the Windows guest has the virtio balloon device installed, and that the guest agent is running on Linux Mint.

I start the Linux guest, and it always shows something like 2-4 GB of 28 GB in use. I try to start the other machine but I get an error that the memory cannot be allocated.

The wiki makes it sound like it should "Just work", because it says:
Modern Linux Kernels does include the Balloon drivers by default. It works out of the box, and you only need to set the VM to "Automatically allocate memory within this range"
(https://pve.proxmox.com/wiki/Dynamic_Memory_Management)

Also, this wiki article makes a reference to the "automatically allocate" text which no longer exists in the current ProxMox.

I have tried the other way, starting the Windows machine first, but it has the same result. I see only ~4 GB of memory being used, and ProxMox reports that it can't allocate memory for the other VM even though it is not actually being used by the Windows guest.

I apologize if this sounds like a stupid question, but I was under the impression that being able to dynamically allocate RAM between two guests without restarting them was one of the fundamental benefits of Virtual Machines and having a server with a large resource pool.

Any help to clarify the situation would be much appreciated!
 
  • Like
Reactions: Thorvi
I've read somewhere that by default you can't start a VM if starting the VM would allocate more RAM than RAM + SWAP combined on the hypervisor.
Thats why I allocated 64GB SWAP to my 64GB RAM so I can overprovision the RAM to 128GB in the VMs.
 
  • Like
Reactions: Thorvi
@Dunuin - thanks for the idea. I took a look and while the 28 GB ballooned machine is running, the host shows this:

Code:
root@proxmox:~# free -m
              total        used        free      shared  buff/cache   available
Mem:          32138       31088         342          42         707         564
Swap:          8191         795        7396

The guest shows this:
Code:
doc@golem2:~$ free -m
              total        used        free      shared  buff/cache   available
Mem:           3408        1555         282          31        1570        1428
Swap:          2047           1        2046

And the Proxmox UI shows:
1600450945813.png

And then when I try to the Win 10 guest with a minimum of 4 GB of RAM and max of 14 GB with ballooning enabled, I get this error:
kvm: -object memory-backend-ram,id=ram-node0,size=14000M: cannot set up guest memory 'ram-node0': Cannot allocate memory

When I reduce the memory down to 6 GB of RAM (within the free memory size) then it seems to boot up fine. I understand that I could increase my swap size to make it boot with 14 GB, but it doesn't seem like the ballooning is working and will actually free up memory from the first guest to give to the second guest. I don't want to run the second guest on swap while the RAM sits empty on the first machine.

Any ideas on what I'm doing wrong?
 
@RokaKen - thank you, this is helpful. Is there any documentation to explain how I can track if the calls to increase RAM are being taken from released RAM vs. the swap available on the host? Also, is it possible to add this as a snippet in the "automatic memory management" section of the Wiki? At least from what I see, OOTB the ProxMox memory management doesn't do much because it will always require the max memory anyway, and it's not until this setting is enabled that we get to see the benefits of ballooning / minimum & max memory settings.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!