LVM thin provisioning and virt-manager

Richard W.M. Jones rjones at redhat.com
Wed Oct 16 09:25:30 UTC 2013


On Tue, Oct 15, 2013 at 09:13:35PM -0600, Chris Murphy wrote:
> 
> On Oct 15, 2013, at 4:29 PM, Richard W.M. Jones <rjones at redhat.com> wrote:
> 
> > On Tue, Oct 15, 2013 at 04:04:28PM -0600, Chris Murphy wrote:
> >> I'm happy to hear it argued I should instead use the LV space for a
> >> regular partition formatted ext2 and drop the qcow2 file
> >> there. There's still overhead of two file systems there, but may
> >> compare to LV performance.
> > 
> > I guess you'll have to try that and see how it works out.
> > 
> > However don't use ext2.  Use ext4 which supports extents and hence
> > will have much lower metadata over for big files like disk images.
> 
> Fair point. The system I have, has a disk with both XFS formatted partition (no LVM) and LVM space on it.
> 
> Fedora 20 default BTRFS guided install to an LV takes 51 minutes. Firstboot systemd-analyze:
> 878ms (kernel) + 2.755s (initrd) + 24.796s (userspace) = 28.429s
> 
> The same install parameters to qcow2 on XFS takes 1h42m. Firstboot systemd-analyze:
> 876ms (kernel) + 3.065s (initrd) + 31.858s (userspace) = 35.799s
> 

> Boot difference is negligible, but the installation time difference
> is quite large, so it looks like write performance is where the
> penalty is. I'd be surprised if there's a significant difference
> with qcow2 on ext4.

You could try using one or more of these qcow2 options:

  compat=1.1
  preallocation=metadata
  lazy_refcounts=on

eg:

  qemu-img create -f qcow2 -b backing -o preallocation=metadata,compat=1.1 snapshot

I would guess that if any of them makes a difference at all it would
be preallocation=metadata, but you'd have to measure it.

Also what is your caching mode?  If these are throwaway images only
used for testing (ie. you don't care if the machine crashes and you
lose all the data in the test image) then setting cache=unsafe[1]
should make a big difference (for both LVM & qcow2).  I measured a 25%
increase in performance on one test.

Rich.

[1] http://libvirt.org/formatdomain.html#elementsDisks
      <driver name='qemu' cache='unsafe' />

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org


More information about the devel mailing list