|   NetProg 2002 HW5 |
|     Project Description     |    Server Variants     |    Report     |    Deliverables     |    Grading     |    Submission |
Your assignment is to write an HTTP server that returns a document whose size is determined by the request URI. Your server will support a variety of techniques for providing concurrency, and you will do some performance measurements to determine which method works best for various size requests.
The contents of the document can be any HTML document you want, the
size of the document is determined by the requested URI. Your server
should strip the leading slash '/' from the URI and
interpret the resulting string as a integer (in decimal) that
indicates the size of the document to be sent to the client.
If the request line looks like this:
GET /1234
HTTP/1.0Your server should send back a document
that contains exactly 1,234 bytes of text. You should send back a
valid HTML document, but the content of the document can be anything.
The minimum size requested will be 100 bytes, this minimum means that
you can always create a valid document (with HTML,
HEAD and BODY tags). For example, the
following document is 100 bytes long:
<HTML> <HEAD> <TITLE>100 bytes of fun</TITLE> </HEAD> <BODY> a a a a a a a a a a a a </BODY> </HTML> |
This document is 250 bytes long:
<HTML> <HEAD> <TITLE>250 bytes of fun</TITLE> </HEAD> <BODY> a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a </BODY> </HTML> |
Note that your server must send back an HTTP response line, a content-type header and a content-length header. None of these count towards the size of the document.
Your server should send back an HTTP response line that indicates an error if the requested URI is not a number or is less than 100.
The focus of this project is on the development of a concurrent server. Your server must be capable of providing concurrency in 4 different ways, a command line option is used to select the mechanism used. The table below lists the command line options and the resulting method of concurrency:
| Command line option | Method of concurrency |
|---|---|
| -f | Forking server, one child per client. |
| -pf | Preforked server, the number of child processes is specified on the command line as an additional argument. |
| -t | Threaded server, one thread per client. |
| -pt | Prethreaded server, the number of threads is specified on the command line as an additional argument. |
The first command line argument to your server will be the port number on which your server should look for clients.
For example, if your program is named hw5:
This would create a forking server - one child per client:
./hw5 1234 -f
This would create a pre-forked server with 10 child processes:
./hw5 1234 -pf 10
This would create a threaded server - one thread per client:./hw5 1234 -t
This would create a pre-threaded server with 5 threads:
./hw5 1234 -pt 5
NOTE: On solaris.remote.cs.rpi.edu you are restricted to a
total of 64 processes, this includes your login shell and any other
processes you may be running. You need to include code that can
handle the possibility that fork will return an error
(don't simply keep trying to fork, make your server quit if it wants
to fork and is not able to!).
Once your server is working, you must test your server and make
some measurements of the performance for various request sizes and
degrees of concurrency. You do not need to provide timing or
statistics gathering code in your server, instead you will use a
client that can make lots of requests and report on the results.
The ApacheBench program is available
for making measurements - this program can generate multiple HTTP
requests to your server with any desired level of concurrency.
The program executable is installed on the CS Suns
as ~hollingd/public.html/netprog/ApacheBench/ab, there is a copy
of the formatted man page in the same directory. Below is sample usage
of the ab program to give you an idea of what it
does. The test run below sends 100 requests to www.cs.rpi.edu for the
URI ~hollingd/foo.html, sending 10 requests at a time (10 clients at a
time).
> ab -n 100 -c 10 www.cs.rpi.edu/~hollingd/foo.html
This is ApacheBench, Version 1.1
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright (c) 1998 The Apache Group, http://www.apache.org/
Server Software: Apache/1.3.4
Server Hostname: www.cs.rpi.edu
Server Port: 80
Document Path: /~hollingd/foo.html
Document Length: 19 bytes
Concurency Level: 10
Time taken for tests: 1.823 seconds
Complete requests: 100
Failed requests: 0
Total transfered: 26400 bytes
HTML transfered: 1900 bytes
Requests per seconds: 54.85
Transfer rate: 14.48 kb/s
Connnection Times (ms)
min avg max
Connect: 0 0 5
Total: 133 178 265
|
| Server works properly with valid requests (supports all 4 concurrency models). | 40% |
|---|---|
| Server can handle any kind of nonsense. | 10% |
| Writeup (your report). | 25% |
| Code Style/readability | 25% |
Note that the report is worth 25% of the grade, so you need to worry about this! Pretend that you have been assigned to determine the architecture for a web server your company is writing. Your report must convince others that you understand the issues, have made a complete set of measurements, and have data to back up your conclusion(s).
Submission of your homework is via email, the general idea is to send an email message with all your files as attachments. There is an automated email submission system that will respond to your submission right away, so you will have a record that we got your files.
All projects must be submitted via email to netprog-submit@cs.rpi.edu. The subject line of the submission message should contain a single number indicating the project number (5 for HW5). You must include your files as attachments, feel free to send a zip-file or a tar file.
Don't send compiled code!
You can expect a return email indicating receipt of your project submission immediately. This receipt will include a list of all the files that were successfully extracted by the submission script - please look over the receipt carefully to make sure your submission worked.
Multiple Submissions: You can resubmit up to 10 times for each project, we will always grade the last submission received unless you tell us otherwise.