KVM I/O slowness on RHEL 6

Written by Gionatan Danti on . Posted in Virtualization

User Rating:  / 106
PoorBest 

I/O slowness cause: bad default settings

So, we can state that to obtain good I/O throughput from the QCOW2 format, two conditions must be met:

  • don't use a write-through cache

  • always use metadata preallocation.

However, using the virt-manager GUI interface that is normally used to create virtual disks and guest systems on Red Hat and Fedora, you can not enable metadata preallocation on QCOW2 files. While the storage volume creation interface let you specify if you want to preallocate the virtual disk, this function actually only works with RAW files; if you use a QCOW2 file it does nothing.

To create a file with metadata preallocation, you must open a terminal and issue the “qemu-img create” command. For example, if you want to create a ~10 GB QCOW2 with metadata preallocation, you must issue the command “qemu-img create -f qcow2 -o size=10000000000,preallocation=metadata file.img”.

Moreover, the default caching scheme is the write-through one. While generally the guest creation wizard correctly disable host-side cache, if you later add any virtual disk to the guest, often the disk is added with the “default” caching policy – a write-through one.

So, if you are using Red Hat Enterprise Linux or Fedora Linux as the host operating system for you virtualization server and you plan to use the QCOW2 format, remember to manually create preallocated virtual disk files and to use a “none” cache policy (you can also use a “write-back” policy, but be warned that your guests will be more prone to data loss).

Comments   

 
#1 lawrence 2012-04-27 00:05
very helpful.

thanks.
 
 
#2 Josh 2012-05-10 15:37
This is a GREAT article. However... splitting it up into 8 pages makes it more annoying to use. I would understand doing this, if you had advertising on each page and wanted to derive advertising revenue. But as it stands I've copied all 8 pages into an OpenOffice document so I can turn it into a PDF and file it with the rest of my "useful blog posts".
 
 
#3 Gionatan Danti 2012-05-10 17:01
Quoting Josh:
This is a GREAT article. However... splitting it up into 8 pages makes it more annoying to use. I would understand doing this, if you had advertising on each page and wanted to derive advertising revenue. But as it stands I've copied all 8 pages into an OpenOffice document so I can turn it into a PDF and file it with the rest of my "useful blog posts".


Hi Josh, you are right: while a single page view would be desiderable, the only manner to cover domain's costs is through advertising.

Feel free to store a your personal copy of the article in whatever format you want.

Regads.
 
 
#4 Morrizor 2012-05-16 18:46
Thanks Gionatan, very useful!
 
 
#5 Arturs 2012-06-03 20:36
Hy, it very helpful!
I tried myself with default server is centos 5.8 x86_64 is installing for long long time, formating image is very long!

But when i tried cache none on full(full size already allocated) image, its running perfect
 
 
#6 Siauhoo 2012-10-06 09:58
It seem that raw images doesn't support preallocation. if so why there is raw + preallocation in this chart ?
 
 
#7 hakl 2013-12-08 14:51
And where was the big tip which you told on first page?
 
 
#8 Gionatan Danti 2013-12-16 17:56
Quoting hakl:
And where was the big tip which you told on first page?


Hi, the tip was to preallocate the QCOW2 backing file (as explained in the article) and to _not_ use the writethrough cache setting.

However, newer KVM/Qemu version (starting with those found in CentOS 6.1) greatly improved the usability of non-preallocate d QCOW2 files.

So, if you take the route to go with QCOW2 and you need thin provision, you can avoid to preallocate the backing file. However, remember to avoid the writethough cache.

Regards.
 

You have no rights to post comments