qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Caching modes


From: Anthony Liguori
Subject: Re: [Qemu-devel] Caching modes
Date: Mon, 20 Sep 2010 13:51:37 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100826 Lightning/1.0b1 Thunderbird/3.0.7

On 09/20/2010 01:37 PM, Blue Swirl wrote:

It would be nice to have additional mode, like cache=always, where
even flushes MAY be ignored. This would max out the performance.

That's cache=unsafe and we have it. I ignored it for the purposes of this discussion.

Guest disk cache.

For all devices that support it, the exposed cache attribute should be
independent of the host caching mode.  Here are correct usages of disk
caching mode:

Writethrough disk cache; cache=none|writethrough if the disk cache is set to
writethrough or the disk is considered "enterprise class" and has a battery
backup.  cache=writeback IFF the host is backed by an UPS.
The "enterprise class" disks, battery backups and UPS devices are not
consumer equipment. Wouldn't this mean that any private QEMU user
would need to use cache=none?

No, cache=writethrough and cache=none should be equivalent from a data integrity/data loss perspective. Using cache=writeback without enterprise storage is risky but practically speaking, most consumer storage is not battery backed and uses writeback caching anyway so there is already risk.

As an example, what is the correct usage for laptop user, considering
that there is a battery, but it can also drain and the drainage is
dependent on flush frequency?

Minus cache=unsafe, you'll never get data corruption. The only consideration is how much data loss can occur from the last time there was a flush. Well behaved applications always flush important data to avoid loss of anything important but practically speaking, the world isn't full of behaved applications.

The only difference between cache=writeback and a normal disk's writeback cache is that cache=writeback can be a very, very large cache that isn't frequently flushed. So the amount of data loss can be much higher than expected.

For most laptop users, cache=none or cache=writethrough is appropriate. For a developer, cache=writeback probably is reasonable.

Regards,

Anthony Liguori

Regards,

Anthony Liguori



reply via email to

[Prev in Thread] Current Thread [Next in Thread]