Do balloonings work?

gosha

Well-Known Member
Oct 20, 2014
302
25
58
Russia
Hi!

I'm trying to understand how the ballooning work.
And my misunderstanding can be seen in the picture.
Why VM see 2GB RAM presence only?

ballooning.png

This situation is observed for Linux-VMs. Windows-VMs see memory completely.

Yesterday shown VM started using the Swap and the available memory was only 2GB.
I do not understand something?

proxmox-ve: 5.3-1 (running kernel: 4.15.18-9-pve)
pve-manager: 5.3-11 (running version: 5.3-11/d4907f84)
pve-kernel-4.15: 5.3-3
pve-kernel-4.15.18-12-pve: 4.15.18-35
pve-kernel-4.15.18-11-pve: 4.15.18-34
pve-kernel-4.15.18-9-pve: 4.15.18-30
pve-kernel-4.15.18-7-pve: 4.15.18-27
pve-kernel-4.15.18-5-pve: 4.15.18-24
pve-kernel-4.15.18-4-pve: 4.15.18-23
pve-kernel-4.15.18-1-pve: 4.15.18-19
pve-kernel-4.15.17-3-pve: 4.15.17-14
ceph: 12.2.11-pve1
corosync: 2.4.4-pve1
criu: 2.11.1-1~bpo90
glusterfs-client: 3.8.8-1
ksm-control-daemon: 1.2-2
libjs-extjs: 6.0.1-2
libpve-access-control: 5.1-3
libpve-apiclient-perl: 2.0-5
libpve-common-perl: 5.0-47
libpve-guest-common-perl: 2.0-20
libpve-http-server-perl: 2.0-12
libpve-storage-perl: 5.0-39
libqb0: 1.0.3-1~bpo9
lvm2: 2.02.168-pve6
lxc-pve: 3.1.0-3
lxcfs: 3.0.3-pve1
novnc-pve: 1.0.0-3
proxmox-widget-toolkit: 1.0-23
pve-cluster: 5.0-33
pve-container: 2.0-35
pve-docs: 5.3-3
pve-edk2-firmware: 1.20181023-1
pve-firewall: 3.0-18
pve-firmware: 2.0-6
pve-ha-manager: 2.0-8
pve-i18n: 1.0-9
pve-libspice-server1: 0.14.1-2
pve-qemu-kvm: 2.12.1-2
pve-xtermjs: 3.10.1-2
qemu-server: 5.0-47
smartmontools: 6.5+svn4324-1
spiceterm: 3.0-5
vncterm: 1.5-3

Best regards,
Gosha
 
Last edited:
Hey there,

Hope this helps, this is Proxmox documentation you can find on you server by clicking on the 'Help' button.

When setting the minimum memory lower than memory, Proxmox VE will make sure that the minimum amount you specified is always available to the VM, and if RAM usage on the host is below 80%, will dynamically add memory to the guest up to the maximum memory specified.

When the host is running low on RAM, the VM will then release some memory back to the host, swapping running processes if needed and starting the oom killer in last resort. The passing around of memory between host and guest is done via a special balloon kernel driver running inside the guest, which will grab or release memory pages from the host.

When multiple VMs use the autoallocate facility, it is possible to set a Shares coefficient which indicates the relative amount of the free host memory that each VM should take. Suppose for instance you have four VMs, three of them running an HTTP server and the last one is a database server. To cache more database blocks in the database server RAM, you would like to prioritize the database VM when spare RAM is available. For this you assign a Shares property of 3000 to the database VM, leaving the other VMs to the Shares default setting of 1000. The host server has 32GB of RAM, and is currently using 16GB, leaving 32 * 80/100 - 16 = 9GB RAM to be allocated to the VMs. The database VM will get 9 * 3000 / (3000 + 1000 + 1000 + 1000) = 4.5 GB extra RAM and each HTTP server will get 1.5 GB.

All Linux distributions released after 2010 have the balloon kernel driver included. For Windows OSes, the balloon driver needs to be added manually and can incur a slowdown of the guest, so we don’t recommend using it on critical systems.

When allocating RAM to your VMs, a good rule of thumb is always to leave 1GB of RAM available to the host.

Cheers
 
Hey there,
Hope this helps, this is Proxmox documentation you can find on you server by clicking on the 'Help' button.
Cheers

I read the Help unconditionally. There is no answer to this question:
"Yesterday shown VM started using the Swap and the available memory was only 2GB."

And also there is no explanation why Windows VMs in any case show all available memory.

Gosha
 
Perhaps, Is the balloon device enabled in the guest? eg, dmesg | grep -i balloon ?
 
Perhaps, Is the balloon device enabled in the guest? eg, dmesg | grep -i balloon ?

Yes! And in the all my Linux-VMs!
But why?
"All Linux distributions released after 2010 have the balloon kernel driver included."

I thought that this should suffice:
bln.png

# cat /etc/pve/qemu-server/*.conf | grep balloon
balloon: 2048

New Question - How to enable use ballooning in linux-VMs?

Gosha
 
Last edited:
Ок.

The balloons were to be found among the modules:

root@dstore:~# lsmod | grep balloon
virtio_balloon 12997 0
virtio_ring 17342 5 virtio_net,virtio_pci,virtio_balloon,virtio_console,virtio_scsi
virtio 13058 5 virtio_net,virtio_pci,virtio_balloon,virtio_console,virtio_scsi


However, the problem is not solved.

Gosha
 
Did you look at the link, there is insight information contain therein that could explain the behavior you are experiencing?
 
What your seeing on Linux is correct, linux will report the amount of ram given to the VM from QEMU.

As the VM requires more ram and if the host has available it will be given more and your notice the amount of ram available increase within linux. It changes on the fly as required.

Linux can’t be told it has 4Gb of ram but then only given 2GB as this would cause the kernel to panic if it try’s to address ram it does not have.

I Guess with your windows VM you don’t have the ballon driver installed so QEMU is falling back to allocating the full amount of memory.

If you was to install the ballon driver within a windows you would also see the total available RAM automatically change up and down between the min and max values as expected.

If you have the RAM available and no need to overcommit the ram on the host disable ballooning and set the ram to the static amount you require.

Ballooning is only useful if you have a VM that occasionally may required X amount of ram but 99% of time if can do fine with the lower amount. So using ballooning your not lossing the total amount of ram 100% of time and can be used for other uses such as cache / other VM’s bursting.
 
If you was to install the ballon driver within a windows you would also see the total available RAM automatically change up and down between the min and max values as expected.

Are you theorizing? Here is the practice:

bln1.png

Windows immediately shows how much it is available to the maximum, even if it uses less than the minimum value.

Ballooning is only useful if you have a VM that occasionally may required X amount of ram but 99% of time if can do fine with the lower amount. So using ballooning your not lossing the total amount of ram 100% of time and can be used for other uses such as cache / other VM’s bursting.

This is exactly how this VM is used. The whole working day of the VM uses less than 2GB, at night a backup program starts, for which 2GB is not enough, but 3GB is enough. I can not achieve this. At night, VM does not increase memory up to 3GB, but simply uses swap.

Please do not express the theory and do not quote excerpts from Help.
I want to understand why ballooning does not work for me.

Gosha
 
Is not theory at all, however if your going to reply to people like that on a public forum offering you help for free don’t expect people to help and reply you.

Your windows VM is using over 4.5GB so yes I’d expect it to be using the full amount of memory even if you have installed the correct driver which you have yet to confirm you have.

Your linux VM have you adjusted the swapness value, otherwise your VM will be using swap before it gets to the % required for it to ask the host for extra RAM.

If you read some of the links posted earlier and on the Proxmox Wiki it provides you the limits and values and how ballooning works.
 

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!