On Tue, Aug 29, 2023 at 05:49:24PM -0000, Daniel Alley wrote:
> > The background to this is I've spent far too long trying to optimize
> > the conversion of qcow2 files to raw files.  Most existing qcow2 files
> > that you can find online are zlib compressed, including the qcow2
> > images provided by Fedora.  Each cluster in the file is separately
> > compressed as a zlib stream, and qemu uses zlib library functions to
> > decompress them.  When downloading and decompressing these files, I
> > measured 40%+ of the total CPU time is doing zlib decompression.
> > 
> > [You don't need to tell me how great Zstd is, qcow2 supports this for
> > compression also, but it is not widely used by existing content.]
>
> Independent from the decision to use zlib-ng as a distro-wide zlib
> replacement, which is a good idea regardless.
>
> Are there reasons why Fedora's qcow2 images cannot switch to Zstd
> compression?  Zstd support appears to have been added by QEMU 5.1 in
> August 2020, and both EL8 and EL9 appear to have newer versions QEMU
> available (therefore, they ought to be able to support those
> images).

TBH I think the most probable reason is that people don't know about
it and it is not obvious that you have to enable it.  To generate a
zlib-compressed qcow2 file, you simply add the -c option, easy.  To
use zstd compression you have to use this mouthful:

  qemu-img convert -f raw disk.img -O qcow2 disk.qcow2 -c -o 
compression_type=zstd

The qemu-img man page doesn't even mention it.

I think all recent qcow2-based tools should be fine with zstd, but I
didn't check them all (RHEL 7 is still quite popular so that platform
would no longer be compatible).

> Sure, it doesn't help for existing content, but it would help for
> future content.  And I'm pretty sure zstd remains faster than
> zlib-ng despite the speed improvements in the latter.

Yup.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to