On August 13, 2025 3:46 pm, Alexandre Derumier via pve-devel wrote:
>Currently, the qcow2 maximum cache-size is 32MB, enough to handle metadatas
>for a 256GB images with 65k cluster size.
>
>if cache-size is not big enough, performance are really bad
>
>This patch increase cache to 1GB, enough to handle 8TB image
>
>with default 32MB cache
>fio benchmark 4k randread/write:
>
>256GB image : 32MB cache : 40000 iops
>1TB image: 32MB cache: 2500 iops
>8TB image: 32MB cache: 2500 iops
>1TB image: 1G cache: 40000 iops
>8TB image: 1G cache: 40000 iops
>
>the cache-size value is a maximum value, memory is not reserved at vm start.
>Also, the metadatas not used are removed from the cache after 10min by defa=
>ult.
>
>https://gitlab.com/qemu-project/qemu/-/blob/master/docs/qcow2-cache.txt
>Signed-off-by: Alexandre Derumier <alexandre.derum...@groupe-cyllene.com>
>---
> src/PVE/QemuServer/Blockdev.pm                              | 3 +++
> src/test/cfg2cmd/bootorder-empty.conf.cmd                   | 6 +++---
> src/test/cfg2cmd/bootorder-legacy.conf.cmd                  | 6 +++---
> src/test/cfg2cmd/bootorder.conf.cmd                         | 6 +++---
> .../cfg2cmd/cputype-icelake-client-deprecation.conf.cmd     | 2 +-
> src/test/cfg2cmd/ide.conf.cmd                               | 2 +-
> src/test/cfg2cmd/q35-ide.conf.cmd                           | 2 +-
> src/test/cfg2cmd/q35-linux-hostpci-mapping.conf.cmd         | 2 +-
> src/test/cfg2cmd/q35-linux-hostpci-multifunction.conf.cmd   | 2 +-
> src/test/cfg2cmd/q35-linux-hostpci-template.conf.cmd        | 2 +-
> src/test/cfg2cmd/q35-linux-hostpci-x-pci-overrides.conf.cmd | 2 +-
> src/test/cfg2cmd/q35-linux-hostpci.conf.cmd                 | 2 +-
> src/test/cfg2cmd/q35-simple.conf.cmd                        | 2 +-
> src/test/cfg2cmd/seabios_serial.conf.cmd                    | 2 +-
> src/test/cfg2cmd/simple-backingchain.conf.cmd               | 4 ++--
> src/test/cfg2cmd/simple-virtio-blk.conf.cmd                 | 2 +-
> src/test/cfg2cmd/simple1-template.conf.cmd                  | 4 ++--
> src/test/cfg2cmd/simple1.conf.cmd                           | 2 +-
> src/test/run_qemu_img_convert_tests.pl                      | 6 +++---
> 19 files changed, 31 insertions(+), 28 deletions(-)
>
>diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev.pm
>index f5798cbf..895f1a6a 100644
>--- a/src/PVE/QemuServer/Blockdev.pm
>+++ b/src/PVE/QemuServer/Blockdev.pm
>@@ -381,6 +381,9 @@ my sub generate_format_blockdev {
>         $blockdev->{'discard-no-unref'} =3D JSON::true if $format eq 'qcow=
>2';
>     }
>=20
>+    #increase qcow2 maximum cache size to 1GB memory, enough to handle 8TB=
> disk image with 64k clusters.
>+    $blockdev->{'cache-size'} =3D 1073741824 if $format eq 'qcow2';
>+
>     return $blockdev;
> }

have you benchmarked this? if so, did you compare it with using the
smaller cache-entry variant described in the file you linked:

https://gitlab.com/qemu-project/qemu/-/blob/master/docs/qcow2-cache.txt#L159

we also know the image size here, so we could use a capped, derived value?

what if the disk is resized? what about image files with bigger
clusters?


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to