Question about KVM/QEMU vs LXC performance

LangDuTienTu

Member
Sep 15, 2020
12
0
21
36
Iam currently only using KVM/QEMU and not familiar with benchmark tools. I may switch to LXC/LXD and did search for some hours but cannot find a clearly answer about performance comparision between them.
I can only find old benchmarks and realize they seem did not use KVM in combination with QEMU and passthrough hardware such as SSD/HDD to get the best result with KVM.

For my purpose, I wanna run a NAS (based on Ubuntu with some HDDs and using qBittorrent) and a Webserver (manually compiling every packages). They 2 whatever using KVM or LXC/LXD will run their system parition on their own dedicated SSD. I currently mount a physical ssd to NAS for system parition and passthrough sata controller for HDDs, and Webserver it has only 1 NVMe so I simply passthrough NVMe controller to its KVM.

And I have some question need you to help me with
1. KVM/QEMU performance compares to LXC/LXD in CPU, RAM and especially Disk IO.
2. Can LXC/LXD mount physical disk directly? Cause I wanna keep all my HDDs data also with its ext4, as I use no benefits of ZFS.
3. Should I use LXC/LXD for NAS? I don't use RAID at all, my NAS is only for qBit and local sharing mainly.
4. Should I use LXC/LXD for Webserver purpose? I always manual compile OpenSSL, PHP, Apache, HAProxy and usually keep them up to date. I also wanna upgrade Debian to the latest version as well.

It's a long post now... Thank you.
 
1. It could be faster, but when using the virtio SCSI driver in a Linux VM, it will probably not be much.
2. You can mount the disks on the host and bind mount them to containers.
3. I prefer this because the low overhead and the container can use the full host disk cache (and all the ZFS features). Using a NAS VM with ZFS on top of the host with ZFS seems overkill and inefficient to me.
4. I use a container for a local subnet private web server (MythTV). If you intend to connect your web server to the internet, I suggest a VM because it adds another layer of protection: if the kernel or root account gets hacked, it will still be in the VM and not on the host. Also you could use a hardened kernel or Linux distribution that is made specifically for internet web servers.

Hope this helps a little.
 
  • Like
Reactions: LangDuTienTu
3. I prefer this because the low overhead and the container can use the full host disk cache (and all the ZFS features). Using a NAS VM with ZFS on top of the host with ZFS seems overkill and inefficient to me.

Thank you for your clear answer, I quote this cause I have further questions wanna ask.

3.1. I also wanna install a media server also, may be Plex. I rarely use transcode but in case of using it on VM NAS, I can easily passthrough GPU to VM and its performance is perfect. With container can I do something similar? Iam using AMD RX 580 and this card does not have SR-IOV/MxGPU so the plan using vGPU is not able.
3.2. qBit NOX with WebUI lacks some functions, now I wanna use qBit in Desktop Environment. I did some research but atm I still cannot make GUI working on Ubuntu container. If you have experience about this please give me guide.

PS 3.1: I give LXD VM a test and able to run GUI on it and connect with VNC. But I cannot do the same with LXD Container.
 
Last edited: