In my quest to move to a virtualized environment, I started giving Xen a try. As many documents state, using LVM-based VMs instead of disk image based VMs result in much better IO speed, as well as being less disk intensive. However, I couldn’t find any actual performance data on it. I decided to spin up two new Debian 6 based Virtual Machines and run two simple dd tests to get a quick idea of what kind of performance difference we would see.
The two dd commands chosen were:
dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync
dd bs=8k count=256k if=/dev/zero of=test conv=fdatasync
Here are the results from the first host, running a Disk Image based VM:
root@xenguest1:~# dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 9.57446 s, 56.1 MB/s
root@xenguest1:~# dd bs=8k count=256k if=/dev/zero of=test conv=fdatasync
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 37.0974 s, 57.9 MB/s
Here are the results from the second host, running a LVM based VM:
root@xenguest4:~# dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 5.10286 s, 105 MB/s
root@xenguest4:~# dd bs=8k count=256k if=/dev/zero of=test conv=fdatasync
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 19.6078 s, 110 MB/s
As you can see from the results above, there is a huge difference. Using LVM over Disk Images resulted in an improvement of almost double in these scenarios. While these tests simply result in a large sequential write to the disk, I think it’s pretty clear cut that LVM is the winner here. Make sure you’re using LVM and not disk based images when making Xen virtual machines!
http://schollenberger.com/performance-comparison-disk-images-vs-lvm-in-a-xen-environment/