Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there any point to doing disk buffer caching in a virtual machine, if the hypervisor OS is doing it? I wonder if buffering in the VM will just waste memory that could be better allocated to VM use, or if data read will be buffered both in the hypervisor and in the guest OS.

Or is there some system that automatically handles coordination of buffer cache between hypervisor and guest?

Should I turn it off in the host machine, or in the VMs?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Too many variables, you don't state your workload, filesystem(s), storage specs, host or guest mix, though even if you did I'd probably still just generalise ;-) As a set of guidelines:

  • nothing trumps pragmatic reading of vendor documentation and emprical evidence. vmware in particular have useful and comprehensive white papers
  • each guest ought have the best notion of what to cache, e.g. filesystem metadata might be more useful, only a guest can accurately pre-read, so a guest cache should be more effective
  • if you have deduplicated storage, the vm host caching might be more effective for certain workloads
  • if you overcommit on memory all bets are off
  • memory is always faster than spinning rust, a SAN might make this less noticeable

In theory, a vm guest storage driver could intelligently communicate with the host to optimise buffering, I'm not aware of any specific implementation.

You could probably benefit by reducing vm host buffering, if extra memory helps your guest performance. You can't tell for sure without measurements, so: measure, analyze, tune, repeat as necessary.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.