Linux-Vserver vs Xen 

http://allmybrain.com/2008/01/14/linux-vserver-vs-xen/

January 14th, 2008

By: Dennis
Tags: linux, linux-vserver, virtual servers, Xen

A while back, I found myself running out of hardware and wanting to host more sites than I currently was. In addition, I wanted to create a little bit more redundancy for some of the services I host.

At the time, I was hosting a number of services with Xen. One physical server hosted 3 or 4 virtual servers. After a certain amount of reading over different solutions, I decided to convert all my production virtual servers to Linux-vserver. I'm not advocating either solution here. I'm simply going to point out my reasons for changing and hopefully help my readers understand the issue more.

About Xen 

Xen is powered by what the Xen team has named the "Hypervisor". The Hypervisor is a thin operating system that runs in between the hardware and the real operating system, like Linux or BSD. Having the Hypervisor run in place of an operating system creates the ability to start multiple virtual operating systems that each function with the same level of access to the physical hardware. In other words, it would be possible to allow a guest operating system access a disk drive without talking to the host operating system first.

In Xen terminology, the first operating system to boot with the Hypervisor is called "Dom0". Using Dom0, you can then use the Xen tools to boot other operating systems. These are termed "DomU" systems. Each DomU system needs a special kernel that is compiled to run under the Dom0 operating system. Xen allows a range of different operating systems to be run under Dom0. I read some time ago, that the overhead for running multiple virtual systems was somewhere around 3%. In my experience running Xen, it really did seem to perform without a lot of overhead.

One downside of Xen is that you have to partition your physical resources for your virtual machines. You have to decide how much memory a virtual server needs and then allocate that memory when you start the system. Although there are tools to change, in real time, the memory that a virtual server is taking, most people are probably not going to attempt this on a regular basis.

Overall, Xen works quite well when you need to run different operating systems on one machine. For me however, I use virtual servers to separate business needs. In other words, I don't want to install DNS, Mail, and a number of other disimilar servers in one operating system. This allows me to easily scale up or reconfigure a particular service if I need without interfering with the other services. I was running the same operating system on all my virtual servers. I basically found that after partitioning the physical memory a number of times, I didn't have room to start additional virtual servers and had to look for more resources. While it's true that some services could have probably been configured to use less memory, I don't like to limit those virtual machines if possible.

About Linux-Vserver 

Linux-Vserver uses a simpler approach to virtualization than Xen does. Linux-Vserver exists as a patch to the Linux kernel. Support for virtualization is implemented by providing a set of tools that start virtual machines with the support provided by the new kernel features. Basically, each guest machine runs on the same host kernel. They use the same memory and may or may not use the same disk drive. This has the advantage that while virtual machines can still be separate, they don't require more memory than the processes contained within require. For example, instead of allocating 125 Megabytes of memory for a server, you just start it up and it'll take however much memory it takes. If it only takes 12 Megs to run that type of server, you can effectively start up 10 instances on one virtual server where the Xen solution only had room for 1.

Now, you might argue that you could allocate less memory for the Xen virtual servers. The problem is that what if a virtual server suddenly needs more than you allocate. With Linux-vserver, as long as you have more physical memory available, virtual servers can grow. Of course, if you run out of physical memory, you'll have a problem. Even though Linux-vserver guests could potentially utilize of the physical memory, they can be configured to have a maximum amount of memory per guest.

Summary 

You'll have to decide which solution works best for you. In my case, I've been able to add quite a few more virtual servers to our existing hardware by switching to Linux-vserver. I've been able to use the same methods I was using to make backup copies of virtual servers with both Xen and Linux-vserver. Most of the disk images I was using with Xen actually worked with only minor modification when starting them with Linux-vserver. Overall, the transition has been quite painless and the solution suites my needs.

documented on: 2008-02-03