[libvirt-users] Why are virsh vol-upload/vol-download so slow?

Daniel P. Berrange berrange at redhat.com
Fri Mar 4 16:57:30 UTC 2016


On Fri, Mar 04, 2016 at 11:14:44AM -0500, Lars Kellogg-Stedman wrote:
> I was interested in using 'virsh vol-upload' and 'virsh vol-download',
> rather than mucking about directly with the filesystem.  But while
> simply copying the image is relatively quick:
> 
>   # ls -l /var/lib/libvirt/images/centos-7-cloud.qcow2
>   -rw-r--r--. 1 qemu qemu 1004994560 Apr 15  2015 centos-7-cloud.qcow2
>   # time cp /var/lib/libvirt/images/centos-7-cloud.qcow2 /tmp/myimage.qcow2
>   real	0m10.829s
>   user	0m0.024s
>   sys	0m1.668s
> 
> Trying to do the same thing with `virsh vol-download` is glacial:
> 
>   # time virsh vol-download --pool default centos-7-cloud.qcow2 /tmp/myimage.qcow2
> 
> I killed it after 10 minutes:
> 
>   real	10m20.775s
>   user	10m19.451s
>   sys	0m1.887s
> 
> After which is was about halfway through:
> 
>   # ls -l /tmp/myimage.qcow2
>   -rw-r--r--. 1 root root 564920248 Mar  4 11:11 /tmp/myimage.qcow2
> 
> What is up with that?

What version of libvirt ?  We had an unfortunate implementation mistake
which caused us to waste tonnes of time in memmove(). versions since
1.2.19 have a fix that addresses it

commit d9c9e138f22c48626f719f880920e04c639e0177
Author: Ossi Herrala <oherrala at gmail.com>
Date:   Mon Jul 20 12:44:32 2015 +0000

    rpc: Fix slow volume download (virsh vol-download)
    
    Use I/O vector (iovec) instead of one huge memory buffer as suggested
    in https://bugzilla.redhat.com/show_bug.cgi?id=1026137#c7. This avoids
    doing memmove() to big buffers and performance doesn't degrade if
    source (virNetClientStreamQueuePacket()) is faster than sink
    (virNetClientStreamRecvPacket()).
    
    Resolves: http://bugzilla.redhat.com/1026137
    
    Signed-off-by: Martin Kletzander <mkletzan at redhat.com>

Regards,
Daniel
-- 
|: 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 :|




More information about the libvirt-users mailing list