Raw LVM disk write is four times faster on host than inside KVM guest?

Nick asked:

I’ve got a Debian 10.6 Host, with a Debian 10.6 guest. KVM/Qemu/libvirt. The host has a software RAID 10 array with 6 mechanical disks. LVM is on top of the RAID array. One LV is passed into the guest using:

<disk type='block' device='disk'>
  <driver name='qemu' type='raw' cache='none' io='native'/>
  <source dev='/dev/raid10/lv0'/>
  <target dev='vdb' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</disk>

The host writes to the logical volume at about 720 MB/s:

dd of=diskbench if=/dev/zero bs=30000000 count=2000
(60 GB, 56 GiB) copied, 82.7758 s, 725 MB/s
(60 GB, 56 GiB) copied, 82.5263 s, 727 MB/s
(60 GB, 56 GiB) copied, 83.8701 s, 715 MB/s
(45 GB, 42 GiB) copied, 58.9086 s, 772 MB/s

Inside the guest though, the same test runs much slower:

dd of=diskbench if=/dev/zero bs=30000000 count=2000
(60 GB, 56 GiB) copied, 254.088 s, 236 MB/s
(60 GB, 56 GiB) copied, 245.407 s, 244 MB/s
(60 GB, 56 GiB) copied, 242.558 s, 247 MB/s

This system is not in production yet and not under load. What can I check for to improve write performance?

My answer:


The only thing that really stands out with your configuration is using the old virtio-blk driver, which is getting little maintenance for the past several years. Consider using virtio-scsi instead.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.