Memory Ballooning for Linux Guests

I’m trying to understand something about memory ballooning. I’m currently using UnRaid 6.9.2 and I have some rather large VMs used for package building.

First important Host hardware specs:
Ryzen 3970X 32cores/64threads
64G DDR4 (1G/thread)
4T (2x2TB RAID0 BTRFS) SSD cache (where VMs live)

2 VMs, Configuration Goal:
Atlantic 10cores/20threads, base 16G, Max 25G, Linux kernel 5.10.42
Pacific 10cores/20threads, base 16G, Max 25G, Linux kernel 5.13.1

2 VMs, Current Configuration:
Atlantic 10cores/20threads, base 20G, Max 20G, Linux kernel 5.10.42
Pacific 10cores/20threads, base 20G, Max 20G, Linux kernel 5.13.1

I can see virtio_balloon is loaded.
root@atlantic:~# lsmod | grep virtio
virtio_balloon 24576 0
virtio_console 32768 0
virtio_net 53248 0
net_failover 20480 1 virtio_net
virtio_pci 24576 0
virtio_pci_modern_dev 16384 1 virtio_pci
virtio_blk 20480 5
virtio_ring 36864 5 virtio_console,virtio_balloon,virtio_pci,virtio_blk,virtio_net
virtio 16384 5 virtio_console,virtio_balloon,virtio_pci,virtio_blk,virtio_net

Scenario:
These 2 VMs are a part of a kubernetes cluster that is used for building linux packages for Mocaccino OS. (Linux Distro). They are hosted on my personal machine. When packages are pushed to the cluster for building, my VMs pickup the jobs. If I use my Goal config their memory does not balloon or expand and some jobs will fail building due to OOM errors (out of memory). In their current config, its very rare, but there are situations when builds can fail due to OOM error.

From my research, qemu-guest-agent has nothing to do with memory ballooning (its not installed on the VMs), and the virtio_balloon driver should be enough to allow memory to expand when necessary. I’m just not sure why its not happening.

Is there something I should be aware of? Is there something I’m doing wrong? Are there any recommendations on how to test its functioning properly on a smaller test VM?

Greatly appreciated,
Frosty

No you didn’t do anything wrong. This is the default behaviour. If you set the memory baloon to a value it’s not gonna change unless you set it to something different.

https://www.linux-kvm.org/page/Projects/auto-ballooning

1 Like