Assignment – 1: Simple
Document
Server/Client
The aim of this assignment is to
introduce you to the basics
of the client-server model of distributed systems. In this assignment
you will
be implementing a document server and associated client. The document
server has
a set of documents in its local file system. It receives requests from
clients
and serves them with the requested documents if available or an error
code if
the requested documents are not available.
The clients send requests and store the
documents in their
local file system. The request strings are of the format GET <filename>.
The server receiving the above
request first checks whether
the request string is properly formatted. If not it sends the following
error
string 100: Unsupported Operation. It
then checks whether the file is
available if so, it send the string 400: OK
followed by the contents of
the file. If the file is not available it sends back the string 404:
Document Not Available. The clients should parse the response
string
and store only the file contents.
The client and server both need
to be implemented in C/C++
using sockets in Linux environment. If you plan to implement it on
another OS
you should talk to me and get prior permission.
In addition to implementing the
clients and server, you will
also do a small performance evaluation studying the effects of file
size and
number of clients on the latency experienced by the clients. For this
you will
create files of sizes 1KB, 10KB, 100 KB and 1 MB at the server. In the
first experiment, one client will repeatedly send requests to the
server for
one file and get response (the client will request the file and read
the
response from the socket repeatedly in a loop (at least 20 times)). You
will
measure the average time taken for getting the entire file from the
server
(latency measurements should not include the time taken to write the
file into
the local file system). For each file size measure the average latency
and plot
it on a graph (X-axis file size (on log scale) and Y-axis average
latency).
In the second experiment you will
create multiple instances
of clients, all of which will simultaneously send repeated requests
(again the
clients execute in loop) to the server. In this case all of them send
requests
to the 100 K file. You will vary the number of clients from 1 through 5
and
measure the average latency and plot it on a graph (X-axis: # of
clients and
Y-Axis: average latency).
This assignment has to be done
individually.
What to Submit:
- You will submit the source codes of
client/server. You should also include makefiles for compiling the
code. You should also include a README stating any assumptions you have
made.
- Submit the performance graphs and in
one/two paragraphs state the observations you have made through this
experimental study.
How to Submit:
Include everything in
a tarred compressed file. Label the file using the following
convention:
<Lastname>_Assignment1.tar.gz.
Upload instructions will be provided shortly.
Submission Deadline:
For Grad
Students: January 30th 2009, 11:59 PM EST
For Undergrad
Students: February 2nd 2009, 11:59 PM EST
Resources:
You can find a number of tutorials on socket
programming on
the Internet. Here are two good ones:
Beej’s
guide to network programming.