Xen Virtualization and Linux Clustering, Part 1
Have you heard about Xen virtualization and want to get some hands-on experience? Do you want to experiment with Linux clustering but only have a single computer to devote to the cause? If you answered yes to either of these questions, keep reading.
In this article, I briefly introduce the concepts of Xen virtualization and Linux clustering. From there, I show you how to set up multiple operating systems on a single computer using Xen and how to configure them for use with clustering. I should point out that a cluster implemented in this manner does not provide the computational power of multiple physical computers. It does, however, offer a way to prototype a cluster as well as provide a cost-effective development environment for cluster-based software. Even if you're not interested in clustering, this article gives you hands-on experience using Xen virtualization.
Xen is an open-source software project that provides high-performance, resource-managed virtualization on the x86 processor architecture. It allows multiple operating system instances to run concurrently on a single physical computer. Xen manages the computer's hardware resources so they are shared effectively among the operating system instances, called domains. So what does all this mean? It means that by using Xen virtualization, you can run and use several different operating systems at the same time on a single computer.
Xen supports a variety of operating systems, which increases its applicability for running many popular applications on whichever OS you desire. Xen currently supports Linux kernels through an approach called paravirtualization in which the operating system is modified to become aware of Xen. Other ports have been developed or are in progress for other operating systems, such as NetBSD and FreeBSD. Intel and AMD also are developing new virtualization technology in their processors to allow an OS to run on Xen without modification. That means even Microsoft Windows will be an OS option on Xen in the near future.
Xen virtualization provides many exciting benefits over traditional single OS computers, including server consolidation, application mobility, secure computing and research/testing. What sets Xen apart from other virtualization technologies, however, is its performance. In fact, running over Xen, Linux's performance in a variety of benchmarks is consistently close to native Linux.
So how is a Xen system structured? Each Xen system has a single privileged OS, called Domain-0, that is responsible for starting and managing the other unprivileged OS instances. Domain-0 is the OS that boots when you start your computer, and it has the tools necessary to manage other domains.
Clustering essentially is the unification of multiple independent computers into a single system through the use of software and networking. By definition, a cluster must have at least two computers (called nodes), one master and one slave. The master node typically has a job scheduler that schedules the work to be done by the slave nodes. As the name implies, the slave nodes perform whatever work has been scheduled for them to do. The nodes of the cluster communicate using a message passing interface. Two of the most commonly used message passing interfaces are PVM and MPI. For this tutorial, we are using PVM 3.4 to implement clustering.
For the tutorial that follows, the master node is the privileged Xen Domain-0 and the slave nodes are the unprivileged Xen Domains. This approach allows us to create and use as many slave nodes as we want.
The first step to getting started with Xen is to install it. This process involves several steps:
Install the required libraries.
Install and/or compile the Xen privileged/unprivileged kernels.
Configure the bootloader to boot Domain-0.
Set up unprivileged domains.
I do not cover these first three steps here, because adequate documentation already is available on-line describing this process. A good place to start is the Xen User Manual. In addition, a wide variety of tutorials and troubleshooting articles are available on-line. Be sure to find one that matches the Linux distribution you are using as Domain-0. During the installation process, you need to consider which Linux kernels are appropriate for your use. The Xen binary release contains pre-compiled kernels for both the privileged and unprivileged domains. If you require anything special that's not supported by these kernels, you may need to compile a custom kernel with Xen support. On my system, I compiled my own Domain-0 kernel but used the stock kernel for the unprivileged domains. Another important consideration for this tutorial is to leave an extra, unused partition on your hard drive for later use with the unprivileged domains.
For the tutorial that follows, I assume you have Xen 2.0.7 installed and can boot Domain-0. You also must be able to start xend, the Xen control daemon, which must be running in order to start and manage other domains.
Xen 3.0 was released recently. If you are more daring, you might consider installing that version instead, although you may not be able to follow along with this article as easily. I also assume that your Domain-0 is a Debian-based distribution. If not, you simply need to use whatever mechanism your distribution provides for downloading and installing packages, typically where the apt-get command is used below.
- SUSE LLC's SUSE Manager
- Returning Values from Bash Functions
- My +1 Sword of Productivity
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Non-Linux FOSS: Caffeine!
- Managing Linux Using Puppet
- Tech Tip: Really Simple HTTP Server with Python
- Doing for User Space What We Did for Kernel Space
- Rogue Wave Software's Zend Server
- Parsing an RSS News Feed with a Bash Script