[libvirt] PATCH: Disable QEMU drive caching

Anthony Liguori anthony at codemonkey.ws
Wed Oct 8 16:49:19 UTC 2008

Daniel P. Berrange wrote:
> On Wed, Oct 08, 2008 at 11:06:27AM -0500, Anthony Liguori wrote:
> Sorry, it was mistakenly private - fixed now. 
> Xen does use O_DIRECT for paravirt driver case  - blktap is using the combo

You have to use O_DIRECT with linux-aio.  And blktap is well known to 
have terrible performance.  Most serious users use blkback/blkfront and 
blkback does not avoid the host page cache.  It maintains data integrity 
by passing through barriers from the guest to the host.  You can 
approximate this in userspace by using fdatasync.

The issue the bug addresses, iozone performs better than native, can be 
addressed in the following way:

1) For IDE, you have to disable write-caching in the guest.  This should 
force an fdatasync in the host.
2) For virtio-blk, we need to implement barrier support.  This is what 
blkfront/blkback do.
3) For SCSI, we should support ordered queuing which would result in an 
fdatasync when barriers are injected.

This would result in write performance being what was expected in the 
guest while still letting the host coalesce IO requests, perform 
scheduling with other guests (while respecting each guest's own ordering 


Anthony LIguori

>  QEMU code is only used for the IDE emulation case which 
> isn't interesting from a performance POV.
> Daniel

More information about the libvir-list mailing list