How to adjust the qcow2 cluster size of existing images to drastically improve I/O performance?

bytesonend

New Member
Oct 31, 2020
12
0
1
Hi

I've just read this interesting blog article on jrs-s.net (he have a lot of great articles on ZFS by the way) on the topic of qcow2 vs zvol I/O performance.

The interesting part was that fine-tuning the qcow2 cluster_size to match the record size ot the underlying zfs dataset could drastically improve the I/O performance of qcow2 images (3x the performance of zvol in some scenarios).

So my question is simple: Is there a way to adjust the cluster_size of an existing qcow2 image? and if yes, how?

Thanks in advance!
 
the only way is probabl to 'pre create' the qcow2 images with 'qemu-img' in the correct location, e.g. /var/lib/vz/images/VMID/vm-VMID-disk-X.qcow2
with the correct parameters

note though that the default recordsize is 128k (the article has set 8k)

also the article seems a little suspect, or at least thin on information
IMHO, having a cow file on a cow filesystem should not be faster than using a cow block device directly....

what he did not mention at all is cache modes of the block devices, and maybe there is some factor he forgot (though i admit i did not try to recreate the benchmarks)

in any way, i would benchmark myself before i'd apply such optmizations
for starters, check our storage benchmark wiki (contains useful fio commands)
https://pve.proxmox.com/wiki/Benchmarking_Storage
 
note though that the default recordsize is 128k (the article has set 8k)
Hi to all,

The author did not (Jim Salter is a old zfs guru in my opinion) say this. He said he want to align the qcow2 block size with his pool (8k/ssd).

The big difference zvol versus qcow2 as Jim try to prove could be (maybe) the fact that any file disk like qcow2 it will benefit from the kernel cache system, and zvol will not...!


Good luck / Bafta !
 
The author did not (Jim Salter is a old zfs guru in my opinion) say this. He said he want to align the qcow2 block size with his pool (8k/ssd).
yes he did set the recordsize to 8k?

quote from the article:
ZFS parameters: ashift=13,recordsize=8K,atime=off,compression=lz4

The big difference zvol versus qcow2 as Jim try to prove could be (maybe) the fact that any file disk like qcow2 it will benefit from the kernel cache system, and zvol will not...!
while i do not want to discredit the author of the article, it does not mention the word 'cache' once, so to interpret it it this way is rather speculation in my opinion...

also the article is over three years at this point, with many changes in the kernel and zfs itself, so i'd be cautious in trusting the values at this point in time
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!