CS290I - Scalable Internet Services and Systems

Thorsten von Eicken - UCSB - Winter 2002

Handout #4 - Project 3

Updated 3/5/2002

Due Friday, Feb. 22nd Wednesday, Feb. 27th, 1pm

Important:

Objective

In this project you will add dynamic activity to your site in the form of live auctions. The auction rules below are meant to be only a vague approximation of what happens in at Yahoo! and other real auction sites. The purpose being to implement something with interesting behavior, not to simulate reality.

Database tables & fields

You will have to augment the database tables from projects 1&2 slightly in order to implement the live auctions. The following two changes are required/recommended:

Users table: add a password field (required)

Auctions table: add a status field to indicate the status/outcome of the auction (recommended), e.g. active/sold/unsold, drop curBid and highBidder fields (suggested)

BidHistory table: add a bid id field as primary key. It is needed in the response to the /robots/newBid request.

Web pages

For this project you will need two sets of web pages that are almost identical in function but differ in presentation. The first set is a set of robot pages that will be used exclusively by the testing and benchmarking robot we are writing. These pages do not require any authentication and they return simple ascii text (content-type: text/plain) that can be parsed easily, i.e. no HTML. The second set is a set of user pages, through which a human user can see the information, i.e., what you would expect from a web site. The two main differences between these sets of pages are (1) the formatting of the content and (2) whether a "login" is required or not.

Robot pages

The following pages are for robots that submit items and bids and verify the operation of the auction market. For simplicity, these pages are not password protected. Each page must be of content-type text/plain (not HTML!), and consists of a table, one row per line, and each field separated by a comma. The fields must be in the order shown in the descriptions below.

Sample response for "GET /robots/user?tve":

HTTP/1.0 200 OK
Content-length: 238
Content-type: text/plain

OK
tve,Thorsten von Eicken,250,1
1043,bid,100,1,2002-02-01 08:30:05.0
1001,selling,0,0,2002-02-20 08:34:00.0

Sample response for "GET /robots/user?nobody":

HTTP/1.0 200 OK
Content-length: 16
Content-type: text/plain

ERROR
USER NOT FOUND

How to display information for auction/items being sold:

How to display information for bids (auction/items being bought):

User pages

Your site will feature the following pages for its users:

Notes:

How to settle auctions

Note on ordering constraints:

Bids have to be processed strictly according to the assigned bid id. So this must be a sequential process. However, there is some room for adjustment in assigning the bid id. A client can only observe three events: the time at which the HTTP request is sent (Treq), the time at which the HTTP response is received (Tresp), and the bid id that was assigned (Bid). The only invariants that the server must maintain are:

Tresp1 < Treq2  =>  Bid1 < Bid2
Bid1 < Bid2  =>  Treq1 < Tresp2

Note that the bid times are not required to have the same sequence as the bid ids, i.e., it is acceptable to have a bid with a lower id and another bid show a later time. This is so we don't have to rely on synchronized clock when running on multiple servers.

What to turn in

Write a "one page" project overview describing the overall structure of your code. Describe the presentation layer (using WebMacro?), the business logic, and the storage/DB layer. Any special features you are using? Special algorithms, tricks, etc? Any packages you found on the web that are useful?

What's coming next

Project 4 will have a very simple problem statement: run your web service on 3 machines at the same time, all using the same database on bugatti (4th machine). We will load-balance incoming requests round-robin to your 3 servers. Provide the best performance you can, and make your service resilient to server and machine failures (i.e. we will kill your processes and/or halt the machines).