CSCI 339

Distributed Systems

Home | Calendar | Assignments | CS@Williams

Assignment 2: Online Book Store

Due: Sunday, March 9, 2008 11:59PM

This project has two goals. First, it will help you gain experience with remote procedure calls, from the perspective of the client and the server. Second, this assignment will teach you the design and internals of a multi-tier distributed system.

This project should be done in teams of two (or three with prior approval).

Part 1: Build the Store

You have been tasked to design TinyBookstore.com - the World's smallest online bookstore. TinyBookstore.com carries only four books:

Since TinyBookstore.com hopes to one day become the next Amazon, they would like to use sound design principles to design their online store in order to allow for future growth.

The store will employ a two tier design - a front-end and a back-end. The front-end tier will accept user requests and perform initial processing. The backend consists of two components: a catalog server and an order server. The catalog server maintains the catalog (which currently consists of the above four entries). For each entry, it maintains the number of items in stock, cost of the book (you can pick the price), and the topic of the book. Currently all books belong to one of two topics: distributed systems (first two books) and college life (the last two books). The order server maintains a list of all orders received for the books.

The front end server supports three operations:

The first two operations trigger queries on the catalog server. The buy operations triggers a request to the order server.

The catalog server supports two operations: query and update. Two types of queries are supported: query-by-subject and query-by-item. In the first case, a topic is specified and the server returns all matching entries. In the second case, an item is specified and all relevant details are returned. The update operation allows the cost of an item to be updated or the number of items in stock to be increased or decreased.

The order server supports a single operation: buy(item_number). Upon receiving a buy request, the order server must first verify that the item is in stock by querying the catalog server and then decrement the number of items in stock by one. The buy request can fail if the item is out of stock. Assume that new stock arrives periodically (you can pick the interval) and the catalog is updated accordingly.

A pictorial representation of the system is as shown in the figure below.

Other requirements:

You may choose from Java, C, or C++ to build your bookstore, but you must do it in a Unix-like environment. I recommend Java for simplicity, but you will not be penalized if you choose another language.

Please note that no GUIs are required. Simple command line interfaces are fine.

Part 2: Writeup

Once you have completed implementing TinyBookstore.com, write a document that describes your system. Make sure you include any assumptions that you made, along with any problems that you were unable to solve. In addition, include responses to the following questions. You may have to run experiments to help answer these questions. Be sure your writeup includes a description of your experimental setup and graphs to support your answers.

1) Compute the average response time per client search request by measuring the response time seen by a client for 500 sequential requests.

2) Now compute the average response time per buy request for 500 sequential requests.

3) Rerun experiments 1) and 2) with multiple clients concurrently making requests to the system. Does your average response time change as the number of concurrent requests changes?

Part 3: Submission

To submit your assignment, email a tarball to jeannie@cs.williams.edu.

Please include the following files in your tarball.
1) Your writeup (preferably PDF).
2) All the files for your source code only. Please do not include any executables.
3) Your Makefile (or compile instructions).
4) A copy of the output generated by running your program. When a client purchases a book, have your program print a message "bought book book_name". When a client issues a query (lookup/search), have your program print the returned results in a nicely formatted manner.

Resources

I have collected a list of available resources to help you get started with various aspects of this assignment:

XMLRPC Official Home Page

XMLRPC Implementations

Apache XMLRPC for Java (strongly recommended if you plan to use Java XMLRPC)

Java RMI homepage

Java RMI Tutorial

(Old) Java RMI Tutorial from Bucknell