Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What are the opinions on allowing virtual memory inside a virtual machine?

For example, a host machine w/8 Gig of memory, I could run 4 VMs each w/2 Gig (roughly) and there would be no host swapping. However, in each VM I could have a 2Gig page file so the virtual server had 4Gig of usable memory, 2 physical 2 virtual.

OR... I could give each VM 4 Gig of "memory" and have the host use 8Gig of real memory and 8G of virtual memory and have no page file in each VM. Each VM would still have "4Gig" but the paging would occur on the host.

The warm-fuzzy part of me says setup paging in each guest like you would a real server and you're good. But the analytical side of me sees two major advantages to overcommitting the host memory and having no paging in the VM. First, the IO for the virtual memory is then handled by the host OS, which is closer to the bare metal, so it should be quicker. And second, paging would only be required if the host didn't have the memory available. If the guest wanted 4Gig, but other guests weren't using their memory then no paging would be required.

Thoughts?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

I'm not a virtualization expert (in fact I think it's the wrong tool for the job most times), but from what I have read your guest OS's should not be allowed to swap. The primary reason for preventing swapping is it represents a way for one guess OS to hog a large portion of th e host's IO bandwidth.

Also, you don't want to pretend to your guess OS's that the host has more physical memory than it has as it will cause the host to swap heavily, but debugging performance issues inside the guess OS's will be very hard, because from their point of view they are not swapping, and none of the os level tools in the guest will show it.

It may even be with tools like Xen and VmWare you cannot overcommit memory on the host OS because of the use of baloon memory drivers.

share|improve this answer

I wouldn't give your Guest virtual memory due to IO problems. Nor would I give your Host virtual memory and the guest too much physical memory, as the guest wouldn't actually realise it was using virtual memory rather than physical memory.

Which doesn't leave you with any solutions but to purchase more memory. You really can't get an alternative for more memory. It's so cheap, if your server can support more, I'd get more.

share|improve this answer
    
You didn't mention in the post what guest or host os's you were planning on using. If you're planning to virtualize Windows hosts with ESX then you'll be able to use their fantastic memory de-duplication technology which is similar to copy on write pages for different os processes, except it looks for identical memory pages within, and across hosts and reallocates them to the same physical page in memory. Using ESX to virtualise Windows hosts for testing the savings in physical memory footprint have been amazing. –  Dave Cheney May 5 '09 at 17:20

That would heavily depend on the consequences of overcommitting memory on your host OS. I would be a bit more than annoyed if, for example, I'd have the Linux out-of-memory killer slay my virtual machine. I tend to set aside a smaller, separate, preallocated, snapshot-independent (if applicable to your VM solution) virtual disk for each guest OS, ensure the file hosting that disk image is not fragmented and/or on a fast drive, and configure the guest swap space to reside on that virtual disk. Hypervisor memory management today is good enough to not feel the difference between OOM host swapping and OOM guest swapping, and I can fine-tune guest behavior independently. Best of both worlds.

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.