COSC 4377 - Introduction to Computer Networks

Spring 2012

MW 1:00-2:30pm at PGH347

InstructorOmprakash Gnawali

Homework 4 : Concurrent Connection HTTP Server

Due: midnight February 15, 2012

In this assignment, we will change the HTTP server from HW3 to accept concurrent connections.

We learnt from the lectures and readings that sequential HTTP access can result in large latency for pages that contain a large number of objects. One of the solutions to this problem is allowing multiple connections between the client and the server so the client can fetch several objects in parallel through concurrent connections.

A concern with concurrent connections is the amount of resources that the server will require in order to maintain the connections even for a small number of clients. As the number of clients increases, each client opening a large number of concurrent connections, the server will quickly run out of resources. Here is an article that was written when parallel connections started to become commonplace discussing the issues:

Enable the HTTP server you wrote in HW3 to accept multiple connections from the clients. We want to limit the number of connections that the clients are allowed to open from a single application. We also want to limit the total number of connections a server is allowed to open (just so we don't run out of memory and crash). The second restriction is straightforward but the first restriction will require you to think carefully about how to identify a client. Note this is different from identifying an IP address.

Here is how we will launch our http server:

./http_server_conc -p port -maxclient numconn -maxtotal numconn


./http_server_conc -p 20001 -maxclient 12 -maxtotal 60

In the example above, the user launched the server on port 20001. The server will allow each client a maximum of 12 concurrent connections, and the system-wide maximum number of concurrent connections is 60. If a client tries to establish more than the specified number of concurrent connections, or if the aggregate demand for connection exceeds the allowed system-wide maximum, the server should not accept the new connections.

Testing your program

We will copy several files to directory in which your web server is launched. Then, we will use a web client to request those files concurrently using your web server.

Compiling and Running

It is perfectly fine for you to work on your own Linux machine. Regardless of where you do your assignment, your assignment must compile and execute on bayou.

Evaluating the Speedup

You are now ready to evaluate the impact of concurrent connections on HTTP performance. Use your HTTP client from HW2 to download all the URLs listed on test1.txt and test2.txt sequentially and concurrently with 10 connections and report the speedup.

Next, serve these files (testfiles1.tar.gz and testfiles2.tar.gz) using your concurrent HTTP server and measure the speedup between sequential and concurrent fetch for the two test cases above, also with a maximum of 10 concurrent connections..

High-performance HTTP Competition

For students who are interested in exploring high performance http servers and clients, we invite them to tweak the http client and server in other ways to come up with a system that can transfer the files using HTTP as quickly as possible in the cases above and two other hidden test cases. Your submissions are due on 2/21/2012. We will announce the top three winners in the class on 2/22/2012. If you are interested in this competition, please contact the instructor.

This competition has been canceled.


Please provide answers to these questions in the README.txt file.
  1. What is your strategy for identifying unique clients?
  2. How do you prevent the clients from opening more connections once they have opened the maximum number of connections?
  3. Report the times and speedup for concurrent fetch of the URLs in testcase 1 and 2 with the stock http server.
  4. Report the times and speedup for concurrent fetch of the URLs in testcase 1 and 2 with your http_server_conc. Are these numbers same as above? Why or why not?


Put your source code into a folder with the name: uhid_hw4, where uhid is the prefix of your email address. There should be a single Makefile in that directory. When we run make on that directory, it should produce one executable http_server_conc. Put a README.txt in the directory describing anything unusual (e.g., limitations) of your implementation and answer to the questions above. Then, zip the directory and upload the zip file using Blackboard.