Archive for May 6th, 2008

Avoiding Common Virtualization Mistakes (Part 1)

May 6, 2008

Memory Allocation to Virtual Machines:

One of the hardest parts of virtualizing an operating system in a virtual machine is learning that although the virtual machines are very much like physical machines in many different ways, and can perform many of the same tasks they are at the same time very different beasts.

One of the biggest mistakes folks make when they first start virtualizing is allocating the wrong amount of memory to the virtual machines (usually too much).

There are several factors to consider when deciding how much memory to allocate the virtual:

  • What OS will the virtual be running?
  • What applications will the virtual be running?
  • How much RAM is in the host machine?
  • Will the host be a workstation or a server?
  • What OS will the host be running?

Each of these 5 variables needs special and equal consideration. I will break down each question and give you some pointers for making an educated decision when creating your virtual machines. These variables also ring true across all virtualization platforms no matter if it’s VMware, XEN, KVM, Hyper-V or Virtual Box.

What OS will your virtual be running?

A good starting point for determining the minimum amount of RAM to allocate to your virtual machine will come from the documentation for the guest OS. Check to see what the publisher’s minimum RAM requirement is. Also, for a Linux or UNIX based guest OS; check the requirements for the desktop environment or Window Manager you will be running in the Virtual (if running on at all).

What Applications will your virtual be running?

Besides checking the minimum RAM requirements for your guest OS, you need to take into account how much memory your applications on the virtual will need as well. Again, consult documentation, and understand that you will usually need to add about half of what the application recommends to the overall system memory in the virtual over the OS requirement for comfortable performance. Also, decide now how much you will be multitasking in the virtual OS and take that into consideration as well.

How much RAM is in the host machine?

We will also address the questions “Will the host be a workstation or a server?” as well as “What OS will the host be running?” in this section as well. To start with, running any modern OS on the host, I wouldn’t attempt virtualization without at least 1GB of RAM in the host machine, and preferably 2 GB. Obviously, the more RAM you have in the host, the more RAM you can allocate to your virtual machines. Just how much RAM you can allocate to your virtual machines will depend on the answers to the next two questions. If your host machine is to be a workstation, and you need it to be responsive to host applications while running the virtual, you will need to be careful with how much RAM you allocate to your virtual machines or you will be in “Swap City” before you know it. Also, on the other hand, if your host is a dedicated VM Host server, you can leave less RAM for the host OS and allocate more to the virtual machines since you will not be interacting with the host on its own level.

Also, different host operating systems handle memory very different ways. Generally speaking, Linux will use up more physical memory before it starts to swap and slow down on you than Windows. Taking all this into consideration, if your machine is a workstation, try to keep at least half of your hosts RAM free. If you are running a dedicated host server, you can use up RAM for virtual machines all the way down to the minimum requirement for your host OS and be comfortable.

Real world examples:

My “In a pinch” VMware-Server host:

I have a machine at work that has been in service since October and was set up in a pinch for one of our programmers who needed a quick place to set up two XP VMs to do Delphi builds. I didn’t have a physical host server at the time with enough free resources to meet his request, and we were still in the planning stages of our XenServer project. I did have a recycled desktop workstation which had an Athlon 64 3000+ and 2GB of RAM, so I loaded up Ubuntu Server (CLi only install) and VMware-Server. I gave each virtual 896MB of RAM leaving Ubuntu-Server 256MB for itself. That machine has been running strong since and has only been rebooted once. Sadly, this little soldier is about to be retired as I’m moving those two VMs to a Xen host soon. The moral is, not having the overhead of a Desktop Environment or the need to interact with the host OS gave me the freedom to allocate as much RAM as possible to the VMs and still have them (and the host) perform well.

My “test” Xen Host server:

This guy was an oddball out and has a slightly different revision of the Xeon (Clovertown vs. Harpertown) from the rest of the servers in our Xen Farm. It has become my “test” Xen host and will host test and build workstations for various departments and will be the home of those two XP VMs in the above paragraph eventually. This guy is actually a nice machine –it’s a 2U Dell Poweredge with Dual Quad-Core Xeon Clovertown 2.66GHz chips, but at the moment only has 8GB of RAM (to be upgraded to 16GB or 32GB soon). Right now this guy is sitting at 88% memory utilization running 2 Vista VMs at 1GB each, 4 XP VMs at 512MB each, 2 Windows 2000 VM’s at 512 each and 2 Server 2003 VMs at 1GB each, and each VM is very responsive. Our “production” Xen hosts are Dual Harpertowns with 16GB each and will eventually see similar memory utilization (although on fewer VMs with more RAM each).

My personal Workstation (at home):

This guy was a beast at one time, but seems a little tame now (at least processor wise). This machine has an AMD Athlon 64X2 4600+ (2.4GHz), 6GB DDR2 800 RAM and 3 Hard Drives for a total of nearly 1TB of space and is running Windows XP x64 edition. I do give this machine a beating though, as I use it to test out different operating systems and I have a few VMs on here that I actually use regularly. Having 6GB of system RAM gives me the freedom to allocate a nice chunk of RAM to my VMs. I have an Ubuntu 8.04 and a Vista Business Virtual that have 2GB of RAM each and I honestly don’t even notice when they are running. RAM is getting very cheap right now, so if you are serious about virtualization on your workstation PC, invest in as much RAM as you can afford and/or as much as your Motherboard and OS will handle. Remember, you must have an x64 machine and an x64 host OS to utilize more than ~3.25 GB of RAM.

Good Luck and happy virtualizing!