Qcow2 L2/refcount cache configuration


Today we had an interesting conversation about the L2/refcount cache in qemu. If not configured properly, it has a noticeable impact on performances when the disk is bigger than 8GB, which is all the disks used in the upcoming libvirt infrastructure driver.

It appears this problem was fixed in version 3.1 and above and since Debian GNU/Linux buster has version 3.1, it should not be a concern for Enough. If it still was a problem, there would be a need to tweak the libvirt XML definition of the domain created by virt-install because it does not accept the l2_cache_size option, even in the most recent codebase:

$ virt-install --connect qemu:///system --boot hd --name deb3 --memory 1024 --vcpus 1 --cpu host --disk path=/var/lib/libvirt/images/enough/debian-10.qcow2,bus=virtio,l2-cache-size=4194304,refcount-cache-size=262144,format=qcow2 --os-type=linux --os-variant=debian10 --graphics vnc --noautoconsole
ERROR    Unknown --disk options: ['l2-cache-size', 'refcount-cache-size']

I read the comment too quickly and it’s no good for images size greater than 8GB. A relevant blog post is an interesting read. And the easiest workaround is to use raw images instead of qcow2 when more than 8GB is required.