Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Advantages of openMosix on IBM xSeries, Part 2

Use networked Linux systems to solve your computing challenges

Daniel Robbins (drobbins@gentoo.org), President/CEO, Gentoo Technologies, Inc. (Courtesy Intel Corporation)
Daniel Robbins is the President/CEO of Gentoo Technologies, Inc. Residing in Albuquerque, New Mexico, he is the creator of Gentoo Linux, an advanced Linux for the PC, and the Portage system, a next-generation ports system for Linux. He writes articles, tutorials, and tips for the developerWorks Linux zone and has also served as a Contributing Author for the Macmillan books Caldera OpenLinux Unleashed, SuSE Linux Unleashed, and Samba Unleashed. Daniel has been involved with computers in some fashion since the second grade, when he was first exposed to the Logo programming language as well as a potentially dangerous dose of Pac Man. This probably explains why he has since served as a Lead Graphic Artist at SONY Electronic Publishing/Psygnosis. Daniel enjoys spending time with his wife, Mary, and daughter, Hadassah. You can contact him at drobbins@gentoo.org.

Summary:  By the end of this three-part series, you'll have your own openMosix mini-cluster up and running and will be ready to use it effectively to accelerate your computing tasks. In Part 1, you get a gentle introduction to the current clustering technologies available for Linux and an introduction to openMosix. In this installment, you will get a fully-functional openMosix cluster configured and running. Finally, in Part 3, you'll see some ways to use openMosix to tackle computing challenges.

Date:  10 Feb 2005
Level:  Introductory

Activity:  1921 views
Comments:  

Introduction

In this three-part series, I’ve been introducing you to a clustering technology for Linux called openMosix. As you may know, clustering technologies allow two or more networked Linux systems (called "nodes") to combine their computing resources to solve computing challenges faster than would be possible if they were tackling the problem on their own. Choice of hardware is flexible of course, and openMosix is not limited to any single hardware platform, but clusters built on IBM xSeries systems running Intel® XeonTM processors will have some unique advantages. Making use of performance-enhancing technologies such as Intel's Hyper-Threading Technology, now supported under Linux, improves the performance of multi-threaded applications by allowing a single Xeon processor to appear to the operating system as two virtual processors. By taking advantage of Hyper-Threading, you benefit from having multiple physical and/or virtual processors, and also enjoy the benefits of openMosix itself.

As this series progresses, I'll guide you through the process of setting up your own openMosix cluster. By the end of the series, you'll have your openMosix mini-cluster up and running and will be ready to use it to effectively accelerate your computing tasks.

In this second installment, I'll walk you through the actual steps of setting up your openMosix cluster. To follow along, you'll need two or more Linux systems connected on a LAN via Ethernet or some other high-speed network transport.


Getting started

The process of setting up an openMosix cluster is actually quite simple. First, we'll install openMosix-enabled Linux kernels on all our Linux systems, each of which will become a node in our cluster. Then, we'll install the openMosix userland tools on each system. Finally, we'll configure a few configuration files in /etc and create an openMosix startup script. Then, we will reboot our nodes and execute the openMosix startup script on each node in our cluster; at this point, openMosix will be enabled and processes will be able to migrate to the nodes where they can execute most efficiently.

Before we begin, a note. If you're using Debian GNU/Linux on any of your nodes, you can type "apt-get openmosix" to have apt perform much of the nitty-gritty openMosix setup for you. Also, if you're using Gentoo Linux, you can type "emerge sys-apps/openmosix-user", which will install an openMosix kernel source tree in /usr/src/linux along with the openMosix userland tools. To make things even easier, the openMosix team now has openMosix RPMs available for your use. However, while these automatic installation methods are convenient if you already know how to use openMosix, they aren't a very good educational tool. Therefore, you may want to skip the available automatic installation options and follow along as we install openMosix from scratch, particularly if you've never used openMosix before. By doing so, you'll get a better feel for what makes openMosix tick.

To get started, first head over to the openMosix main page. We'll need to download two files—the first is the openMosix kernel patch. We'll apply this patch to a specific version of the stock Linux kernel, thereby adding openMosix extensions. At the time this article was written, the most recent version of the openMosix kernel patch was 2.4.17pre3. This name is a bit confusing because this particular patch is named "openMosix-2.4.16-3.gz" and should be applied against a stock 2.4.16 kernel source tree. There's a note on the main openMosix page that helps to clarify this discrepancy.

To begin our adventure, go ahead and download the most recent version of the openMosix kernel patch, being sure to note which kernel source tree version to which it should be applied—somewhere on the openMosix main page should indicate which kernel source tree it depends upon.

You'll also need to grab the latest version of the openMosix userland tools, which will be named something like "openMosixUserland-0.1.3.tgz." You should now have two files on disk: one the openMosix kernel patch, and the other the userland tools source tarball.


Creating an openMosix kernel

There may be one additional file that you'll need to download. If you don't have the appropriate stock kernel source tree on hand, head over to http://www.kernel.org/pub/linux/kernel/v2.4/ and download the kernel sources that the openMosix patch depends upon. Since my version of the openMosix patch is designed to work with 2.4.16 sources, I grabbed linux-2.4.16.tar.gz. Once the kernel sources have completed downloading, we'll install our new openMosix kernel source tree as follows:

# cd /usr/src
# mv linux linux.old
# tar xzvf /path/to/linux-2.4.16.tar.gz
# cd linux
# cat /path/to/openMosix-2.4.16-3.gz | gzip -d | patch -p1 -l

You'll now have openMosix-enabled sources in /usr/src/linux, and can follow the traditional kernel configuration, compilation, and installation steps to install a new openMosix-enabled kernel on each of your nodes. All you'll need to do is enable the appropriate settings under the new MOSIX configuration section, which you can access via "make menuconfig." Under the MOSIX section, you should enable at least the following options:

[*] openMOSIX process migration support
[*] Stricter security on openMOSIX portsrt
[*] Direct File-System Access
[*] openMOSIX File-System
[*] Poll/Select exceptions on pipes

Configure, compile, and install the kernel as you would normally. Once all of your nodes have an openMosix kernel installed, we'll work towards getting the userland tools installed on each node.


Installing the userland tools

The openMosix userland tools are fairly easy to compile and install on each system manually (see the included "Installation" file). However, since it can be a pain to compile and install the userland tools on each machine individually, we're going to compile them on one node.

Then, we'll create a tarball containing all the files that need to be installed on each node in our cluster. Once the tarball is created, we can simply extract it to the root directory of every node in our cluster. This'll also make setup easier if we choose to add additional nodes to our cluster at a later date. To get our userland distribution tarball ready, first choose a node with an openMosix-enabled kernel source tree installed in /usr/src/linux, and type:

# cd /tmp
# tar xzvf /path/to/openMosixUserland-0.1.3.tgz
# cd openMosixUserland-0.1.3

Then, according to the "Installation" instructions, modify the "configuration" file so it looks identical (or at least close) to this:

OPENMOSIX=/usr/src/linux
PROCDIR=/proc/mosix
MONNAME=mmon
CC=gcc
INSTALLDIR=/usr
CFLAGS=-I/m/include -I./ -I/usr/include -I\$(OPENMOSIX)/include -O2
INSTALL=/usr/bin/install

Now compile the tools by typing:

# make clean build man

Install the tools into a temporary directory as follows:

# mkdir /tmp/openmosix-tools
# make INSTALLDIR=/tmp/openmosix-tools/usr install
# mkdir /tmp/openmosix-tools/etc


Final installation steps

A snapshot of all the openMosix userland tools is now installed inside /tmp/openmosix-tools. While we could simply tar up this directory and extract it to / on each of our nodes, we're going to add a few more things to our distribution tarball in order to save us some time. Let's add an openMosix startup/shutdown script and configuration file to our distribution tarball so that everything can be installed in one fell swoop. First, we'll create the /etc/mosix.map file, which describes the configuration of our cluster. To create a version of /etc/mosix.map for distribution, type "vi /tmp/openmosix-tools/etc/mosix.map" (replace "vi" with the name of your favorite editor, of course), and then add a line for each node in your cluster in the following format:

node number         ip address         span

node number should be set to the official number of each node, starting at 1 and being incremented by 1 on each successive line. Follow the node number by the node's IP address, and then specify a "1" for the span argument.

My mosix.map file, consisting of two nodes with IP addresses of 192.168.1.1 and 192.168.1.9, looks like this:

1       192.168.1.1       1
2       192.168.1.9       1

If I wanted to specify a cluster of 100 nodes with consecutive IPs starting at 192.168.1.1 and going to 192.168.1.100, I could take advantage of the span argument and add a single line that looks like this:

1       192.168.1.1       100

Without the span argument, I'd need to create a mosix.map file with 100 lines in it (one for each node), which would be a pain. OK, now that our mosix.map file has been created, go ahead and save mosix.map to disk and exit the editor.

Now we'll create an openMosix rc script that is used to turn openMosix on and off.

First, type:

# install -d /tmp/openmosix-tools/etc/rc.d/init.d

Type vi /tmp/openmosix-tools/etc/rc.d/init.d/openmosix and paste in the following script:

#!/bin/bash
case $1 in
stop)
        echo "Stopping openMosix"
        echo 0 > /proc/mosix/admin/mospe
        rm -f /var/lock/subsys/mosix
        ;;
start)
	echo "Starting openMosix"
        if [ -s /etc/overheads -a -f /proc/mosix/admin/overheads ]
        then
                 grep -v '^#' /etc/overheads > /proc/mosix/admin/overheads
        fi
        if [ -s /etc/mfscosts -a -f /proc/mosix/admin/mfscosts ]
        then
                 grep -v '^#' /etc/mfscosts > /proc/mosix/admin/mfscosts
        fi
        local a1
        local a2
        a1=
        [ -s /etc/mospe ] && a1="-p `cat /etc/mospe`"
        a2=
        [ -s /etc/mosgates ] && a2="-g `cat /etc/mosgates`"
        setpe -W $a1 $a2 -f /etc/mosix.map
        touch /var/lock/subsys/mosix
  ;;
esac

Finally, we'll make the script executable by typing:

# chmod +x /tmp/openmosix-tools/etc/rc.d/init.d/openmosix

Before we create our openMosix userland distribution tarball, we'll create one more directory, /mfs. We'll use /mfs when we configure each node to mount a special openMosix networked filesystem to the /mfs mount point.

Type:

# mkdir /tmp/openmosix-tools/mfs

Now we're ready to create our userland distribution tarball by performing the following steps:

# cd /tmp/openmosix-tools
# tar czvf /tmp/openmosix-tools.tar.gz .

You should now have an "openmosix-tools.tar.gz" tarball in your /tmp directory.

On each node in your cluster (including the one you're on now), install the tarball by typing:

# tar xzpvf /path/to/openmosix-tools.tar.gz -C /

The openMosix userland tools are now installed. We're almost ready to reboot all the nodes and start our openMosix cluster. But first, log in to each node and add to the following line to each /etc/fstab file:

mymfs         /mfs         fs         dfsa=1         0         0

This new line will ensure that the openMosix networked filesystem is mounted to the /mfs mount point when our nodes are restarted. Now, take the appropriate steps to add the /etc/rc.d/init.d/openmosix script to each node's default runlevel; the openmosix script requires that your network is started first—take that into account when choosing when the script will run. Now you're ready to reboot all your nodes. When all our systems complete the boot process, they'll be part of a single openMosix cluster.


OpenMosix up and running!

Once all the nodes are up and running, log in to one of them and type "mmon," which brings up a console-based animated bar graph of the loads on each of the nodes in your cluster.

The openMosix filesystem should also be functional on every node in your cluster. Look inside the /mfs/1 directory. You’ll find node 1's entire filesystem tree. You'll also find additional numeric directories for every node in your cluster. The openMosix filesystem is extremely handy for cluster-related tasks, but can also be used to simply copy files back and forth between the various nodes in your cluster. Inside /mfs, you'll also see various other directories such as "home." These directories provide logical (rather than direct) mappings to certain nodes in your cluster.

OK, your cluster is up and running! Before concluding, let's do a little test to see openMosix in action. Log in to a node in your cluster, and start up "mmon." We're going to run several CPU-intensive programs to demonstrate openMosix's process migration capabilities. Open up a new shell, and type in the following mini-script at the shell prompt:

# for x in 1 2 3 4
do
 awk 'BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}' &
done

Four CPU-intensive awk scripts will begin executing immediately. In your mmon window, you should see the system load on your current node rise sharply.

However, within a few seconds you should notice the system load of your current node drop as several awk processes are migrated to other nodes in your cluster. In turn, you will see the load that was once concentrated on a single node spread over up to four nodes in your cluster. Welcome to the world of openMosix!

Please join me in my next article, when we will look at various ways to take avantage of our new openMosix cluster. See you then!


Resources

About the author

Daniel Robbins is the President/CEO of Gentoo Technologies, Inc. Residing in Albuquerque, New Mexico, he is the creator of Gentoo Linux, an advanced Linux for the PC, and the Portage system, a next-generation ports system for Linux. He writes articles, tutorials, and tips for the developerWorks Linux zone and has also served as a Contributing Author for the Macmillan books Caldera OpenLinux Unleashed, SuSE Linux Unleashed, and Samba Unleashed. Daniel has been involved with computers in some fashion since the second grade, when he was first exposed to the Logo programming language as well as a potentially dangerous dose of Pac Man. This probably explains why he has since served as a Lead Graphic Artist at SONY Electronic Publishing/Psygnosis. Daniel enjoys spending time with his wife, Mary, and daughter, Hadassah. You can contact him at drobbins@gentoo.org.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Linux
ArticleID=13023
ArticleTitle=Advantages of openMosix on IBM xSeries, Part 2
publish-date=02102005
author1-email=drobbins@gentoo.org
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers