Frank Myhr
2016-Sep-19 15:32 UTC
[libvirt-users] How to set QEMU qcow2 l2-cache-size using libvirt xml?
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? Thanks! Frank
Martin Kletzander
2016-Sep-20 12:45 UTC
Re: [libvirt-users] How to set QEMU qcow2 l2-cache-size using libvirt xml?
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@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users
Frank Myhr
2016-Sep-20 13:48 UTC
Re: [libvirt-users] How to set QEMU qcow2 l2-cache-size using libvirt xml?
Martin, Thank you for your quick answer. I've opened a bug as you suggested: https://bugzilla.redhat.com/show_bug.cgi?id=1377735 I'm unable to contribute a patch at the moment, but may in the future. Thanks, Frank