[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] QEMU interfaces for image streaming and post-copy block
Re: [Qemu-devel] QEMU interfaces for image streaming and post-copy block migration
Tue, 07 Sep 2010 10:00:44 -0500
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:18.104.22.168) Gecko/20100713 Lightning/1.0b1 Thunderbird/3.0.6
On 09/07/2010 09:55 AM, Stefan Hajnoczi wrote:
On Tue, Sep 7, 2010 at 3:51 PM, Anthony Liguori
On 09/07/2010 09:33 AM, Stefan Hajnoczi wrote:
On Tue, Sep 7, 2010 at 2:41 PM, Anthony Liguori
The interface for copy-on-read is just an option within qemu-img create.
Streaming, on the other hand, requires a bit more thought. Today, I
monitor command that does the following:
stream<device> <sector offset>
Which will try to stream the minimal amount of data for a single I/O
operation and then return how many sectors were successfully streamed.
The idea about how to drive this interface is a loop like:
offset = 0;
while offset< image_size:
count = stream(device, offset)
offset += count
Obviously, the "wait_for_idle_time()" requires wide system awareness.
thing I'm not sure about is 1) would libvirt want to expose a similar
interface and let management software determine idle time 2) attempt to
detect idle time on it's own and provide a higher level interface. If
the question then becomes whether we should try to do this within qemu
provide libvirt a higher level interface.
A self-tuning solution is attractive because it reduces the need for
other components (management stack) or the user to get involved. In
this case self-tuning should be possible. We need to detect periods
of I/O inactivity, for example tracking the number of in-flight
requests and then setting a grace timer when it reaches zero. When
the grace timer expires, we start streaming until the guest initiates
That detects idle I/O within a single QEMU guest, but you might have another
guest running that's I/O bound which means that from an overall system
throughput perspective, you really don't want to stream.
I think libvirt might be able to do a better job here by looking at overall
system I/O usage. But I'm not sure hence this RFC :-)
Isn't this what block I/O controller cgroups is meant to solve? If
you give vm-1 50% block bandwidth and vm-2 50% block bandwidth then
vm-1 can do streaming without eating into vm-2's guaranteed bandwidth.
That assumes you're capping I/O. But sometimes you care about overall
system throughput more than you care about any individual VM.
Another way to look at it may be, a user waits for a cron job that runs
at midnight and starts streaming as necessary. However, the user wants
to be able to interrupt the streaming should there been a sudden demand.
If the user drives the streaming through an interface like I've
specified, they're in full control. It's pretty simple to build a
interfaces on top of this that implement stream as an aggressive or
conservative background task too.
Also, I'm not sure we should worry about the priority of the I/O too
much: perhaps the user wants their vm to stream more than they want an
unimportant local vm that is currently I/O bound to have all resources
to itself. So I think it makes sense to defer this and not try for
system-wide knowledge inside a QEMU process.
Right, so that argues for an incremental interface like I started with :-)
BTW, this whole discussion is also relevant for other background tasks
like online defragmentation so keep that use-case in mind too.
Re: [Qemu-devel] QEMU interfaces for image streaming and post-copy block migration, Kevin Wolf, 2010/09/07