Xen Virtualization and Linux Clustering, Part 1

Interested in seeing what all the fuss is about Xen? Use the steps in this tutorial to get Xen installed and domains configured.

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.

What is 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.

What is Clustering?

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.

Assumed Configuration

The first step to getting started with Xen is to install it. This process involves several steps:

  1. Install the required libraries.

  2. Install and/or compile the Xen privileged/unprivileged kernels.

  3. Configure the bootloader to boot Domain-0.

  4. 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.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

how can i do virtualization on a cluster of 3 physical computer

Ajay vijayan's picture

i want to know weather this is possible for more than 2 physical cpu or a cluster of 2 to 3 computers

How Tos for Xen-Cluster online in German!

Anonymous's picture

If you're looking for a German Howto for a Xen-Cluster virtualization, take a look at http://www.thomas-krenn.com/de/wiki/Kategorie:Xen

application in SAN storage environment

Anonymous's picture

Whats the possible use of virtualisation in a storage environment?

application in SAN storage environment

Anonymous's picture

Whats the possible use of virtualisation in a storage environment?

High availability

Corey's picture

If you have a highly available cluster running over a shared filesystem such as GFS or Lustre etc. You can virtualize your nodes so that when a node needs to come down for maintainence or whatever, you can simply migrate the "virtual" node to other hardware, possible one that already has an instance running. XEN domain migration is very fast, less than 100ms from what I understand. It becomes a lot easier to attain "Five 9's" of uptime or better.

less than 100ms downtime,

miguelon's picture

less than 100ms downtime, that's awesome, I've done it and its true, if you continuosly ping a domain and migrate it, you only lose one of them.

nice howto, thank you!

Anonymous's picture

I have but one gripe: what is it with the page width? I'm at 1280x1024, and the page is still wider than my screen! Like, crazy, man.

advertising

Anonymous's picture

I wouldn't worry too much about missing some advertisements ;-)

page width

michael's picture

I have the same resolution, Displays fine.

ah, I should have tried more

Anonymous's picture

ah, I should have tried more browsers. It's a Konqueror problem, firefox and opera look fine.

Looks bad in Safari too

Anonymous's picture

You guys should test your pages in a few browsers. It comes out super wide for me, very irritating.

Thanks for the article though.

Safari and Konqueror

Albert Peschar's picture

Yeah, Safari and Konqueror both use about the same engine.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix