Hello,
I have a windows VM running on a remote linux host. I need to know if there any possibility that the windows VM can use more CPU core ( for a shot period) than it reserved?
Is there any way to allow CPU burst to the VM? Can you help me on this?
For CPU you have two options, neither of which can be changed after start.
You just set a number of CPU cores and let the scheduler on the host figure out where to run it at any given time and deal with other tasks running on there.
You set a specific set of host CPUs to expose to the VM, this then gives you a bit more control over VM allocation on physical CPU but avoids the scheduler on the host so if you pin to busy cores, youâll get something slower.
For memory, you must select how much memory you want the VM to get.
This should handle over-committing in that the memory will only be consumed from the host when used in the VM, so you can have a bunch of VMs totalling more than the total memory of your host and have them run fine so long as they donât all use what they were configured with.
Or you use hugepages in which case the memory is fully dedicated to the VM.
Is it possible to allow memory overcommitting on windows VMs?
I have a windows VM with the memory limit 8GB. When the windows VM is in running state it used complete physical memory allocated to the VM from the host, not only use what its needed. The screenshot shows the usage:-
Right, in this case, Windows used all the memory and never gave any back to the host.
That behavior is really up to Windows, Linux canât free memory that it doesnât know has been freeed.
Make sure you have all the relevant drivers installed on Windows, especially the balloon driver which is used to release memory back to the host when not in use in the VM.
@stgraber yeah, balloon driver and all required drivers are installed.
but cannot update these PCI drivers from virtio drivers.
Is because of this the windows VM reserve the complete physical memory allocated to VM?
hello @stgraber
Installed the Balloon Service and now its running in the windows VM, But it still reserve the physical memory allocated to the VM from the host
Is there any way to get back memory to host when not in use in the VM?
All the required drivers and services are installed in the windows VM, especially Balloon driver and Balloon service. But still the windows VM reserve the same amount of memory limit from the host. Can anyone help me on this?
@tomp is working on live memory reconfiguration which youâll soon be able to use to force the balloon to inflate inside the VM, releasing some amount of memory to the host.
That should work for cases where the guest doesnât already voluntarily release memory back to the host through itself causing the balloon to inflate.
I believe @stgraber will be doing the next release in the next couple of days.
When that is released you should be able to reduce the memory using lxc config set <instance> limits.memory=<size> and regrow it to original boot size limit (if needed) using the same command with a larger value.
Hello,
I have updated to lxd 4.7 and when doing the live shrinking and re-grow of memory limits to the windows virtual machines facing some issues.
when I decrease the memory size, it makes only change to the lxd config and the changes does not reflect inside the windows VM. It requires a restart to make the changes.
After the restart of the windows VM, I cannot increase the memory size. When trying to increase getting the below error
Error: Failed updating memory limit: Cannot increase memory size beyond boot time size when VM is running
Also I need to know if memory overcommitting is possible in windows VM?
When I start the windows VM, it reserve the complete physical memory allocated to the VM. But I can see that LInux VMs uses only what its needed. The screenshot of memory usage is attached below.
The Windows VM has mapped about 4GiB of RAM in this case, the initial shrink times out before we force it to vacate the memory, doing it again succeeds, we can see the VM indeed being down to 2GiB, then resettting the limit causes Windows to notice and immediately re-map the rest of the RAM.
Thatâs a different behavior than Linux because Linux doesnât seem to actively map/mess with memory itâs not actively using, whereas Windows apparently is.
There may be more memory settings that can be done within Windows to change that behavior, but thatâs certainly out of our knowledge and LXD here is definitely doing as expected. Itâs inflating the balloon in the VM to cause memory to be freed and deflating it when requested. The difference is that on a Linux VM, this doesnât then cause the OS to immediately consume the added system memory.
hello @stgraber okay
here initially the windows VM is mapped to 8GB of RAM and then changed to 6GB, But the windows VM shows 8GB on the task manager, remains unchanged
Also when trying to change memory to 8GB, getting error.
root@cpu-5280:~# lxc config show windows | grep memory
limits.memory: 8GB
root@cpu-5280:~# ps aux | grep windows
nobody 561 11.5 11.9 8653404 7864628 ? Sl 07:29 0:58 /bin/qemu-system-x86_64 -S -name windows -uuid c1d30ebf-0136-4ff7-9de2-3bdfe995f848 -daemonize -cpu host -nographic -serial chardev:console -nodefaults -no-reboot -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=deny,resourcecontrol=deny -readconfig /var/log/lxd/windows/qemu.conf -pidfile /var/log/lxd/windows/qemu.pid -D /var/log/lxd/windows/qemu.log -chroot /var/lib/lxd/virtual-machines/windows -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas nobody
root 15415 0.0 0.0 6144 884 pts/0 S+ 07:38 0:00 grep windows
root@cpu-5280:~# lxc config set windows limits.memory 6GB
root@cpu-5280:~# lxc config show windows | grep memory
limits.memory: 6GB
root@cpu-5280:~# ps aux | grep windows
nobody 561 10.7 8.9 8653404 5912168 ? Sl 07:29 1:02 /bin/qemu-system-x86_64 -S -name windows -uuid c1d30ebf-0136-4ff7-9de2-3bdfe995f848 -daemonize -cpu host -nographic -serial chardev:console -nodefaults -no-reboot -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=deny,resourcecontrol=deny -readconfig /var/log/lxd/windows/qemu.conf -pidfile /var/log/lxd/windows/qemu.pid -D /var/log/lxd/windows/qemu.log -chroot /var/lib/lxd/virtual-machines/windows -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas nobody
root 16233 0.0 0.0 6144 880 pts/0 S+ 07:39 0:00 grep windows
root@cpu-5280:~# lxc config set windows limits.memory 8GB
Error: Failed updating memory limit: Cannot increase memory size beyond boot time size when VM is running