Thursday, November 8, 2012

qemu lvm2 vs qcow2 benchmark

Playing around with virtual guests always takes quite some time when creating or copying images. Recently i've started looking for a good solution how to store virtual guests. I always vacillate between lvm2 partitions and qcow2 files. Both have their pros and cons. LVM2 is fast and you have the ability for live snapshots while qcow2 files are easy to maintain and and need less space.
Some time ago i already  started an benchmark where i compared the different cache settings on different filesystems + lvm. The result was the there wasn't a big gap between those filesystems and lvm2, though comparing build times isn't a real benchmark.
VM Details

Now i made another benchmark. This time i choose to use the phoronix-test-suite benchmark tool to see what's the difference between qcow2 on btrfs and lvm2. PTS has many good present for testing and i just used an default disk benchmark present. The vm was an typical minimal gentoo amd64 system where i also didn't had X or anything else running, so the result should be quite accurate. I choose to test it with btrfs because it also has an snapshoting feature which might be an alternative to lvm2 one day.

Converting an lvm2 image to qcow2 is pretty simple and is done via:
 qemu-img convert -O qcow2 /dev/vg/g64 /mnt/vms/g64.qcow2  

Below are the result. I was quite surprised because i though using lvm2 has an greater impact on performance. However, as you can see, at a few benchmarks qcow2 were even faster than lvm2.

green = lvm2red = qcow2

For me the biggest drawback of qcow2 and other file formats right now is the lack of an snapshot feature which i could use for creating live backups while the system is running. Even though qemu has an snapshot feature, this one isn't working for me.
I might have an deeper look into qemu's snapshot feature in the future, but for now i'll stay with lvm2. Disk space isn't a real problem and other than that i don't want to rewrite my backup scripts (again).

No comments:

Post a Comment