Douglas E. Comer


Computer Science Department
Purdue University
West Lafayette, IN 47907

webmaster: W. David Laverell


Companion Topics

Home

Book Information

Purpose of Site

Getting Started

Students

Faculty

"What's New"

"Coming Attractions"

"C Pointers"

Acknowledgements

 

 
Hands-On Networking: Experiment 16.3 (An Emulab Approach) Home > Student > Experiments > Emulab > 16.3

Chapter 16: Experiment 16.3 - Configure And Test A Web Load Balancer

The following script (with instructions), written by my student, Eric Knibbe, does the trick:

  
# modified by Eric Knibbe, 2006

set ns [new Simulator]
source tb_compat.tcl

set server1 [$ns node]
set server2 [$ns node]
set server3 [$ns node]
set server4 [$ns node]
set balancer [$ns node]

set lan1 [$ns make-lan "$balancer $server1 $server2 " 100Mb 0ms]
set lan2 [$ns make-lan "$balancer $server3 $server4 " 100Mb 0ms]

# set the OS for some nodes		
#tb-set-node-os $balancer "RHL-STD"

# Optional: hard-code IP addresses for each server
tb-set-ip $server1 10.1.1.3
tb-set-ip $server2 10.1.1.4
tb-set-ip $server3 10.1.2.3
tb-set-ip $server4 10.1.2.4

# set start commands
tb-set-node-startcmd $server1 "cd ~/tiny_server; ./a.out 5431"
tb-set-node-startcmd $server2 "cd ~/tiny_server; ./a.out 5431"
tb-set-node-startcmd $server3 "cd ~/tiny_server; ./a.out 5431"
tb-set-node-startcmd $server4 "cd ~/tiny_server; ./a.out 5431"
tb-set-node-startcmd $balancer "cd ~/balance; sudo make install; /usr/sbin/balance -f 5431 10.1.1.3 10.1.1.4 10.1.2.3 10.1.2.4"

$ns rtproto Static
$ns run


# Once experiment is running, test any web server by loading 
# http://server1.experiment.emulab-ops.emulab.calvin.edu:5431/file1.html
# or something similar.
# Then, load up the balancer through something like 
# http://balancer.experiment.emulab-ops.emulab.calvin.edu:5431/file1.html

#note that the Makefile for balance needs some modifications from the default to install correctly

It is assumed that you have the following under your home directory on users.emulab.whatever.

  1. balance (http://www.inlab.de/balance.html)

  2. a directory called tiny_server contining the file http.c, a web server written by another former student, David Vos, and an html file, say file1.html.

As Eric points out the rub here our inability to test to see how well balance is balancing. I can think of lots of ways to that, but they all require more personpower than I have available at the moment.



This site is maintained by W. David Laverell of the Computer Science Department at Calvin College. For assistance or corrections, please contact him at lave@calvin.edu.