CPSC 441: Computer Communications

Professor Carey Williamson

Winter 2013

Assignment 2: Parallel TCP Experiments (24 marks)

Due: Tuesday, March 5, 2013 (11:59pm)

The purpose of this assignment is to learn about the Transmission Control Protocol (TCP), as well as the principles of reliable data transfer. In particular, you will write a C or C++ program that implements a crude version of parallel TCP data transfer. You will then conduct some simple networking experiments to assess the performance of your TCP-based protocol.

When we discussed Web server performance at the application layer, we learned that many modern Web browsers use multiple TCP connections in parallel to improve user-perceived Web performance. They do so on a per-object basis, by allowing multiple objects to be downloaded concurrently, either from the same Web server, or from different ones. This approach can improve network utilization, and reduce Web page download time.

In this assignment, you are going to take this "parallel TCP" idea one step further, and apply it to the transfer of individual objects (i.e., files). For lack of a better name, we will call this new protocol "Carey's Really Asinine Parallel Protocol", or CRAPP for short.

The CRAPP protocol operates much like FTP. That is, it operates in a client-server fashion, and is used to transfer a single file at a time. It has both a session part and a data transfer part. During the session part, one can specify configuration parameters to be used for the transfer. During the data transfer part, a single specified file is transferred from the server to the client.

There are two important configuration parameters in CRAPP:

Suppose you are transferring a file of size D bytes. When using a single TCP connection, all of the data bytes are transferred over the same connection, much like FTP. When P = 2, however, half of the data bytes are sent over the first connection, and half are (concurrently) sent over the second connection (assuming the file size is even). The file is re-assembled at the other end, and restored to its original form. When C = 1, you can think of the two-connection case as sending the odd-numbered bytes over one connection, and the even-numbered bytes over the other connection, in alternating fashion. For larger values of C, think of the data as being chunked and distributed across the connections in a round-robin fashion. For example, for P = 3 and C = 4, the data "Mary had a little lamb" would involve sending "Mary" on the first connection, " had" on the second connection, and " a l" on the third connection, followed by "ittl" on the first connection, "e la" on the second connection, and "mb" on the third connection, until all of the data has been sent.

You need to write a program to implement the CRAPP protocol, as specified above. Note that you will have to write both the client (8 marks) and server (8 marks) ends to test your protocol. Your program should be written in C or C++, with suitable socket programming, and it should use TCP for its transport-layer protocol on each of the parallel connections. Include a brief user manual (2 marks), that explains how to compile, run, and test your program, as well as the syntax and semantics of the commands that it supports.

When your program is working properly, use it to conduct some data transfer experiments to measure performance (i.e., file transfer time). Show your results in tabular form like the following, with one table for D = 64 KB (2 marks) and another table for D = 1 MB (2 marks).

File Size D C = 1 C = 1024 C = MSS C = 4096
P = 1
P = 2
P = 4
P = 8

In addition to your experimental results, write a brief (one-page maximum) summary of your results (2 marks), making sure to comment upon the advantages and/or disadvantages of the CRAPP protocol.

When you are finished, please submit your assignment solution as a single file in electronic form to your TA on or before the stated deadline. Make sure your name and identification is on everything that you submit. Your submission should include your source code, the results produced by your program, and the written summary of your results. (Up to 4 bonus marks are available for particularly elegant multi-threaded solutions to this assignment.)

TIPS:

Think about the FTP protocol, which is likely a good starting point for your work. Get the P = 1 single data connection case working first, and then extend it to P = 2 parallel TCP connections. Once the latter is working, extending to larger P should be relatively straightforward. Maybe.

Stick with plain ASCII text files for your testing. Start small, and then work upwards to larger files for your main experiments. Here for example is a directory of text files of different sizes that you might find useful.

Work with very small files (less than 1 KB) to start with, so that you can put verbose debugging in to test the functionality of your protocol. Once these are working right, you can scale up to larger files (4 KB or more) to tackle any new challenges that arise.

The networking research literature has several papers describing multi-path TCP. What you are implementing is similar in flavour to multi-path TCP, but much simpler.

If you happen to have download accelerator software running on your computer, you might want to take a look at how it works. The underlying principles are likely very similar.

You do not have to make your server non-blocking, but you can do so if you wish. If you are using PTHREADS in your solution, please be VERY careful if you are using fork() as well. Further explanation available upon request.

If you've never used PTHREADS before, here is a simple example called summer.c to get you started.