[CentOS-virt] CentOS 6 kvm disk write performance

Sat Aug 11 13:26:58 UTC 2012
Julian price <centos.org at julianprice.org.uk>

> On 10.08.2012 13:46, Julian price wrote:
>   
>> I have 2 similar servers. Since upgrading one from CentOS 5.5 to 6,
>> disk write performance in kvm guest VMs is much worse.
>> ...
>> Is this a known problem?  If so, what's the cause?    If not, is
>> there a way to locate the problem rather than using trial and error?
>>
>> Thanks,
>> Julian
>>     
Nux! wrote:
> How are you running KVM machines? Through libvirt?

Not through libvirt, but using the qemu-kvm command.  This is the full command-line (without libvirt):

/usr/libexec/qemu-kvm -k en-gb -m 4096 -smp 2 -pidfile 
/media/archive/vm022/.vm022.pid -monitor 
unix:/media/archive/vm022/.vm022.monitor,server,nowait -usb -usbdevice 
tablet -net nic,macaddr=02:00:01:00:24:02 -net 
tap,script=/etc/incharge/qemu-ifup -vnc :2 -drive 
file=/media/vm022/hda.raw,index=0,media=disk -drive 
file=/media/archive/vm022/hdb.raw,index=1,media=disk -drive 
file=/media/archive/vm022/hdc.raw,index=2,media=disk

 > Have you made any changes to the cgroups?

No, I never heard of cgroups until today!

 > What are you using as disks, raw files, lvm

There are 2 physical disks in raid 1 configuration
Apart from system and swap partitions, the majority of the disk is LVM
Each VM has 3 virtual disk files. 1 system disk (hda), one temp disk 
(hdb) and one spare (hdc). All are raw format.
The hda for each VM is stored in its own LVM volume, so a snapshot can 
be made and mirrored with minimal overhead.
So the volume /media/vm022 contains one file (hda.raw) and one folder 
which is used by a monitoring task to check the volume hasn't gone 
read-only.
hdb, hdc and the monitor & pid files are stored on a larger LVM volume 
/media/archive
There was no LVM snapshot while any of the test timings were made.

As there are so few files on /media/vm022, the reserved space is reduced 
using
tune2fs -r 73134 /dev/mapper/vm-ic022
...so the 32GB file fits into a 33GB LVM volume.
(See https://www.centos.org/modules/newbb/viewtopic.php?topic_id=30854)

All the above is identical on both the CentOS 5 and CentOS 6 servers, 
except that ext3 is used on the CentOS 5 host and ext4 on the CentOS 6 
host, and the disk & raid hardware is a different brand.
In all cases, the guest VM is CentOS 6.2 and uses ext4.