
On Sat 18 Mar 2017 10:54:16 AM CET, Daniel P. Berrange wrote:
If you don't care about that at all, the optimal configuration in terms of performance is to give qemu a cache large enough that the metadata of the whole image fits in it. When setting cache-clean-interval, this could actually be reasonable even for large images because the memory wouldn't be used forever but just as long as the guest is submitting the problematic I/O patterns - but it still means that temporarily qemu could really use all of this memory.
Is there some easy algorithm that libvirt can use to determine the size of the L2 tables, and thus report what the maximum useful cache size would be ?
Yes, the disk size that can be covered with a certain L2 cache is: disk_size = l2_cache_size * cluster_size / 8 (all sizes in bytes) Note that increasing the L2 cache size also increases the refcount cache, which you might want to keep small. It's all explained in detail here: https://github.com/qemu/qemu/blob/master/docs/qcow2-cache.txt https://blogs.igalia.com/berto/2015/12/17/improving-disk-io-performance-in-q... Berto