Features/KVM qcow2 Performance

From FedoraProject

< Features
Revision as of 16:58, 5 August 2009 by Markmc (Talk | contribs)

Jump to: navigation, search

Contents

KVM qcow2 Performance

Summary

Improve the I/O performance of virtual machines using disk images in the qcow2 image format.

Owner

Current status

  • Targeted release: Fedora 12
  • Last updated: 2009-08-05
  • Percentage of completion: 100%

In upstream qemu, qcow2 achieves a reasonable performance now, so the main goal is already met. There are only a few optimizations left that are harder to do. The qcow2 code still needs more testing as it is known to have been broken in subtle ways by past changes. Some more benchmarking is needed to measure more exactly what has been achieved.

To illustrate what dimension the improvements are, here the installation time for a minimal RHEL 5.3 VM with old and new qcow2, and for comparison raw images. The installation was done with all three different cache settings.

cache = off writethrough writeback
Old qcow2 (0.10.5) 16:52 min 28:58 min 6:02 min
New qcow2 (0.11.0-rc1) 5:44 min 9:18 min 6:11 min
raw 5:41 min 7:24 min 6:03 min

Detailed Description

qcow2 is the native disk image file format of qemu. It provides a couple of additional features over raw images, including base images, snapshots, compression and encryption. Also, qcow2 files grow as needed whereas raw files need to be created in the full size of the virtual disk.

Currently, qcow2 is very slow with disabled write cache on the host. Therefore users need to decide if they enable the write cache and run the risk of data loss (e.g. on a host crash, the guest thinks the data is written to disk and safe while it was sitting in the host cache and is lost - resulting in image or file system corruption) or to do without the qcow2 features and go for raw images.

The goal is to improve the performance of qcow2, so users don't risk their data, can take advantage from the additional features provided by qcow2 and still have acceptable performance.

Benefit to Fedora

See previous section. We can recommend a more advanced image format than raw to our users.

Scope

This feature needs work on qemu. A lot of changes are already made in upstream qemu and just need to be taken from there.

How To Test

Even though the major goal is to improve performance, it is easy to break the image format driver in subtle ways while doing so. Testing must have a focus on correctness first. A good way to test correctness is the qemu-iotests test suite which can be found on http://git.kernel.org/?p=linux/kernel/git/hch/qemu-iotests.git.

Apart from correctness, testing should involve performance comparison between qcow2 and raw (possibly also old qcow2) in benchmarks, installation or other scenarios. Be sure to differentiate between an empty image which is growing during the test and an already used image with lots of rewrites. The greatest performance improvement is to be expected in the growing case. Best start off with new images before each test run to maintain comparability.

User Experience

qcow2 users should notice no change in functionality, but an improvement in their disk I/O performance. Users who have previously enabled the write cache for performance reasons may consider to turn caching off to improve data safety. Users who didn't use qcow2 because of the poor performance may consider to switch and take advantage of the additional features.

Dependencies

None.

Contingency Plan

None. We would take the improvements already available and reconsider if we can recommend using qcow2 to everyone. The raw image format is retained and can still be used when performance is important.

Documentation

Release Notes

The performance of qcow2 disk images has improved a lot when disabling the cache for data safety. Users who have previously enabled the write cache for performance reasons may consider to turn caching off to improve data safety. Users who didn't use qcow2 because of the poor performance may consider to switch and take advantage of the additional features the format provides over raw disk images.

Comments and Discussion