COSC 6377 : Computer Networks

Spring 2019

MW 4-530pm at AH 2

Homework 3: Server Selection

Due: 4/30/2019

In this homework, we will learn how to select the best server for content download.

A standard content "file1.jpg" is replicated on three servers. Our goal is to download as many copies of file1.jpg as quickly as possible from the content server.

The servers, like any server on the Internet, might serve the file at different data rate depending on the server or network workload. To be able to select the best server, you need to perform measurements and select the server that offers download at the highest rate continuously.

To make this hw easier, we put some constraints on the system. The server will randomly switch between three different fixed rates: low, medium, high. The server switches to a different rate exactly every ten seconds.

To help you determine if you are making the best server selection at any given time, each server as an "info" port. Through the info port, the server tells you the current rate in json with one attribute rate with the possible values: low, medium, high. E.g.,

	  {"rate": R}

	  R can be "low", "medium", or "high".
	

Both the data port and info port serve data as a standard http response.

Your code should be written in Python2.7. You are welcome to use the pycurl library to download. Your code should run on code.cs.uh.edu. Your source code should be a single Python file called dynamic-client.py which we will launch as:


./dynamic-client.py ipaddress s1datap s1infop s2datap s2infop s3datap s3infop

			where the first argument is the ip address for
			the server and the remaining arguments are the
			data and information ports for the servers.

	

Here is an example execution:


./dynamic-client.py 1.2.3.4 8070 8071 8080 8081 8090 8091

	time: XYZ
	measurement result: server 1 - XYZ bps
	measurement result: server 2 - XYZ bps
	measurement result: server 3 - XYZ bps

	time: XYZ
	selecting server 2
	downloading...
	downloading...

	time: XYZ
	measurement result: server 1 - XYZ bps
	measurement result: server 2 - XYZ bps
	measurement result: server 3 - XYZ bps

	selection server 3

	etc.
	

      

For submission, we need three parts: (1) Description of your strategy for best server selection, (2) plot a graph that shows the optimal data rate and your achieved data rate as a function of time spanning at least three minutes, and (3) your souce code.

Submission

Please upload your code using git invitation for hw3. Please include a README that describes the author, contact information, a short description of the software, and finally limitations of your implementation. In the directory, you should have two files: dynamic-client.py and hw3report.pdf which is the report with the graph and description of your server selection strategy.