[fedora-virt] Shared swap among Guests?

Richard W.M. Jones rjones at redhat.com
Fri Nov 25 18:43:18 UTC 2011


On Wed, Nov 23, 2011 at 02:31:32PM +0100, Emanuel Rietveld wrote:
> On 11/23/2011 02:16 PM, Eric Blake wrote:
> > On 11/23/2011 06:01 AM, Frank Murphy wrote:
> >> Can a single physical disk,
> >> be used as a shared swap-drive.
> >> Among virtual Guests?
> > (...) having multiple guests simultaneously running while using the same
> > disk image for shared swap is a recipe for disaster.
> 
> Sorry for barging into this thread but the question made me curious.
> What about using multiple disk images (one per guest), on the same
> *physical* disk? What are the performance implications? Of course
> swapping isn't that fast to begin with, but would a guest that is not
> under excessive memory pressure be noticably slower if you have multiple
> guests swapping to the same physical disk? Are there special
> considerations to swapping that you don't have with non-swap IO?

I don't think there are any rules here.  You'd have to measure it with
your workload.

> Can you do 'swap ballooning' where you have let's say 10GB physical disk
> space and you give 6 VMs 2GB swap space each, hoping they'll never all
> use all of their swap space?

AFAIK this would not be possible.  One problem is that guests don't
give unused swap back to the host (in technical terms, they don't
issue IDE TRIM commands and/or the hypervisor doesn't understand those
commands if they are being issued).  So the guests would all steadily
use more of their 2GB allocation until the host disk space ran out,
which in the current implementation would cause the unlucky guest to
be paused.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


More information about the virt mailing list