[libvirt-users] How to set QEMU qcow2 l2-cache-size using libvirt xml?

Martin Kletzander mkletzan at redhat.com
Tue Sep 20 12:45:14 UTC 2016


On Mon, Sep 19, 2016 at 11:32:26AM -0400, Frank Myhr wrote:
>QEMU's default qcow2 L2 cache size is too small for large images (and small cluster sizes), resulting in very bad performance.
>
>https://blogs.igalia.com/berto/2015/12/17/improving-disk-io-performance-in-qemu-2-5-with-the-qcow2-l2-cache/
>shows huge performance hit for a 20GB qcow2 with default 64kB cluster size:
>
>L2 Cache, MiB   Average IOPS
>1 (default)             5100
>1.5                     7300
>2                      12700
>2.5                    63600
>
>The above link also gives the formula:
>optimal L2 cache size = L2 table size = (8 Byte) * (disk size) / (cluster size)
>
>and the QEMU command line for setting L2 cache size, which is not persistent, but must be specified at each invocation:
>qemu-system-x86_64 -drive file=hd.qcow2,l2-cache-size=2621440
>
>I'd like to set the l2-cache-size in libvirt xml, but cannot make out how to do it.
>There are only hints in the comments at the above link and at
>http://wiki.libvirt.org/page/QEMUSwitchToLibvirt
>
>and an earlier unanswered question on this list
>https://www.redhat.com/archives/libvirt-users/2016-February/msg00036.html
>
>Has anyone successfully done this, and could you please give an example of the actual libvirt xml used?
>

If you don't see it in the docs [1] it's not supported.  It would be
trivial to add that option, though.  Patches are welcome ;) If you don't
feel like it, you can always file an upstream bugzilla request [2].

Martin

[1] https://libvirt.org/formatdomain.html
[2] https://bugzilla.redhat.com/enter_bug.cgi?product=Virtualization%20Tools&component=libvirt

>Thanks!
>Frank
>
>_______________________________________________
>libvirt-users mailing list
>libvirt-users at redhat.com
>https://www.redhat.com/mailman/listinfo/libvirt-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20160920/2fa4ded1/attachment.sig>


More information about the libvirt-users mailing list