In this document:
When: Wednesdays 8-10 am ONLY!
Where: Core 342 (the Dark Lab)
How: Walk-in.
Other times can be arranged by email.
Please, do NOT come to my office outside office
hours or without an appointment. Just like you, I'm a busy graduate
student trying to get out of this place. If you come at random times,
I can't get my work done. But I will gladly answer your emails as soon
as I can and I will try hard to arrange time to see you outside office
hours.
Click is installed on
all cereal machines. These machines include the following ones:
kix.rutgers.edu
trix.rutgers.edu
applejacks.rutgers.edu
grapenuts.rutgers.edu
cocoapuffs.rutgers.edu
booberry.rutgers.edu
honeycombs.rutgers.edu
capncrunch.rutgers.edu
frankenberry.rutgers.edu
raisinbran.rutgers.edu
...
In order for you to use click, you must create a directory under your
home directory and create a link to my click executable:
kix>mkdir click
kix>cd click
kix>ln -s ~edpin/click/bin/click
then you're ready to go. Just create your .click file using your
favorite editor and execute it:
kix>vi test.click
....(edit your code)...
kix>./click test.click
...(results appear on the screen, on stderr)
And you're ready to go.
If you need help, the man pages are at http://www.pdos.lcs.mit.edu/click/doc/. Go to "Elements by category" to find the stuff you need (function calls).
Submit your assignments to edpin@cs.rutgers.edu. Don't forget to include a README file explaining your work, difficulties and etc.
Your job is to implement a simple router, just to get you acquainted with click. The description is on the course's page.
Notice that it doesn't say there, but for all assignments you MUST email a README file together with the source code. The README file should describe your efforts, what you got done, what didn't work and any other difficulties you had. Also, state your assumptions if there was something you didn't do along the lines of what was asked or it what was asked was unclear.
Here's the deal:
1) Two machines: 128.6.171.157 and 128.6.171.148.
2) You will be given accounts on them. Do not email me, I'll email you with your login name and password. If you don't get one until Friday 10/22 at noon, then email me.
3) You have root access: type 'slide su -' or simply 'slide
4) If you can't use Linux or you don't know what root is you won't be
able to finish this assignment. Learn, get help. I can't teach you the
basics. So, don't ask.
5) Click is installed on both machines under /root/click-1.4.1/. You
will need to install a version on your local machine as well, because
you'll need to compile stuff. DO NOT COMPILE ON THE TWO MACHINES
listed on 1). To install click, copy /root/click-1.4.1.tar.gz to your
home wherever you're working (cereal lab) and 'tar -xvzf
click-1.4.1.tar.gz', './configure --enable-local', 'make'.
6) You'll need to compile your own click element. This
page shows you the basics.
7) Put your .cc file in your home directory (on your local machine)
under ./click-1.4.1/elements/local and 'make' it. You'll get a .o
file. You MUST call your click element XY_name, where XY are your
initials and name is whatever you want. For example, my click element
is called EP_mactable.
8) When you're happy with your click element, upload it (the .o file
only!) to both of the machines listed on 1) (use scp).
9) Now you're ready to use your click element. Good luck.
Here's some sample code for you to get started on the click element:
Your job is to create a load balancer for a distributed
server. Imagine you're responsible for fine tuning Yahoo's web
servers. Perhaps Yahoo has 100's or 1000's of servers, but clients
always think they're connecting to www.yahoo.com. One way of doing
this is through the DNS (which is how Yahoo actually does it -- at an
initial phase at least). Another one is through a load balancer in
front of the servers.
To balance load on servers, one must send approximately the same
amount of packets to all servers. In click, you'll do this by
listening to a well-known port (say, 5000) and reading packets from
multiple connections (multiple clients). Then, according to the rate
packets come to click, you divert these packets to N servers (say,
N=3). Assuming all servers are equal, you want all connections to have
approximately the same rate. Extra credit: assign weights to
different servers and balance the connections accordingly. For
example, assume server 0 has weight 1/6, server 1, 2/6 and server 3,
3/6. Then server 3 will get 3x more packets than server 0 and so on).
Client and Server
To test the code, you'll need to write a simple pair of client and
server applications (in Java, C, C++ or Perl). Clients send messages
to servers, which process them. Clients must submit different messages
with different lenghts at different rates, so that you can prove your
load balancer works. These messages should be created with random
content plus a unique message number so you can track them. The server
should process the messages and return something. Typically an ACK or
OK message is good enough. But you must acknowledge the correct
message to the correct client. For example, when a server received MSG
34 from client 1, it should reply OK MGS 34 to client 1.
The click load balancer
Your click program will run in userlevel, no root required
(phew!). You can install it on any machine you want, including the
cereal lab. It should take connections from a TCP port. Anyway you
want to do this is fine, but you'll probably want to use
FromSocket to read from clients and ToSocket to write to
servers. FromSocket accepts connections and pushes packets on output
port 0. You might need to determine which streams of packets came from
which clients so that your server can reply to the correct client. For
that, you might want to include the client's IP in the body of the
message to make it easier for your click program to reply to the
correct client.
What you must submit:
Create a TAR or TAR.GZ or a ZIP file (RENAMED to something else) with
ALL of the following included (note: do not attach single files to
email messages. Also, if you need to resubmit something before the
deadline, resubmit the whole TAR/ZIP file, not only what changed):
As usual, submit your work by December 19th, 2004 (hard deadline,
no extension!) to: edpin @ cs. There is no need to include text in
the email, only the attached TAR or ZIP file (but let me know it's a
ZIP file if you use one). Incomplete/incorrect submissions will lose points.
mactable.cc
mactable.hh
Assignment #3