Enabling multi-queue helps performance on SMP guests because the completion interrupt is handled on the vCPU that submitted the I/O request. This avoids IPIs inside the guest.
Note that performance is unchanged in these cases: 1. Uniprocessor guests. They don't have IPIs. 2. Application threads might be scheduled on the sole vCPU that handles completion interrupts purely by chance. (This is one reason why benchmark results can vary noticably between runs.) 3. Users may bind the application to the vCPU that handles completion interrupts. Set the number of queues to the number of vCPUs by default. Older machine types continue to default to 1 queue for live migration compatibility. This patch improves IOPS by 1-4% on an Intel Optane SSD with 4 vCPUs, -drive aio=native, and fio bs=4k direct=1 rw=randread. Stefan Hajnoczi (5): virtio-scsi: introduce a constant for fixed virtqueues virtio: add VirtioDeviceClass->get_num_virtqueues() virtio-scsi: default num_queues to -smp N virtio-blk: default num_queues to -smp N vhost-user-blk: default num_queues to -smp N hw/block/vhost-user-blk.c | 15 +++++++++++++++ hw/block/virtio-blk.c | 17 +++++++++++++++++ hw/core/machine.c | 5 +++++ hw/scsi/vhost-scsi.c | 2 ++ hw/scsi/vhost-user-scsi.c | 4 +++- hw/scsi/virtio-scsi.c | 25 ++++++++++++++++++++++--- hw/virtio/vhost-scsi-pci.c | 4 ++-- hw/virtio/vhost-user-blk-pci.c | 3 ++- hw/virtio/vhost-user-scsi-pci.c | 4 ++-- hw/virtio/virtio-blk-pci.c | 3 ++- hw/virtio/virtio-scsi-pci.c | 4 ++-- include/hw/virtio/vhost-user-blk.h | 1 + include/hw/virtio/virtio-blk.h | 1 + include/hw/virtio/virtio-scsi.h | 4 ++++ include/hw/virtio/virtio.h | 7 +++++++ 15 files changed, 87 insertions(+), 12 deletions(-) -- 2.24.1