0

I am trying to create a Windows 7 virtual machine on a Gentoo x86_64 host (kernel 3.18.9 hardened) using qemu-system-x86_64 2.3.0 with kvm enabled. I have successfully compiled the kernel and have installed the guest machine (Windows 7) although the guest is suffering from major performance issues which I believe are IO related.

The specs of the host are 1.7ghz (2.6ghz turbo) i5-3317U (2 cores, 4 threads) with 6gb ddr3 ram and a 5300rpm hard drive. The host runs AES luks encrypted file volumes mounted on /home where the VMs image is stored. The specs of the guest are 2 cores, 4 threads, 4gb ram, 15gb image (which leaves 1gb of disk space for testing). The container of the guest is qcow2, compat 1.1, lazy refcounts: true, recount bits: 16, with cache set to none. I have also tried converting this qcow2 container to raw format and it helped with the issue a tiny bit.

I have installed and enabled virtio drivers where ever possible and have verified that qemu is using kvm via issuing the info kvm command inside qemus terminal. I have also tried hand tuning my launch script shown below:

#!/bin/bash
export QEMU_AUDIO_DRV=alsa
exec qemu-system-x86_64 \
    --enable-kvm \
    -machine type=pc,accel=kvm \
    -smp cores=2,threads=4 \
    -vga std \
    -soundhw ac97 \
    -drive file=/WindowsVM.img2,cache=none,if=virtio \
    -netdev user,id=vmnic -device virtio-net,netdev=vmnic \
    -cpu host \
    -m 4G \
    -balloon virtio \
    -name Windows \
    -usbdevice tablet \
    -monitor stdio \
    "$@"

The problem is that the image takes for ever to boot and to shutdown. It also takes a substantial amount of time to open applications (15-20 seconds to open internet explorer for testing), although once opened a few times speeds increase for the applications opening as if they are being cached. Another fact I've notice is extracting zip files never exceed 50-60kb/s and file downloads download at my regular download speed, but once they hit 100% they stall for a bit before it finishes. I have ran crystal disk mark to benchmark the virtual disk IO and I am getting sequential 400mb/s reads and 300mb/s writes which is blatantly incorrect. These high benches are when I boot the VM from an image stored in the encrypted file volume as mentioned above. When moving the image to an unencrypted mount point benches read 70mb/s read and 35mb/s writes which seem more sane. Coincidentally the VM suffers much less of this "lag" when the image is stored in an unencrypted location. The boot/shutdown times are still fairly lengthy but no where near the time it takes while the image is stored in an encrypted location nor is the opening/closing of software.

As I've seen through testing, the encrypted file volume where I want the image to live may be causing the issues, but I would like a second opinion or other options I could try. Is it possible to encrypt the image itself through some method that may have less performance impact than storing the unencrypted image on an encrypted mount point? Is there encryption built into the container I could enable or is there a better way to use cryptsetup/luks to encrypt specifically the container to improve performance?

Thanks for your help.

2
  • Do yourself a favor and use virt-manager. Nov 9, 2015 at 23:56
  • @MichaelHampton What advantages does virt-manager give over what he doing? Does it provide diagnostic tools or some other helpful features? Or is it just a wrapper to easily spin up vms? Nov 10, 2015 at 1:29

1 Answer 1

1

Can you use an LVM volume for the guest's disk, rather than an .img file that sits on top of host OS filesystem? That gets the virutal machine one step closer to the hardware and removes the likely bottleneck from encryption. The virtualized windows could run it's own encryption, if that's a concern.

Non-SSD, non RAID storage -> Encrypted linux filesystem -> NTFS provides a lot opportunities for i/o slowdowns.

3
  • I can try using a LVM volume. Would using LUKs encryption on the LVM in turn repeat the same bottle neck or would it work a bit faster than having an encrypted file volume mounted? As for encrypting the data on the Windows side what kind of software should I look into for protecting the data? Would this bottleneck be relieved if I were to place the encrypted container on an ssd?
    – user312344
    Nov 9, 2015 at 20:32
  • The goal should be getting the host operating system out of the way - so if the encryption done by host's kernel, that's another performance hit. The host kernel is running the virtualization software and running a filesystem under the guest OS, and doing the decryption on the fly for the guest OS. Using an LVM volume isolates the disk operations, leaving the host to just run the virt process.
    – Bendy
    Nov 9, 2015 at 21:05
  • Here's some info about NTFS. I dont know alot about it personally. Using an SSD won't change the logical bottlenecks, but it does give you a lot more i/o to brute force through the bottlenecks. For an OS with a GUI, I think SSD disk speeds are a must.
    – Bendy
    Nov 9, 2015 at 21:06

You must log in to answer this question.