qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Caching modes


From: Blue Swirl
Subject: Re: [Qemu-devel] Caching modes
Date: Mon, 20 Sep 2010 18:37:23 +0000

On Mon, Sep 20, 2010 at 4:53 PM, Anthony Liguori <address@hidden> wrote:
> Moving to a separate thread since this has come up a few times and I think
> we need to discuss the assumptions a bit more.
>
> This is how I understand the caching modes should behave and what guarantees
> a guest gets.
>
> cache=none
>
> All read and write requests SHOULD avoid any type of caching in the host.
>  Any write request MUST complete after the next level of storage reports
> that the write request has completed.  A flush from the guest MUST complete
> after all pending I/O requests for the guest have been completed.
>
> As an implementation detail, with the raw format, these guarantees are only
> in place for preallocated images.  Sparse images do not provide as strong of
> a guarantee.
>
> cache=writethrough
>
> All read and write requests MAY be cached by the host.  Read requests MAY be
> satisfied by cached data in the host.  Any write request MUST complete after
> the next level of storage reports that the write request has completed.  A
> flush from the guest MUST complete after all pending I/O requests for the
> guest have been completed.
>
> As an implementation detail, with the raw format, these guarantees also
> apply for sparse images.  In the future, we could relax this such that
> sparse images did not provide as strong of a guarantee.
>
> cache=writeback
>
> All read and writes requests MAY be cached by the host.  Read and write
> requests may be completed entirely within the cache.  A write request MAY
> complete before the next level of storage reports that the write request has
> completed.   A flush from the guest MUST complete after all pending I/O
> requests for the guest have been completed and acknowledged by the next
> level of the storage hierarchy.

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

>
> 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?

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?



reply via email to

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