Skip to contentSkip to conversation

QEMU disk I/O limits

RFC Zhi Yong Wu 12 participants 32 messages May 30, 2011 – Jun 4, 2011 KVM

lore
Share & tools
lore
#0 lore raw

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

More detail is available here:
http://wiki.qemu.org/Features/DiskIOLimits

1.) Why we need per-drive disk I/O limits
As you've known, for linux, cgroup blkio-controller has supported I/O throttling on block devices. More importantly, there is no single mechanism for disk I/O throttling across all underlying storage types (image file, LVM, NFS, Ceph) and for some types there is no way to throttle at all.

Disk I/O limits feature introduces QEMU block layer I/O limits together with command-line and QMP interfaces for configuring limits. This allows I/O limits to be imposed across all underlying storage types using a single interface.

2.) How disk I/O limits will be implemented
QEMU block layer will introduce a per-drive disk I/O request queue for those disks whose "disk I/O limits" feature is enabled. It can control disk I/O limits individually for each disk when multiple disks are attached to a VM, and enable use cases like unlimited local disk access but shared storage access with limits. In mutliple I/O threads scenario, when an application in a VM issues a block I/O request, this request will be intercepted by QEMU block layer, then it will calculate disk runtime I/O rate and determine if it has go beyond its limits. If yes, this I/O request will enqueue to that introduced queue; otherwise it will be serviced.

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk. The feature will also provide users with the ability to change per-drive disk I/O limits at runtime using QMP commands.

Regards,

Zhiyong Wu

#1 lore raw
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

Thanks
Vivek

Quoted 20 lines

More detail is available here:
http://wiki.qemu.org/Features/DiskIOLimits

1.) Why we need per-drive disk I/O limits
As you've known, for linux, cgroup blkio-controller has supported I/O throttling on block devices. More importantly, there is no single mechanism for disk I/O throttling across all underlying storage types (image file, LVM, NFS, Ceph) and for some types there is no way to throttle at all.

Disk I/O limits feature introduces QEMU block layer I/O limits together with command-line and QMP interfaces for configuring limits. This allows I/O limits to be imposed across all underlying storage types using a single interface.

2.) How disk I/O limits will be implemented
QEMU block layer will introduce a per-drive disk I/O request queue for those disks whose "disk I/O limits" feature is enabled. It can control disk I/O limits individually for each disk when multiple disks are attached to a VM, and enable use cases like unlimited local disk access but shared storage access with limits. In mutliple I/O threads scenario, when an application in a VM issues a block I/O request, this request will be intercepted by QEMU block layer, then it will calculate disk runtime I/O rate and determine if it has go beyond its limits. If yes, this I/O request will enqueue to that introduced queue; otherwise it will be serviced.

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk. The feature will also provide users with the ability to change per-drive disk I/O limits at runtime using QMP commands.

Regards,

Zhiyong Wu

#2 lore raw
Quoted 11 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

blkio controller only works for block devices. It doesn't work when using files.

Regards,

Anthony Liguori

#16 lore raw
In reply to Vivek Goyal
Quoted 11 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

The finest level of granularity offered by cgroups apply limits per QEMU process. So the blkio controller can't be used to apply controls directly to individual disks used by QEMU, only the VM as a whole.

We networking we can use 'net_cls' cgroups controller for the process as a whole, or attach 'tc' to individual TAP devices for per-NIC throttling, both of which ultimately use the same kernel functionality. I don't see an equivalent option for throttling individual disks that would reuse functionality from the blkio controller.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#3 lore raw
In reply to Anthony Liguori
Quoted 8 lines · Anthony Liguori
Quoted 7 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Quoted 7 lines
Quoted 4 lines

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

blkio controller only works for block devices. It doesn't work when using files.

So can't we comeup with something to easily determine which device backs up this file? Though that will still not work for NFS backed storage though.

Thanks
Vivek

#17 lore raw
In reply to Daniel P. Berrange
Quoted 8 lines · Daniel P. Berrange
Quoted 7 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Quoted 8 lines
Quoted 4 lines

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

The finest level of granularity offered by cgroups apply limits per QEMU process. So the blkio controller can't be used to apply controls directly to individual disks used by QEMU, only the VM as a whole.

So are multiple VMs using same disk. Then put multiple VMs in same cgroup and apply the limit on that disk.

Or if you want to put a system wide limit on a disk, then put all VMs in root cgroup and put limit on root cgroups.

I fail to understand what's the exact requirement here. I thought the biggest use case was isolation one VM from other which might be sharing same device. Hence we were interested in putting per VM limit on disk and not a system wide limit on disk (independent of VM).

Thanks
Vivek

#18 lore raw
Quoted 21 lines · Vivek Goyal
Quoted 8 lines · Daniel P. Berrange
Quoted 7 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Quoted 8 lines
Quoted 4 lines

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

The finest level of granularity offered by cgroups apply limits per QEMU process. So the blkio controller can't be used to apply controls directly to individual disks used by QEMU, only the VM as a whole.

So are multiple VMs using same disk. Then put multiple VMs in same cgroup and apply the limit on that disk.

Quoted 8 lines

Or if you want to put a system wide limit on a disk, then put all VMs in root cgroup and put limit on root cgroups.

I fail to understand what's the exact requirement here. I thought the biggest use case was isolation one VM from other which might be sharing same device. Hence we were interested in putting per VM limit on disk and not a system wide limit on disk (independent of VM).

No, it isn't about putting limits on a disk independant of a VM. It is about one VM having multiple disks, and wanting to set different policies for each of its virtual disks. eg

qemu-kvm -drive file=/dev/sda1 -drive file=/dev/sdb3

and wanting to say that sda1 is limited to 10 MB/s, while sdb3 is limited to 50 MB/s. You can't do that kind of thing with cgroups, because it can only control the entire process, not individual resources within the process.

Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#4 lore raw
In reply to Vivek Goyal
Quoted 14 lines · Vivek Goyal
Quoted 13 lines · Anthony Liguori
Quoted 11 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

Quoted 6 lines
Quoted 2 lines

blkio controller only works for block devices. It doesn't work when using files.

So can't we comeup with something to easily determine which device backs up this file? Though that will still not work for NFS backed storage though.

Right.

Additionally, in QEMU, we can rate limit based on concepts that make sense to a guest. We can limit the actual I/O ops visible to the guest which means that we'll get consistent performance regardless of whether the backing file is qcow2, raw, LVM, or raw over NFS.

The kernel just doesn't have enough information to do a good job here.

Regards,

Anthony Liguori

Quoted 4 lines

Thanks
Vivek

#19 lore raw
In reply to Daniel P. Berrange
Quoted 35 lines · Daniel P. Berrange
Quoted 21 lines · Vivek Goyal
Quoted 8 lines · Daniel P. Berrange
Quoted 7 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Quoted 8 lines
Quoted 4 lines

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

The finest level of granularity offered by cgroups apply limits per QEMU process. So the blkio controller can't be used to apply controls directly to individual disks used by QEMU, only the VM as a whole.

So are multiple VMs using same disk. Then put multiple VMs in same cgroup and apply the limit on that disk.

Quoted 8 lines

Or if you want to put a system wide limit on a disk, then put all VMs in root cgroup and put limit on root cgroups.

I fail to understand what's the exact requirement here. I thought the biggest use case was isolation one VM from other which might be sharing same device. Hence we were interested in putting per VM limit on disk and not a system wide limit on disk (independent of VM).

No, it isn't about putting limits on a disk independant of a VM. It is about one VM having multiple disks, and wanting to set different policies for each of its virtual disks. eg

Quoted 6 lines

qemu-kvm -drive file=/dev/sda1 -drive file=/dev/sdb3

and wanting to say that sda1 is limited to 10 MB/s, while sdb3 is limited to 50 MB/s. You can't do that kind of thing with cgroups, because it can only control the entire process, not individual resources within the process.

With IO controller you can do that. Limits are "per cgroup per disk". So once you have put a VM in a cgroup, you can specify two differnt limits for two disk for that cgroup.

There are 4 relevant files per cgroup.

blkio.throttle.read_bps_device
blkio.throttle.write_bps_device
blkio.throttle.read_iops_device
blkio.throttle.write_iops_device

And syntax of these files is.

device_major:device_minor <rate_limit>

Ex.

8:16 1024000

This means from a specified cgroup, on disk with major:minor 8:16, don't allow read BW higher than 1024000 bytes per second.

Thanks
Vivek

#20 lore raw
In reply to Daniel P. Berrange
Quoted 35 lines · Daniel P. Berrange
Quoted 21 lines · Vivek Goyal
Quoted 8 lines · Daniel P. Berrange
Quoted 7 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Quoted 8 lines
Quoted 4 lines

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

The finest level of granularity offered by cgroups apply limits per QEMU process. So the blkio controller can't be used to apply controls directly to individual disks used by QEMU, only the VM as a whole.

So are multiple VMs using same disk. Then put multiple VMs in same cgroup and apply the limit on that disk.

Quoted 8 lines

Or if you want to put a system wide limit on a disk, then put all VMs in root cgroup and put limit on root cgroups.

I fail to understand what's the exact requirement here. I thought the biggest use case was isolation one VM from other which might be sharing same device. Hence we were interested in putting per VM limit on disk and not a system wide limit on disk (independent of VM).

No, it isn't about putting limits on a disk independant of a VM. It is about one VM having multiple disks, and wanting to set different policies for each of its virtual disks. eg

Quoted 6 lines

qemu-kvm -drive file=/dev/sda1 -drive file=/dev/sdb3

and wanting to say that sda1 is limited to 10 MB/s, while sdb3 is limited to 50 MB/s. You can't do that kind of thing with cgroups, because it can only control the entire process, not individual resources within the process.

yes, but with files:

qemu-kvm -drive file=/path/to/local/vm/images
-drive file=/path/to/shared/storage

Signature · 4 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
[email protected]
#5 lore raw
In reply to Anthony Liguori
Quoted 22 lines · Anthony Liguori
Quoted 14 lines · Vivek Goyal
Quoted 13 lines · Anthony Liguori
Quoted 11 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

Quoted 6 lines
Quoted 2 lines

blkio controller only works for block devices. It doesn't work when using files.

So can't we comeup with something to easily determine which device backs up this file? Though that will still not work for NFS backed storage though.

Quoted 7 lines

Right.

Additionally, in QEMU, we can rate limit based on concepts that make sense to a guest. We can limit the actual I/O ops visible to the guest which means that we'll get consistent performance regardless of whether the backing file is qcow2, raw, LVM, or raw over NFS.

Are you referring to merging taking place which can change the definition of IOPS as seen by guest?

We do throttling at bio level and no merging is taking place. So IOPS seen by guest and as seen by throttling logic should be same. Readahead would be one exception though where any readahead data will be charged to guest.

Device throttling and interaction with file system is still an issue with IO controller (things like journalling lead to serialization) where a faster group can get blocked behind slower group. That's why at the moment, it is recommened that directly export devices/partitions to virtual machines if throttling is to be used and don't share a file system across VMs.

Quoted 1 line

The kernel just doesn't have enough information to do a good job here.

[CCing couple of device mapper folks for thoughts on below]

When I think more about it, I think this problem is very similar to other features like snapshotting. Whether we should implement snapshotting in qemu or use some kernel based solution like dm-snaphot or dm-multisnap etc.

I don't have a good answer for that. Has this detabe been settled already? I see that development is happening in kernel or providing dm snapshot capabilities and Mike Snitzer also mentioned about possibility of using dm-loop for covering the case of files over NFS etc.

Some thoughts in general though.

- Any kernel based solution is generic and can be used in other contexts also like containers or bare metal.

- In some cases, kernel can implement throttling more efficiently. For example if a block devie has multiple partitions and these partitions are exported to VMs, then kernel can maintain a single queue and single set of timer to manage all the VMs doing IO to that device. In user space solution we shall have manage as many queues and timers as there are VMs.

So kernel implementation can enable more efficient implementation in certain cases.

- Things like dm-loop essentially means introduce another block layer on top of file system layer. I personally think that it does not sound very clean and might slow down things. Though I don't have any data. Has there been any discussion/conclusion on this?

- qemu based scheme will work well with all kind of targets. For using kenrel based scheme one shall have to switch to using kernel provided snapshotting schemes (dm-snapshot or dm multisnap etc). Otherwise a READ might come from a base image which is on other device and we did not throttle the VM.

Thanks
Vivek

#6 lore raw
Quoted 25 lines · Vivek Goyal
Quoted 24 lines · Anthony Liguori
Quoted 14 lines · Vivek Goyal
Quoted 13 lines · Anthony Liguori
Quoted 11 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

Quoted 6 lines
Quoted 2 lines

blkio controller only works for block devices. It doesn't work when using files.

So can't we comeup with something to easily determine which device backs up this file? Though that will still not work for NFS backed storage though.

Right.

Quoted 8 lines
Quoted 5 lines

Additionally, in QEMU, we can rate limit based on concepts that make sense to a guest. We can limit the actual I/O ops visible to the guest which means that we'll get consistent performance regardless of whether the backing file is qcow2, raw, LVM, or raw over NFS.

Are you referring to merging taking place which can change the definition of IOPS as seen by guest?

No, with qcow2, it may take multiple real IOPs for what the guest sees as an IOP.

That's really the main argument I'm making here. The only entity that knows what a guest IOP corresponds to is QEMU. On the backend, it may end up being a network request, multiple BIOs to physical disks, file access, etc.

That's why QEMU is the right place to do the throttling for this use case. That doesn't mean device level throttling isn't useful but just that for virtualization, it makes more sense to do it in QEMU.

Regards,

Anthony Liguori

#7 lore raw
Quoted 35 lines · Anthony Liguori
Quoted 25 lines · Vivek Goyal
Quoted 24 lines · Anthony Liguori
Quoted 14 lines · Vivek Goyal
Quoted 13 lines · Anthony Liguori
Quoted 11 lines · Vivek Goyal
Quoted 5 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

Quoted 6 lines
Quoted 2 lines

blkio controller only works for block devices. It doesn't work when using files.

So can't we comeup with something to easily determine which device backs up this file? Though that will still not work for NFS backed storage though.

Right.

Quoted 8 lines
Quoted 5 lines

Additionally, in QEMU, we can rate limit based on concepts that make sense to a guest. We can limit the actual I/O ops visible to the guest which means that we'll get consistent performance regardless of whether the backing file is qcow2, raw, LVM, or raw over NFS.

Are you referring to merging taking place which can change the definition of IOPS as seen by guest?

Quoted 7 lines

No, with qcow2, it may take multiple real IOPs for what the guest sees as an IOP.

That's really the main argument I'm making here. The only entity that knows what a guest IOP corresponds to is QEMU. On the backend, it may end up being a network request, multiple BIOs to physical disks, file access, etc.

Ok, so we seem to be talking of two requirements.

- A consistent experience to guest
- Isolation between VMs.

If this qcow2 mapping/metada overhead is not significant, then we don't have to worry about IOPs perceived by guest. It will be more or less same. If it is significant then we provide more consistent experience to guest but then weaken the isolation between guest and might overload the backend storage and in turn might not get the expected IOPS for the guest anyway.

So I think these two things are not independent.

I agree though that advantage of qemu is that everything is a file and handling all the complex configuraitons becomes very easy.

Having said that, to provide a consistent experience to guest, you also need to know where IO from guest is going and whether underlying storage system can support that kind of IO or not.

IO limits are of not much use if if these are put in isolation without knowing where IO is going and how many VMs are doing IO to it. Otherwise there are no gurantees/estimates on minimum bandwidth for guests hence there is no consistent experience.

Thanks
Vivek

#21 lore raw
In reply to Zhi Yong Wu

On Mon, May 30, 2011 at 01:09:23PM +0800, Zhi Yong Wu wrote:

[..]

Quoted 2 lines

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk.

How does throughput interface look like? is it bytes per second or something else?

Do we have read and write variants for throughput as we have for iops.

if you have bytes interface(as kenrel does), then "bps_rd" and "bps_wr" might be good names too for thoughput interface.

Thanks
Vivek

#14 lore raw
In reply to Anthony Liguori
Quoted 38 lines · Anthony Liguori
Quoted 9 lines · Vivek Goyal
Quoted 8 lines · Anthony Liguori
Quoted 7 lines · Vivek Goyal
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Vivek Goyal
Quoted 4 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect. This feature will enable the user to cap disk I/O amount

performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

Quoted 16 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

Hi Zhiyong,

Why not use kernel blkio controller for this and why reinvent the wheel and implement the feature again in qemu?

Quoted 6 lines
Quoted 2 lines

blkio controller only works for block devices. It doesn't work when using files.

So can't we comeup with something to easily determine which device backs up this file? Though that will still not work for NFS backed storage though.

Right.

Quoted 8 lines
Quoted 5 lines

Additionally, in QEMU, we can rate limit based on concepts that make sense to a guest. We can limit the actual I/O ops visible to the guest which means that we'll get consistent performance regardless of whether the backing file is qcow2, raw, LVM, or raw over NFS.

Are you referring to merging taking place which can change the definition of IOPS as seen by guest?

Quoted 7 lines

No, with qcow2, it may take multiple real IOPs for what the guest sees as an IOP.

That's really the main argument I'm making here. The only entity that knows what a guest IOP corresponds to is QEMU. On the backend, it may end up being a network request, multiple BIOs to physical disks, file access, etc.

Couldn't QEMU give a hint to the kernel about the ratio of guest IOP to real IOPs? Or is QEMU blind to the real IOPs that correspond to a guest IOP?

If QEMU is trully blind to the amount of real IOPs then couldn't QEMU driven throttling cause physical resources to be oversubscribed (underestimating the backend work it is creating)?

Mike

#15 lore raw
Quoted 9 lines · Mike Snitzer
Quoted 6 lines · Anthony Liguori
Quoted 2 lines

Are you referring to merging taking place which can change the definition of IOPS as seen by guest?

No, with qcow2, it may take multiple real IOPs for what the guest sees as an IOP.

Quoted 8 lines
Quoted 4 lines

That's really the main argument I'm making here. The only entity that knows what a guest IOP corresponds to is QEMU. On the backend, it may end up being a network request, multiple BIOs to physical disks, file access, etc.

Couldn't QEMU give a hint to the kernel about the ratio of guest IOP to real IOPs? Or is QEMU blind to the real IOPs that correspond to a guest IOP?

Perhaps, but how does that work when the disk image is backed by NFS?

And even if you had a VFS level API, we can do things like libcurl based block devices in QEMU. So unless you tried to do level 5 traffic throttling which hopefully, you'll agree is total overkill, we're going to need to have this functionality in QEMU no matter what.

Regards,

Anthony Liguori

#8 lore raw
In reply to Vivek Goyal
Quoted 7 lines · Vivek Goyal
Quoted 1 line · Anthony Liguori

On 05/31/2011 12:59 PM, Vivek Goyal wrote:

Ok, so we seem to be talking of two requirements.

- A consistent experience to guest
- Isolation between VMs.

Quoted 6 lines

If this qcow2 mapping/metada overhead is not significant, then we don't have to worry about IOPs perceived by guest. It will be more or less same. If it is significant then we provide more consistent experience to guest but then weaken the isolation between guest and might overload the backend storage and in turn might not get the expected IOPS for the guest anyway.

That's quite a bit of hand waving considering your following argument is that you can't be precise enough at the QEMU level.

Quoted 5 lines

So I think these two things are not independent.

I agree though that advantage of qemu is that everything is a file and handling all the complex configuraitons becomes very easy.

Quoted 8 lines

Having said that, to provide a consistent experience to guest, you also need to know where IO from guest is going and whether underlying storage system can support that kind of IO or not.

IO limits are of not much use if if these are put in isolation without knowing where IO is going and how many VMs are doing IO to it. Otherwise there are no gurantees/estimates on minimum bandwidth for guests hence there is no consistent experience.

Consistent and maximum are two very different things.

QEMU can, very effectively, enforce a maximum I/O rate. This can then be used to provide mostly consistent performance across different generations of hardware, to implement service levels in a tiered offering, etc.

The level of consistency will then depend on whether you overcommit your hardware and how you have it configured.

Consistency is very hard because at the end of the day, you still have shared resources. Even with blkio, I presume one guest can still impact another guest by forcing the disk to do excessive seeking or something of that nature.

So absolutely consistency can't be the requirement for the use-case. The use-cases we are interested really are more about providing caps than anything else.

Regards,

Anthony Liguori

Quoted 4 lines

Thanks
Vivek

#22 lore raw
In reply to Vivek Goyal
Quoted 11 lines · Vivek Goyal

Date: Tue, 31 May 2011 15:55:49 -0400
From: Vivek Goyal <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
User-Agent: Mutt/1.5.21 (2010-09-15)

Quoted 8 lines

On Mon, May 30, 2011 at 01:09:23PM +0800, Zhi Yong Wu wrote:

[..]

Quoted 2 lines

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk.

How does throughput interface look like? is it bytes per second or something else?

HI, Vivek,
It will be a value based on bytes per second.

Quoted 2 lines

Do we have read and write variants for throughput as we have for iops.

QEMU code has two variants "rd_bytes, wr_bytes", but we maybe need to get their bytes per second.

Quoted 3 lines

if you have bytes interface(as kenrel does), then "bps_rd" and "bps_wr" might be good names too for thoughput interface.

I agree with you, and can change them as your suggestions.

Regards,

Zhiyong Wu

Quoted 4 lines

Thanks
Vivek

#25 lore raw
In reply to Vivek Goyal
Quoted 11 lines · Vivek Goyal

Date: Tue, 31 May 2011 15:55:49 -0400
From: Vivek Goyal <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
User-Agent: Mutt/1.5.21 (2010-09-15)

Quoted 8 lines

On Mon, May 30, 2011 at 01:09:23PM +0800, Zhi Yong Wu wrote:

[..]

Quoted 2 lines

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk.

How does throughput interface look like? is it bytes per second or something else?

Given your suggestion, its form will look like below:

-drive [iops=xxx][,bps=xxx] or -drive [iops_rd=xxx][,iops_wr=xxx][,bps_rd=xxx][,bps_wr=xxx]

Regards,

Zhiyong Wu

Quoted 9 lines

Do we have read and write variants for throughput as we have for iops.

if you have bytes interface(as kenrel does), then "bps_rd" and "bps_wr" might be good names too for thoughput interface.

Thanks
Vivek

#9 lore raw
In reply to Anthony Liguori

On Tue, May 31, 2011 at 06:30:09PM -0500, Anthony Liguori wrote:

[..]

Quoted 2 lines

The level of consistency will then depend on whether you overcommit your hardware and how you have it configured.

Agreed.

Quoted 9 lines

Consistency is very hard because at the end of the day, you still have shared resources. Even with blkio, I presume one guest can still impact another guest by forcing the disk to do excessive seeking or something of that nature.

So absolutely consistency can't be the requirement for the use-case. The use-cases we are interested really are more about providing caps than anything else.

I think both qemu and kenrel can do the job. The only thing which seriously favors throttling implementation in qemu is the ability to handle wide variety of backend files (NFS, qcow, libcurl based devices etc).

So what I am arguing is that your previous reason that qemu can do a better job because it knows effective IOPS of guest, is not necessarily a very good reason. To me simplicity of being able to handle everything as file and do the throttling is the most compelling reason to do this implementation in qemu.

Thanks
Vivek

#26 lore raw
In reply to Zhi Yong Wu
Quoted 15 lines · Zhi Yong Wu
Quoted 14 lines · Vivek Goyal

Date: Tue, 31 May 2011 15:55:49 -0400
From: Vivek Goyal <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
User-Agent: Mutt/1.5.21 (2010-09-15)

On Mon, May 30, 2011 at 01:09:23PM +0800, Zhi Yong Wu wrote:

[..]

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk.

How does throughput interface look like? is it bytes per second or something else?

Given your suggestion, its form will look like below:

-drive [iops=xxx][,bps=xxx] or -drive [iops_rd=xxx][,iops_wr=xxx][,bps_rd=xxx][,bps_wr=xxx]

Can one specify both iops and bps rule for the same drive?

Thanks
Vivek

#10 lore raw
In reply to Vivek Goyal
Quoted 23 lines · Vivek Goyal

On Tue, May 31, 2011 at 06:30:09PM -0500, Anthony Liguori wrote:

[..]

Quoted 2 lines

The level of consistency will then depend on whether you overcommit your hardware and how you have it configured.

Agreed.

Quoted 9 lines

Consistency is very hard because at the end of the day, you still have shared resources.  Even with blkio, I presume one guest can still impact another guest by forcing the disk to do excessive seeking or something of that nature.

So absolutely consistency can't be the requirement for the use-case. The use-cases we are interested really are more about providing caps than anything else.

I think both qemu and kenrel can do the job. The only thing which seriously favors throttling implementation in qemu is the ability to handle wide variety of backend files (NFS, qcow, libcurl based devices etc).

Quoted 5 lines

So what I am arguing is that your previous reason that qemu can do a better job because it knows effective IOPS of guest, is not necessarily a very good reason. To me simplicity of being able to handle everything as file and do the throttling is the most compelling reason to do this implementation in qemu.

The variety of backends is the reason to go for a QEMU-based approach.
If there were kernel mechanisms to handle non-block backends that
would be great. cgroups NFS?

Of course for something like Sheepdog or Ceph it becomes quite hard to do it in the kernel at all since they are userspace libraries that speak their protocol over sockets, and you really don't have sinight into what I/O operations they are doing from the kernel.

One issue that concerns me is how effective iops and throughput are as capping mechanisms. If you cap throughput then you're likely to affect sequential I/O but do little against random I/O which can hog the disk with a seeky I/O pattern. If you limit iops you can cap random I/O but artifically limit sequential I/O, which may be able to perform a high number of iops without hogging the disk due to seek times at all. One proposed solution here (I think Christoph Hellwig suggested it) is to do something like merging sequential I/O counting so that multiple sequential I/Os only count as 1 iop.

I like the idea of a proportional share of disk utilization but doing that from QEMU is problematic since we only know when we issued an I/O to the kernel, not when it's actually being serviced by the disk - there could be queue wait times in the block layer that we don't know about - so we end up with a magic number for disk utilization which may not be a very meaningful number.

So given the constraints and the backends we need to support, disk I/O limits in QEMU with iops and throughput limits seem like the approach we need.

Stefan

#11 lore raw
Quoted 30 lines · Stefan Hajnoczi
Quoted 23 lines · Vivek Goyal

On Tue, May 31, 2011 at 06:30:09PM -0500, Anthony Liguori wrote:

[..]

Quoted 2 lines

The level of consistency will then depend on whether you overcommit your hardware and how you have it configured.

Agreed.

Quoted 9 lines

Consistency is very hard because at the end of the day, you still have shared resources.  Even with blkio, I presume one guest can still impact another guest by forcing the disk to do excessive seeking or something of that nature.

So absolutely consistency can't be the requirement for the use-case. The use-cases we are interested really are more about providing caps than anything else.

I think both qemu and kenrel can do the job. The only thing which seriously favors throttling implementation in qemu is the ability to handle wide variety of backend files (NFS, qcow, libcurl based devices etc).

Quoted 5 lines

So what I am arguing is that your previous reason that qemu can do a better job because it knows effective IOPS of guest, is not necessarily a very good reason. To me simplicity of being able to handle everything as file and do the throttling is the most compelling reason to do this implementation in qemu.

Quoted 3 lines

The variety of backends is the reason to go for a QEMU-based approach.
If there were kernel mechanisms to handle non-block backends that
would be great. cgroups NFS?

I agree that because qemu can handle variety of backends it becomes a very good reason to do throttling in qemu. Kernel currently does not handle files over NFS.

There were some suggestions of using a loop or device mapper loop device on top of NFS images and then implement block device policies like throttling. But I am not convinced that it is a good idea.

To cover the case of NFS we probably shall have to implement something in NFS or something more generic in VFS. But I am not sure if file system guys will like it or is it even worth at this point of time given the fact that primary use case is qemu and qemu can easily implement this funcitonality.

Quoted 5 lines

Of course for something like Sheepdog or Ceph it becomes quite hard to do it in the kernel at all since they are userspace libraries that speak their protocol over sockets, and you really don't have sinight into what I/O operations they are doing from the kernel.

Agreed. This is another reason that why doing it in qemu makes sense.

Quoted 10 lines

One issue that concerns me is how effective iops and throughput are as capping mechanisms. If you cap throughput then you're likely to affect sequential I/O but do little against random I/O which can hog the disk with a seeky I/O pattern. If you limit iops you can cap random I/O but artifically limit sequential I/O, which may be able to perform a high number of iops without hogging the disk due to seek times at all. One proposed solution here (I think Christoph Hellwig suggested it) is to do something like merging sequential I/O counting so that multiple sequential I/Os only count as 1 iop.

One of the things we atleast need to do is allow specifying both bps and iops rule together so that random IO with high iops does not create havoc and seqential or large size IO with low iops and high bps does not overload the system.

I am not sure how IO shows up in qemu but will elevator in guest make sure that lot of sequential IO is merged together? For dependent READS, I think counting multiple sequential reads as 1 iops might help. I think this is one optimization one can do once throttling starts working in qemu and see if it is a real concern.

Quoted 7 lines

I like the idea of a proportional share of disk utilization but doing that from QEMU is problematic since we only know when we issued an I/O to the kernel, not when it's actually being serviced by the disk - there could be queue wait times in the block layer that we don't know about - so we end up with a magic number for disk utilization which may not be a very meaningful number.

To be able to implement proportional IO one should be able to see all IO from all clients at one place. Qemu knows about IO of only its guest and not other guests running on the system. So I think qemu can't implement proportion IO.

Quoted 4 lines

So given the constraints and the backends we need to support, disk I/O limits in QEMU with iops and throughput limits seem like the approach we need.

For qemu yes. For other non-qemu usages we will still require a kernel mechanism of throttling.

Thanks
Vivek

#12 lore raw
Quoted 16 lines · Vivek Goyal
Quoted 9 lines · Stefan Hajnoczi

One issue that concerns me is how effective iops and throughput are as capping mechanisms.  If you cap throughput then you're likely to affect sequential I/O but do little against random I/O which can hog the disk with a seeky I/O pattern.  If you limit iops you can cap random I/O but artifically limit sequential I/O, which may be able to perform a high number of iops without hogging the disk due to seek times at all.  One proposed solution here (I think Christoph Hellwig suggested it) is to do something like merging sequential I/O counting so that multiple sequential I/Os only count as 1 iop.

One of the things we atleast need to do is allow specifying both bps and iops rule together so that random IO  with high iops does not create havoc and seqential or large size IO with low iops and high bps does not overload the system.

Quoted 5 lines

I am not sure how IO shows up in qemu but will elevator in guest make sure that lot of sequential IO is merged together? For dependent READS, I think counting multiple sequential reads as 1 iops might help. I think this is one optimization one can do once throttling starts working in qemu and see if it is a real concern.

The guest can use an I/O scheduler, so for Linux guests we see the typical effects of cfq. Requests do get merged by the guest before being submitted to QEMU.

Okay, good idea. Zhi Yong's test plan includes tests with multiple VMs and both iops and throughput limits at the same time. If workloads turn up that cause issues it would be possible at counting sequential I/Os a 1 iop.

Quoted 8 lines
Quoted 7 lines

I like the idea of a proportional share of disk utilization but doing that from QEMU is problematic since we only know when we issued an I/O to the kernel, not when it's actually being serviced by the disk - there could be queue wait times in the block layer that we don't know about - so we end up with a magic number for disk utilization which may not be a very meaningful number.

Quoted 4 lines

To be able to implement proportional IO one should be able to see all IO from all clients at one place. Qemu knows about IO of only its guest and not other guests running on the system. So I think qemu can't implement proportion IO.

Yeah :(

Quoted 7 lines
Quoted 4 lines

So given the constraints and the backends we need to support, disk I/O limits in QEMU with iops and throughput limits seem like the approach we need.

For qemu yes. For other non-qemu usages we will still require a kernel mechanism of throttling.

Definitely. In fact I like the idea of using blkio-controller for raw image files on local file systems or LVM volumes.

Hopefully the end-user API (libvirt interface) that QEMU disk I/O limits gets exposed from complements the existing blkiotune (blkio-controller) virsh command.

Stefan

#27 lore raw
In reply to Vivek Goyal
Quoted 30 lines · Vivek Goyal

Date: Wed, 1 Jun 2011 09:32:32 -0400
From: Vivek Goyal <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
User-Agent: Mutt/1.5.21 (2010-09-15)

Quoted 18 lines · Zhi Yong Wu
Quoted 17 lines · Vivek Goyal

Date: Tue, 31 May 2011 15:55:49 -0400
From: Vivek Goyal <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
User-Agent: Mutt/1.5.21 (2010-09-15)

On Mon, May 30, 2011 at 01:09:23PM +0800, Zhi Yong Wu wrote:

[..]

Quoted 2 lines

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

How does throughput interface look like? is it bytes per second or something else?

Given your suggestion, its form will look like below:

-drive [iops=xxx][,bps=xxx] or -drive [iops_rd=xxx][,iops_wr=xxx][,bps_rd=xxx][,bps_wr=xxx]

Can one specify both iops and bps rule for the same drive?

Right. They both will together limit runtime I/O rate.

Regards,

Zhiyong Wu

Quoted 3 lines

Thanks
Vivek

#28 lore raw
In reply to Zhi Yong Wu

Hi,

Quoted 13 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

More detail is available here:
http://wiki.qemu.org/Features/DiskIOLimits

1.) Why we need per-drive disk I/O limits
As you've known, for linux, cgroup blkio-controller has supported I/O throttling on block devices. More importantly, there is no single mechanism for disk I/O throttling across all underlying storage types (image file, LVM, NFS, Ceph) and for some types there is no way to throttle at all.

Disk I/O limits feature introduces QEMU block layer I/O limits together with command-line and QMP interfaces for configuring limits. This allows I/O limits to be imposed across all underlying storage types using a single interface.

Quoted 7 lines

2.) How disk I/O limits will be implemented
QEMU block layer will introduce a per-drive disk I/O request queue for those disks whose "disk I/O limits" feature is enabled. It can control disk I/O limits individually for each disk when multiple disks are attached to a VM, and enable use cases like unlimited local disk access but shared storage access with limits. In mutliple I/O threads scenario, when an application in a VM issues a block I/O request, this request will be intercepted by QEMU block layer, then it will calculate disk runtime I/O rate and determine if it has go beyond its limits. If yes, this I/O request will enqueue to that introduced queue; otherwise it will be serviced.

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk. The feature will also provide users with the ability to change per-drive disk I/O limits at runtime using QMP commands.

I'm wondering if you've considered adding a 'burst' parameter - something which will not limit (or limit less) the io ops or the throughput for the first 'x' ms in a given time window.

Quoted 4 lines

Regards,

Zhiyong Wu

Signature · 1 line
Sasha.
#29 lore raw
Quoted 31 lines · Sasha Levin

Date: Thu, 02 Jun 2011 09:17:06 +0300
From: Sasha Levin <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
X-Mailer: Evolution 2.32.2

Hi,

Quoted 17 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

More detail is available here:
http://wiki.qemu.org/Features/DiskIOLimits

1.) Why we need per-drive disk I/O limits
As you've known, for linux, cgroup blkio-controller has supported I/O throttling on block devices. More importantly, there is no single mechanism for disk I/O throttling across all underlying storage types (image file, LVM, NFS, Ceph) and for some types there is no way to throttle at all.

Disk I/O limits feature introduces QEMU block layer I/O limits together with command-line and QMP interfaces for configuring limits. This allows I/O limits to be imposed across all underlying storage types using a single interface.

2.) How disk I/O limits will be implemented
QEMU block layer will introduce a per-drive disk I/O request queue for those disks whose "disk I/O limits" feature is enabled. It can control disk I/O limits individually for each disk when multiple disks are attached to a VM, and enable use cases like unlimited local disk access but shared storage access with limits. In mutliple I/O threads scenario, when an application in a VM issues a block I/O request, this request will be intercepted by QEMU block layer, then it will calculate disk runtime I/O rate and determine if it has go beyond its limits. If yes, this I/O request will enqueue to that introduced queue; otherwise it will be serviced.

Quoted 7 lines
Quoted 3 lines

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk. The feature will also provide users with the ability to change per-drive disk I/O limits at runtime using QMP commands.

I'm wondering if you've considered adding a 'burst' parameter - something which will not limit (or limit less) the io ops or the throughput for the first 'x' ms in a given time window.

Currently no, Do you let us know what scenario it will make sense to?

Regards,

Zhiyong Wu

Quoted 10 lines
Quoted 5 lines

Regards,

Zhiyong Wu

Signature · 1 line
Sasha.
#30 lore raw
Quoted 32 lines · Zhi Yong Wu
Quoted 31 lines · Sasha Levin

Date: Thu, 02 Jun 2011 09:17:06 +0300
From: Sasha Levin <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
X-Mailer: Evolution 2.32.2

Hi,

Quoted 17 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

More detail is available here:
http://wiki.qemu.org/Features/DiskIOLimits

1.) Why we need per-drive disk I/O limits
As you've known, for linux, cgroup blkio-controller has supported I/O throttling on block devices. More importantly, there is no single mechanism for disk I/O throttling across all underlying storage types (image file, LVM, NFS, Ceph) and for some types there is no way to throttle at all.

Disk I/O limits feature introduces QEMU block layer I/O limits together with command-line and QMP interfaces for configuring limits. This allows I/O limits to be imposed across all underlying storage types using a single interface.

2.) How disk I/O limits will be implemented
QEMU block layer will introduce a per-drive disk I/O request queue for those disks whose "disk I/O limits" feature is enabled. It can control disk I/O limits individually for each disk when multiple disks are attached to a VM, and enable use cases like unlimited local disk access but shared storage access with limits. In mutliple I/O threads scenario, when an application in a VM issues a block I/O request, this request will be intercepted by QEMU block layer, then it will calculate disk runtime I/O rate and determine if it has go beyond its limits. If yes, this I/O request will enqueue to that introduced queue; otherwise it will be serviced.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk. The feature will also provide users with the ability to change per-drive disk I/O limits at runtime using QMP commands.

I'm wondering if you've considered adding a 'burst' parameter - something which will not limit (or limit less) the io ops or the throughput for the first 'x' ms in a given time window.

Currently no, Do you let us know what scenario it will make sense to?

My assumption is that most guests are not doing constant disk I/O access. Instead, the operations are usually short and happen on small scale (relatively small amount of bytes accessed).

For example: Multiple table DB lookup, serving a website, file servers.

Basically, if I need to do a DB lookup which needs 50MB of data from a disk which is limited to 10MB/s, I'd rather let it burst for 1 second and complete the lookup faster instead of having it read data for 5 seconds.

If the guest now starts running multiple lookups one after the other, thats when I would like to limit.

Quoted 13 lines

Regards,

Zhiyong Wu

Quoted 10 lines
Quoted 5 lines

Regards,

Zhiyong Wu

Signature · 1 line
Sasha.
Signature · 1 line
Sasha.
#31 lore raw
Quoted 59 lines · Sasha Levin

Date: Thu, 02 Jun 2011 10:15:02 +0300
From: Sasha Levin <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
X-Mailer: Evolution 2.32.2

Quoted 32 lines · Zhi Yong Wu
Quoted 31 lines · Sasha Levin

Date: Thu, 02 Jun 2011 09:17:06 +0300
From: Sasha Levin <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
X-Mailer: Evolution 2.32.2

Hi,

Quoted 17 lines · Zhi Yong Wu

Hello, all,

I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect.
This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing excessive disk I/O, they will hurt the performance of other VMs.

More detail is available here:
http://wiki.qemu.org/Features/DiskIOLimits

1.) Why we need per-drive disk I/O limits
As you've known, for linux, cgroup blkio-controller has supported I/O throttling on block devices. More importantly, there is no single mechanism for disk I/O throttling across all underlying storage types (image file, LVM, NFS, Ceph) and for some types there is no way to throttle at all.

Disk I/O limits feature introduces QEMU block layer I/O limits together with command-line and QMP interfaces for configuring limits. This allows I/O limits to be imposed across all underlying storage types using a single interface.

2.) How disk I/O limits will be implemented
QEMU block layer will introduce a per-drive disk I/O request queue for those disks whose "disk I/O limits" feature is enabled. It can control disk I/O limits individually for each disk when multiple disks are attached to a VM, and enable use cases like unlimited local disk access but shared storage access with limits. In mutliple I/O threads scenario, when an application in a VM issues a block I/O request, this request will be intercepted by QEMU block layer, then it will calculate disk runtime I/O rate and determine if it has go beyond its limits. If yes, this I/O request will enqueue to that introduced queue; otherwise it will be serviced.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

3.) How the users enable and play with it
QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk. The feature will also provide users with the ability to change per-drive disk I/O limits at runtime using QMP commands.

I'm wondering if you've considered adding a 'burst' parameter - something which will not limit (or limit less) the io ops or the throughput for the first 'x' ms in a given time window.

Currently no, Do you let us know what scenario it will make sense to?

My assumption is that most guests are not doing constant disk I/O access. Instead, the operations are usually short and happen on small scale (relatively small amount of bytes accessed).

For example: Multiple table DB lookup, serving a website, file servers.

Quoted 7 lines

Basically, if I need to do a DB lookup which needs 50MB of data from a disk which is limited to 10MB/s, I'd rather let it burst for 1 second and complete the lookup faster instead of having it read data for 5 seconds.

If the guest now starts running multiple lookups one after the other, thats when I would like to limit.

HI, Sasha,

If iops or bps parameters are not specified to -drive, it will not limit this disk I/O rate. Of course, QMP commands will be extended to support changing or disabling disk I/O limits at runtime. If you'd like not limit a disk I/O rate, you can use it to disabled this feature.

I don't make sure that this is the right answer for your question.

Regards,

Zhiyong Wu

Quoted 20 lines
Quoted 14 lines

Regards,

Zhiyong Wu

Quoted 10 lines
Quoted 5 lines

Regards,

Zhiyong Wu

Signature · 1 line
Sasha.
Signature · 1 line
Sasha.
#23 lore raw
In reply to Zhi Yong Wu
Quoted 24 lines · Zhi Yong Wu
Quoted 11 lines · Vivek Goyal

Date: Tue, 31 May 2011 15:55:49 -0400
From: Vivek Goyal <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
User-Agent: Mutt/1.5.21 (2010-09-15)

Quoted 8 lines

On Mon, May 30, 2011 at 01:09:23PM +0800, Zhi Yong Wu wrote:

[..]

Quoted 2 lines

    3.) How the users enable and play with it
    QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk.

How does throughput interface look like? is it bytes per second or something else?

HI, Vivek,
It will be a value based on bytes per second.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Do we have read and write variants for throughput as we have for iops.

QEMU code has two variants "rd_bytes, wr_bytes", but we maybe need to get their bytes per second.

Quoted 3 lines

if you have bytes interface(as kenrel does), then "bps_rd" and "bps_wr" might be good names too for thoughput interface.

I agree with you, and can change them as your suggestions.

Changing them this way is not going to be an improvement. While rd_bytes and wr_bytes lack the time interval specification bps_rd and bps_wr is ambiguous. Is that bits? bytes? Sure, there should be some distinction by capitalization but that does not apply since qemu arguments are all lowercase.

Thanks

Michal

#24 lore raw
Quoted 29 lines · Michal Suchanek
Quoted 28 lines · Zhi Yong Wu
Quoted 11 lines · Vivek Goyal

Date: Tue, 31 May 2011 15:55:49 -0400
From: Vivek Goyal <[email protected]>
To: Zhi Yong Wu <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [Qemu-devel] [RFC]QEMU disk I/O limits
User-Agent: Mutt/1.5.21 (2010-09-15)

Quoted 8 lines

On Mon, May 30, 2011 at 01:09:23PM +0800, Zhi Yong Wu wrote:

[..]

Quoted 2 lines

    3.) How the users enable and play with it
    QEMU -drive option will be extended so that disk I/O limits can be specified on its command line, such as -drive [iops=xxx,][throughput=xxx] or -drive [iops_rd=xxx,][iops_wr=xxx,][throughput=xxx] etc. When this argument is specified, it means that "disk I/O limits" feature is enabled for this drive disk.

How does throughput interface look like? is it bytes per second or something else?

HI, Vivek,
It will be a value based on bytes per second.

Quoted 2 lines

Do we have read and write variants for throughput as we have for iops.

QEMU code has two variants "rd_bytes, wr_bytes", but we maybe need to get their bytes per second.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

if you have bytes interface(as kenrel does), then "bps_rd" and "bps_wr" might be good names too for thoughput interface.

I agree with you, and can change them as your suggestions.

Changing them this way is not going to be an improvement. While rd_bytes and wr_bytes lack the time interval specification bps_rd and

right, rd_bytes and wr_bytes lack.

Quoted 1 line

bps_wr is ambiguous. Is that bits? bytes? Sure, there should be some

if we implement them, they will be bytes.

Quoted 2 lines

distinction by capitalization but that does not apply since qemu arguments are all lowercase.

Michal,
maybe you misunderstand what i mean. I mean that two variables rd_bytes and wr_bytes exist in block.c file, and are not qemu arguments. But bps_rd and bps_wr wil be added as qemu arguments.

Regards,

Zhiyong Wu

Quoted 9 lines

Thanks

Michal
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Regards,

Zhi Yong Wu
#13 lore raw
In reply to Anthony Liguori
Quoted 35 lines · Anthony Liguori
Quoted 10 lines · Vivek Goyal
Quoted 2 lines · Anthony Liguori

On 05/31/2011 12:59 PM, Vivek Goyal wrote:

Ok, so we seem to be talking of two requirements.

- A consistent experience to guest
- Isolation between VMs.

Quoted 6 lines

If this qcow2 mapping/metada overhead is not significant, then we don't have to worry about IOPs perceived by guest. It will be more or less same. If it is significant then we provide more consistent experience to guest but then weaken the isolation between guest and might overload the backend storage and in turn might not get the expected IOPS for the guest anyway.

That's quite a bit of hand waving considering your following argument is that you can't be precise enough at the QEMU level.

Quoted 5 lines

So I think these two things are not independent.

I agree though that advantage of qemu is that everything is a file and handling all the complex configuraitons becomes very easy.

Quoted 8 lines

Having said that, to provide a consistent experience to guest, you also need to know where IO from guest is going and whether underlying storage system can support that kind of IO or not.

IO limits are of not much use if if these are put in isolation without knowing where IO is going and how many VMs are doing IO to it. Otherwise there are no gurantees/estimates on minimum bandwidth for guests hence there is no consistent experience.

Quoted 5 lines

Consistent and maximum are two very different things.

QEMU can, very effectively, enforce a maximum I/O rate.  This can then be used to provide mostly consistent performance across different generations of hardware, to implement service levels in a tiered offering, etc.

What is the point of view, guest or host? It is not possible to enforce any rates which would make sense to guests without taking into account guest clock and execution speed.

If instead you mean host rate (which would not be in sync with I/O rates seen by guest), then I'd suppose metadata accesses would also matter and then the host facilities should produce same results. On a positive side, they may only exist on newer Linux and not on other OS so introducing them to QEMU would not be so bad idea.

Quoted 23 lines

The level of consistency will then depend on whether you overcommit your hardware and how you have it configured.

Consistency is very hard because at the end of the day, you still have shared resources.  Even with blkio, I presume one guest can still impact another guest by forcing the disk to do excessive seeking or something of that nature.

So absolutely consistency can't be the requirement for the use-case. The use-cases we are interested really are more about providing caps than anything else.

Regards,

Anthony Liguori

Quoted 4 lines

Thanks
Vivek