VM operations(start, stop and restart) on LDX seems to be much slower than VM with KVM/libvirt.
My configuration is VM’s memory is 256GB and one of PCI device (Infiniband) is attached as PCI passthrough in both LXD and KVM/libvirt cases.
In that case, when VM starts, all assigned RAM to VM need to be allocated with qemu process which takes some time.
Here is VM setup on LXD.
# lxc config show r8-lxd
architecture: x86_64
config:
image.architecture: amd64
image.description: Rockylinux 8 amd64 (20230124_02:06)
image.os: Rockylinux
image.release: "8"
image.serial: "20230124_02:06"
image.type: disk-kvm.img
image.variant: cloud
limits.cpu: "32"
limits.memory: 256GiB
volatile.apply_template: create
volatile.base_image: ee4a05eaa568a47e284cba4e442eea4187fa2adecf9b0856295d4f2db1e42457
volatile.cloud-init.instance-id: 49107854-6846-4891-bbb7-eb635e66c7bd
volatile.eth0.hwaddr: 00:16:3e:4a:9d:c6
volatile.uuid: d3781c55-81cb-4119-8e13-e9e4ca66a228
devices:
infiniband0:
address: b1:00.0
type: pci
ephemeral: false
profiles:
- default
stateful: false
description: ""
VM boot
KVM/libvirt
time virt-install --name=r8-kvm --vcpus=32 --ram=262144 \
--disk path=/var/lib/libvirt/images/r8-kvm.img,size=32,format=qcow2 \
--cdrom=/work/OS/RockyLinux/8.6/Rocky-8.6-x86_64-minimal.iso \
--network bridge:br0 --hostdev b1:00.0,address.type=pci \
--graphics vnc,port=5900,listen=0.0.0.0,password=123456 --debug
[Wed, 25 Jan 2023 11:31:39 virt-install 15151] DEBUG (cli:204) Launched with command line: /usr/bin/virt-install --name=r8-kvm --vcpus=32 --ram=262144 --disk path=/var/lib/libvirt/images/r8-kvm.img,size=32,format=qcow2 --cdrom=/work/OS/RockyLinux/8.6/Rocky-8.6-x86_64-minimal.iso --network bridge:br0 --hostdev b1:00.0,address.type=pci --graphics vnc,port=5900,listen=0.0.0.0,password=123456 --debug
-- snip -
Starting install...
[Wed, 25 Jan 2023 11:31:40 virt-install 15151] DEBUG (installer:587) Generated initial_xml:
-- snip --
Domain is still running. Installation may be in progress.
[Wed, 25 Jan 2023 11:32:30 virt-install 15151] DEBUG (cli:265) Waiting for the installation to complete.
It took ~50sec until VM up. (majority of time was allocating 256GB memory)
LXD
# time lxc start r8-lxd
real 1m27.905s
user 0m0.047s
sys 0m0.024s
VM force shutdown
KVM/libvirt
root@ice01:~# time virsh destroy r8-kvm
Domain 'r8-kvm' destroyed
real 0m3.346s
user 0m0.008s
sys 0m0.008s
LXD
# time lxc stop r8-lxd --force
Error: Instance "stop" operation timed out after 30s
Try `lxc info --show-log r8-lxd` for more info
real 0m30.347s
user 0m0.036s
sys 0m0.036s
VM reboot
VM reboot is totally diferent behaviors.
with LXD, it takes several minutes until VM comes back again. Because VM frees all memory at shutdown, then allocate them to boot up again.
reboot VM on KVM/libvert, it finished in less than 1 min since it keeps all allocated 256GB RAM during reboot.