CSCI 3325
Distributed Systems

Bowdoin College
Spring 2015
Instructor: Sean Barker

Project 2 - Online Book Store

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

This project should be done in teams of two.

Part 1: Build the Store

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

Since Nile.com plans 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 (the 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 operation 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:

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

Part 2: Writeup

Once you have completed implementing Nile.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 hand in your assignment, upload a tarball to Blackboard containing (at least) the following:

  1. Your writeup (preferably PDF).
  2. All the files for your source code only. Please do not include any executables.
  3. Your Makefile (which will be calling javac to compile your program).
  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.


Here is a list of resources to help you get started with various aspects of the project.