Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use KVM to manage my virtual machines. I am trying to limit the resources provided for VMs. I am able to limit the CPU and memory allocated for VMs using libvirt/cgroups. Now I want to control the disk time allotted for each VM by applying some weights. I looked at blkio control from cgroups. Since VM is just a Linux process, I will be able to use cgroups but I am not sure whether it will work for asynchronous IO too. If not, can someone suggest a good alternative solution?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

Blkio in cgroup terminology stands for access to I/O on block devices. It does not seem to be about regulating all the different ways software developers have at hand for I/O-related purposes.

It seems to be targeted mainly to I/O on devices, not on the way software has access to devices. It can limit the number of iops, the bandwidth or a weight with other processes, in other things. It seems that buffered write is not supported by blockio at the moment. It's in the official documentation:

Currently, the Block I/O subsystem does not work for buffered write operations. It is primarily targeted at direct I/O, although it works for buffered read operations.

If you take a look at this presentation from Linda Wang and Bob Kozdemba of Red Hat, on page 20+, you'll see that the graph is about the device bandwidth per VM, not about random vs blocking vs asynchronous I/O.

It seems there has been recent work by Red Hat to implement it directly into virsh. It has been released last week in libvirt 0.9.9. In a few months, you'll be able to do something like this in your favorite distribution:

virsh blkiotune domA --device-weights /dev/sda,250
virsh blkiotune domB --device-weights /dev/sda,750
share|improve this answer
add comment

You may want to use ionice, it's like nice but for IO.

share|improve this answer
1  
Is ionice a better alternative than using blkio from cgroups? Does it provide something the OP's current solution does not? Do you know how it relates to asynchronous IO? –  Caleb Aug 4 '11 at 11:45
    
Caleb it will be great if you can just give a gist on what is asynchronous IO and how does it differ from synchronous IO with respect to an operating system. –  sethu Aug 5 '11 at 20:33
    
@Caleb: See above. –  Faheem Mitha Dec 9 '11 at 9:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.