[rhelv6-beta-list] Does KVM guest take benefit from the system cache of host?

Pasi Kärkkäinen pasik at iki.fi
Mon May 24 06:33:10 UTC 2010


On Sun, May 23, 2010 at 03:07:01PM -0400, Jon Stanley wrote:
> On Sun, May 23, 2010 at 2:08 PM, Kirby Zhou <kirbyzhou at sohu-rd.com> wrote:
> 
> > Does KVM guest take benefit from the system cache of host?
> >
> > If Guest A writes something to its vda, will the host buffer it?
> >
> >
> >
> > I think XEN do not care about the cache of host, but I am not sure what will
> > happen with KVM.
> 
> I don't have any system on which to test this ATM, but it's rather
> easy to test. I think that due to architectural differences between
> Xen and KVM, you *may* get the benefit of the host pagecache - keep in
> mind that Xen has no "host" - the dom0 is just another VM endowed with
> special privileges running under the hypervisor.  
>

Xen block backend driver running in dom0 directly submits BIOs bypassing dom0 kernel caches.
So Xen *could* take advantage of dom0 kernel caches, but they've chosen not to,
to keep things consistent.

> A simple test would
> go something like this:
> 
> 1) Write large file (something like dd if=/dev/urandom of=/big/file
> bs=1M count=1024 will write a random 1GiB file to the disk)
> 2) Drop the pagecache in the guest (echo 3 > /proc/sys/vm/drop_caches)
> 3) Read same file. If speed is faster than the underlying I/O
> subsystem would allow, then voila, you got it out of cache!
> 

I think kvm has cmdline options to control virtual disk cache behaviour.

-- Pasi




More information about the rhelv6-beta-list mailing list