CSE 223B Labs

Machines

We have set up a cluster of 10 machines. You should use those for all of the lab assignments.

Programming Language

You will write the labs in Google's golang. It is a young language with a language syntax at somewhere between C/C++ and Python. It comes with a very rich standard library, and also language-level support for light-weight but powerful concurrency semantics like go routines and channels.

Here is some key documentation on the language:

While you should be able to find a lot of documents about Go language on the web, especially from the official site. If you know C++ already, here are some hints that might help you bootstrap.

The Tribbler Story

Here is the story: some cowboy programmer wrote a simple online microblogging service called Tribbler, and leveraging the power of the Web, it becomes quite popular. However, the program runs in one single process; it does not scale, cannot support many concurrent connections, and is vulnerable to machine crashes. Knowing that you are taking the distributed computing system course at UCSD, he asks you for help. You answered his call and started this project.

Your goal is to refactor Tribbler into a distributed system, make it robust and scalable.

Getting Started

The Tribbler project is written in golang and stored in a git repository now. To get started, run these commands in command line:

$ cd                       # go to your home directory
$ mkdir -p gopath/src      # the path you use for storing golang src
$ cd gopath/src
$ git clone /classes/cse223b/sp14/labs/trib -b lab1
$ git clone /classes/cse223b/sp14/labs/triblab -b lab1
$ export GOPATH=~/gopath
$ go install ./...

Do some basic testing see if the framework is in good shape:

$ go test ./trib/...

Now The basic Tribbler service should be installed on the system in your home directory. Let's give it a try:

$ ~/gopath/bin/trib-front -init -addr=:rand

The program should show that it serves on a port (which is randomly generated).

Now open your browser and type in the address. For example, if the machine you logged in was c08-11.sysnet.ucsd.edu, and Tribbler is running on port 27944, then open http://c08-11.sysnet.ucsd.edu:27944. You should see a list of Tribbler users, where you can view their tribs and login as them (with no authentication).

This is how the Tribbler service looks like to the user clients. It is a single Web page the performs AJAX calls (a type of RPC that is widely used in Web 2.0) to the web server behind. The webserver then in turn calls the Tribbler logic functions and returns the results back to the Web page in the browser.

If you find it difficult to access the lab machines outside UCSD campus, you need to setup a UCSD VPN or ssh tunnel.

Source Code Organization

The source code in the trib package repository is organized as follow:

Don't be scared by the number of packages. Most of the packages are very small. In fact, all Go language files under trib directory is less than 2500 lines in total (the beauty of Go!).

Through the entire lab, you do not need to (and should not) modify anything in this trib repository. If you feel that you have to change some code to complete your lab, please discuss with the TA. You are always welcome to read the code in trib repository. If you find any bug and reported it, you might get some bonus credit.

Your Job

Your job is to complete the implementation of the triblab package. It is in the second repo that we checked out.

It would be a good practice for you to periodically commit your code into your own triblab git repo. Only files commited in that repo will be submitted for grading.

Lab Roadmap

By the end of the labs, you will have a new Tribbler service implementation that is scalable and fault-tolerant.

Misc

For convenience, you might set environment variables in your .bashrc and/or .bash_profile:

export GOPATH=$HOME/gopath
export PATH=$PATH:$GOPATH/bin

We should have Vim and Emaces installed on the machines. If you need to install other utility packages, ask the TA. Note that you do not have sudo permissions on any of the machines; any sudo attempt will be automatically reported, so please don't even try it.

You could also write your code on your own machine if you want to. See Go language's install page for more information. However, you should test your code on the lab machines.

Ready?

If you feel comfortable with the lab setup now, go forward and read Lab1.


Last updated: Sat Apr 26 19:31:03 -0700 2014 [validate xhtml]