This section describes more techniques for tuning block I/O performance in virtualized environments.
7.4.1. Disk I/O Throttling
When several virtual machines are running simultaneously, they can interfere with system performance by using excessive disk I/O. Disk I/O throttling in KVM provides the ability to set a limit on disk I/O requests sent from virtual machines to the host machine. This can prevent a virtual machine from over-utilizing shared resources and impacting the performance of other virtual machines.
Disk I/O throttling can be useful in various situations, for example when guest virtual machines belonging to different customers are running on the same host, or when quality of service guarantees are given for different guests. Disk I/O throttling can also be used to simulate slower disks.
I/O throttling can be applied independently to each block device attached to a guest and supports limits on throughput and I/O operations. Use the
virsh blkdeviotune command to set I/O limits for a virtual machine:
# virsh blkdeviotune virtual_machine device --parameter limit
Device specifies a unique target name (
<target dev='name'/>) or source file (
<source file='name'/>) for one of the disk devices attached to the virtual machine. Use the
virsh domblklist command for a list of disk device names.
Optional parameters include:
The total throughput limit in bytes per second.
The read throughput limit in bytes per second.
The write throughput limit in bytes per second.
The total I/O operations limit per second.
The read I/O operations limit per second.
The write I/O operations limit per second.
For example, to throttle
virtual_machine to 1000 I/O operations per second and 50 MB per second throughput, run this command:
# virsh blkdeviotune virtual_machine vda --total-iops-sec 1000 --total-bytes-sec 52428800
7.4.2. Multi-Queue virtio-scsi
Multi-queue virtio-scsi provides improved storage performance and scalability in the virtio-scsi driver. It enables each virtual CPU to have a separate queue and interrupt to use without affecting other vCPUs.
126.96.36.199. Configuring Multi-Queue virtio-scsi
Multi-queue virtio-scsi is disabled by default on Red Hat Enterprise Linux 7.
To enable multi-queue virtio-scsi support in the guest, add the following to the guest XML configuration, where N is the total number of vCPU queues:
<controller type='scsi' index='0' model='virtio-scsi'>
<driver queues='N' />