Limiting HAOS VMs resources on a shared system

UPDATE: The primary nvme disk (1TB) that was home to HAOS and several other VMs had gotten over 95% full, and that led to most of my IO issues. Before trying to tune your VM, make sure that you’ve got plenty of free storage space (100GB+ for me on a busy system).

That said, I’ve been using the changes I documented here for over a month now and performance is very good again. That said, it was interesting to experiment with blkiotune, schedinfo, emulatorpin and vcpupin, and I continue to run HAOS pinned.

I’ve noticed that HAOS frequently puts a lot of load on my home server (Intel i9-9900k), especially disk IO but also CPU usage.

CPU Usage:

IO is actually good right now, fairly ideal. But over the last few days that I’ve been monitoring closely, HAOS is frequently the highest IO process in iotop.

For me, HAOS is running inside a libvirt (qemu) VM.

I found a 2019 article about constraining HAOS resources:

Disk Shares

sudo virsh blkiotune haos

For me, this currently shows:

weight         : 100
device_weight  : 
device_read_iops_sec: 
device_write_iops_sec: 
device_read_bytes_sec: 
device_write_bytes_sec:

CPU Shares

❯ sudo virsh schedinfo haos
Scheduler      : posix
cpu_shares     : 100
vcpu_period    : 100000
vcpu_quota     : 17592186044415
emulator_period: 100000
emulator_quota : 17592186044415
global_period  : 100000
global_quota   : 17592186044415
iothread_period: 100000
iothread_quota : 17592186044415

CPU Pinning

sudo virsh emulatorpin haos
sudo virsh vcpupin
❯ sudo virsh emulatorpin haos
emulator: CPU Affinity
----------------------------------
       *: 0-15

❯ sudo virsh vcpupin
error: command 'vcpupin' requires <domain> option
❯ sudo virsh vcpupin haos
 VCPU   CPU Affinity
----------------------
 0      0-15
 1      0-15
 2      0-15
 3      0-15