EE122 Communication Networks, Fall '05
Project 2 Specification v 1.0

Department of Electrical Engineering and Computer Science
University of California, Berkeley






1. Introduction
In a complex, dynamic, expensive, and large-scale system like the Internet, analytic solutions are usually not known or are only approximately known. Due to many practical reasons such as cost, risk, and controllability, etc., real experiments on the actual network system may not be preferred. Network simulators attempt to represent real world networks by modeling key elements of the real system and incorporating most of its salient features. Furthermore, it is not too complex for us to understand and experiment with them. The models and their operations enable us to predict the behavior of actual systems at low cost under different configurations of interest and over long period. Although network simulators are not perfect, they are usually accurate enough to give us a meaningful insight into how the network is working, and how its operation can be optimized.

Many network simulators, such as NS2, Openet, Qualnet, etc., are widely available. We'll use NS2 for this project. NS2 is a discrete event simulator written in C++, with an OTcl interpreter shell as the user interface that allows the input model files (Tcl scripts) to be executed. Most network elements in the NS2 simulator are developed as classes, in object-oriented fashion. The simulator supports a class hierarchy in C++,  and a very similar class hierarchy in OTcl. The root of this class hierarchy is the TclObject in OTcl. Users create new simulator objects through the OTcl interpreter, and then these objects are mirrored by corresponding objects in the class hierarchy in C++. NS2 provides substantial support for simulation of TCP, routing algorithms, queueing algorithms, and multicast protocols over wired and wireless (local and satellite) networks, etc. It is freely distributed, and all source code is available.

Developing new networking protocols and creating simulation scripts are complex tasks, which requires understanding of the NS2 class hierarchy, C++, and Tcl programming. However, in this project, you only need to design and run simulations in Tcl scripts using the simulator objects without changing NS2 core components such as the class hierarchy, event schedulers, and other network building blocks. You'll focus on simulation and analysis of some different windowing mechanisms and TCP variants. You should put all your results in the files with given names. For your report, you do not need to rewrite the assumptions given in this document, but should provide any information not already given to you. This project has to be done individually but not in groups.

2. Objectives

3. Using NS2

Following are a few useful NS2 tutorial documents or web sites (you'll find valuable information on NS2 as well as some useful simulation examples):

In EECS department, NS2 2.1b9a has already been installed under directory "/share/instsww/pkg/ns-allinone-2.1b9a/bin" (http://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=ns.help). Although it is not the latest version (NS2 2.27, released Jan 18, 2004), it is still good for this project.
To run NS2, we need to add the appropriate directory to PATH environment variable.

Several other software tools are very useful for running the ns simulations scripts: Otcl, Nam, Gnuplot, XGraph, Awk, and Perl. The script itself is in Otcl, which is an object-oriented version of Tcl, a well-known scripting language. Nam is a Tcl/Tk based animation tool for visualizing network simulation traces and real world packet traces. Gnuplot and XGraph are general plotting tools, and we use them to plot simulation results. Awk and Perl are text-processing languages and we use them to parse the trace files for further analysis. If you want more information about these software tools, please go to class web site of Project 2.

You may also want to install NS2 and related software package on your LINUX machine. The all-in-one NS2 package can be downloaded from NS2 web site (http://www.isi.edu/nsnam/ns/ns-build.html). There is a Windows version of NS2. However, it doesn't work as well as the UNIX/LINUX version, so use it at your own risk.

4. Task Description
Task 1: Bandwidth Share of TCP flows with different Window Sizes
Consider a network with 4 nodes, as shown in Figure 1. The link between node 3 and node 4 has a speed of 1 Mbps. All other links have a speed of 2 Mbps. All links have a propagation delay of 10 ms and a Drop Tail buffer. There is a TCP/FTP flow from node 1 to node 4 and from node 2 to node 4. Both start at 0.1 second, and end at 5 seconds. The packet length for both flows is 1000 Bytes, and they both have a window size of 25 packets. The queue buffer size for the link from node 3 to node 4 is 4 packets. There is no other traffic in the network other than that described above.


Figure 1

You are given a sample file (task1_sample.tcl) to simulate the above-mentioned network. Run the simulation for 5 seconds by typing "ns task1_sample.tcl", and then we obtain an output trace file, task1_out.nam. You need to understand the trace format and be able to extract meaningful performance metrics from such files by using Awk, Perl, etc. Take a look at "task1_out.nam". Ignore entries with -t *; these entries are used by nam to visualize the network topology. The rest of the entries look like:

The fields in the trace file are: type of the event, simulation time when the event occurred, source and destination nodes, packet type (protocol, action or traffic source), packet size, color type, packet ID, flow identifier, source and destination addresses, sequence number, and packet id. Note that the internal identifier numbers for node 1, node 2, node 3, and node 4 are 0, 1, 2, and 3, respectively. The event type "+", "-", "r", and "d" represent enqueue operations, dequeue operations, receive events, and drop events, respectively. Although we have a strong preference for you to use Awk to answer the following question, you can use other languages such as perl to compute these metrics if you prefer, but you are on your own (sample code for other languages is not available).


Let's take a look at the Tcl scripts in "task1_sample.tcl", and go through the sequence of required steps to set up and solve a simulation problem:


(a) (task1.pdf) Based on the execution results of previous Awk commands, what is the packet loss rate of the two TCP flows? What is the ratio of throughput between the two packets?

(b) (task1_b.tcl) Revise the sample code "task1_sample.tcl" so that the window size of the second TCP flow (tcp2) changes from 25 to 5. In the real world, such a change might occur if one were to switch from browing the internet with one's home computer to browing on one's cell phone. Because the resources are much more limited, the window size drops dramatically. Use the given Awk scripts to compute the total traffic of both flows. How does the packet rate loss change? Which flow uses more bandwidth in the bottleneck from node 3 to node 4? What is the reason?

(c) (task1_c.tcl) Revise the sample code "task1_sample.tcl" so that the window size of both the TCP flows are set to 5. Use the given Awk scripts to compute the total traffic of both flows. Give the total bytes of traffic for each flow. How does the packet loss rate change? Do both flows receive a "fair share" of the available bandwidth of the bottleneck link? What is the reason? Present your results for a-c in a table.


Figure 2

(d) (task1_d.tcl, task1_d_total.awk) Now node 5 is added to the network configuration in part c). It is connected to node 3. The link between node 5 and node 3 has a speed of 2 Mbps and a propagation delay of 10 ms. The new network topology is shown in Figure 2. One more TCP/FTP flow with a window size of 5 is generated from node 5 to node 4. Revise the sample code "task1_sample.tcl" for the new network, and run the simulation. Revise the sample Awk command in file "task1_total.awk" to compute the total bytes of TCP from each flow. Give the total bytes of TCP for each flow. Do all the TCP flows receive a fair "share" of the bandwidth? Why or why not?
 

Task 2: Different Flavors of TCP


To get the tcl scripts and binary needed for task 2, download the following file: task2.tar
To extract the files type: tar xvf task2.tar

 

Task 2: Different Flavors of TCP The Internet suffered from congestion collapse in the late 80's. As a result, several congestion control algorithms were proposed and implemented to prevent the TCP senders from overwhelming the resources of the network. In 1988, TCP Tahoe was introduced with three congestion control algorithms: slow start, additive increase/multiplicative decrease (AIMD), and fast retransmit. Since then, many modifications have been made to TCP and several different versions of TCP have been implemented. TCP Reno revises TCP Tahoe by modifying the fast retransmit to include fast recovery. Another conservative extension of TCP Reno is TCP SACK, which adds Selective Acknowledgment to TCP. In this project, you'll study these three variants of TCP protocol: Tahoe, Reno, and SACK.

 

In NS2, TCP Tahoe is the default implementation and such a sender agent is called Agent/TCP. Other TCP sender agents are obtained by adding the TCP variant names to the base name, for example, Agent/TCP/Reno,  Agent/TCP/Sack1. Except TCP SACK, you only need to change the sender agent, and these TCP variants use the same receiver agent, Agent/TCPSink. On the other hand, for TCP SACK, you will also need to change the sink agent to Agent/TCPSink/Sack1.

 

p class=MsoNormal>Task 2 uses the same network topology in Figure 1 as Task 1, but with different traffic. Now the TCP/FTP flow from node 1 to node 4 starts at 0.1 second, and stops at 8 seconds. The UDP/CBR flow from node 2 to node 4 starts at 3 seconds, and ends at 5 seconds. The packet length for UDP/CBR flow is 1000 Bytes. The rate of UDP/CBR flow is 2 Mbps. There is no background traffic. For part (a), (b), (c), and (d), the simulation time is 8 seconds.

 

In the first part of Task2 simulations, we'll use 3 blackbox TCP implementations: TCP_A, TCP_B, and TCP_C. In Tcl scripts, their sender agents are created by using Agent/TCP/tcp_A, Agent/TCP/tcp_B, Agent/TCP/tcp_C, respectively. Their corresponding receive agents have to be Agent/TCPSink/Sink_A, Agent/TCPSink/Sink_B, and Agent/TCPSink/Sink_C. We know these 3 TCP variants implement TCP Tahoe, TCP Reno, and TCP SACK. But it is unknown which implements the one we want. NS2 simulator doesn't know what these agents are, but our own simulator BNS knows. Basically, BNS can handle all Tcl scripts for NS2 simulations, as well as those scripts that use the four TCP blackboxes. You can download the BNS executable file from the web site of Project 2 (http://inst.eecs.berkeley.edu/~ee122/project/proj2_index.html).

 

Together with the simulator NSB, we also provide three sample Tcl files that simulate the given network: tcp_A.tcl, tcp_B.tcl, tcp_C.tcl. They use TCP_A, TCP_B, and TCP_C, respectively. The Tcl simulation script "tcp_x.tcl", where "x" is one of "A", "B", and "C", produces following output trace files:

 

·        tcp_x.nam and tcp_x.tr: their formats are defined by NS2. (refer http://www.isi.edu/nsnam/ns/doc/node272.html, and http://www.isi.edu/nsnam/ns/doc/node565.html)

·        tcp_x_throughput.tr: each entry looks like "[time] [TCP throughput in link from node 3 to node 4]".

·        tcp_x_drop.tr: each entry looks like "[time] [number of dropped packets in the buffer of link from node 3 to node 4]".

·        tcp_x_cwind.tr: each entry looks like "[time] [congestion window (packets) of TCP sender]".

·        tcp_x_seq.tr: each entry looks like "[time] [max (packet) seq number sent by TCP sender]".

·        tcp_x_ack.tr: each entry looks like "[time] [highest ACK received by TCP sender]".

 

Plotting related figures (congestion window (packets) of TCP sender as a function of time, max (packet) sequence number sent by TCP sender as a function of time, highest ACK received by TCP sender as a function of time, and number of dropped packets in the buffer of link from node 3 to node 4 as a function of time) from these trace files will help you guess the TCP variant that each of these blackboxes implements. Usually the traffic scenario we provide in the sample Tcl scripts will generate enough information for you to recognize the TCP variant. However, if you want to get more information, you may modify the sample Tcl scripts to change the traffic so that expected TCP behavior will be triggered.

 

A good reference for this project is Fall and Floyd's paper, "Simulation-based Comparisons of Tahoe, Reno, and SACK TCP" ( ps, pdf).

 

(a) Run all these Tcl simulation scripts. Based on the observation on the behavior of these TCP blackboxes, identify the blackbox for each of those three TCP variants.

 

(b) For each blackbox implementation save the following graphs: highest ACK received by TCP as a function of time, cwnd as a function of time.

 

(c) For the blackbox corresponding to TCP Tahoe: At what time is additive increase invoked for the second time? What is the approximate beginning time that multiplicative decrease is invoked for the third time? What is the approximate beginning time that fast retransmit is invoked for the first time?

 

(d) For the blackbox for TCP Reno: What is the approximate beginning time that fast recovery is invoked for the first time? What is the approximate time interval that additive increase is invoked for the second time?

 

(e) Which of the TCP variants achieves the highest throughput and why?

 

Another variant of TCP, FAST TCP: implements an alternative congestion control scheme:

·        First, it is an equation-based algorithm and hence eliminates packet-level oscillations

·        Second, it uses queueing delay as the primary measure of congestion, which can be more reliably measured by end hosts than loss probability in fast long-distance networks.

·        Third, it has a stable dynamics and achieves weighted proportional fairness in equilibrium.

Fast TCP was designed to achieve higher throughput in high-bandwidth and delay networks

 

The simulation scenario provided in Reno_Fast_tcp1.tcl and Reno_Fast_tcp2.tcl sets up the same network topology used above, but with different traffic: there is one one TCP/Reno source and one TCP/Fast source. The network topologies created in the two scripts are the same – the only difference is the bandwidth and delay of the links

(f) (task2.pdf) Run the two scripts. What is the throughput for TCP/Fast and TCP/Reno in each case. When does TCP/Fast outperform TCP/Reno (script 1 or 2). Why?

Queueing Schemes

In Drop tail, a router serves incoming packets in the arrival order, and when the buffer is full, the newly arriving packet is simply discarded.

Task 2 uses a similar network topology in Figure 1 (Task 1), but instead of only 2 nodes, there are 10 nodes and 10 TCP traffic flows. Now the TCP/FTP flow from node 1 through 10 starts at 0.1 seconds. There is no background traffic.

 

RED is designed to cooperate with the congestion control mechanism of TCP. It detects the beginning of congestion by monitoring the average buffer occupancy at the router, and notifies the connections by intentionally dropping packets at a certain probability. RED sets the packet dropping probability by a function of buffer occupancy (average queue size).

 

So far we have used Drop-tail congestion notification schemes In the next section we will provide you will scripts that implement drop tail, RED

 

(g) Run the simulations and identify which one is drop tail, and which one is RED. Give supporting evidence for your choice

 

 

5 Checkpoint, Submission and Grading
5.1 Checkpoint
This project is handed out on October 19, and is due on November 2 (11.59PM). You have two weeks to work on it. You are strongly urged to start your project as early as possible! Be aware that you don't have any slip day for homeworks and projects.

5.2 Submission
The project can only be submitted online. To submit your files, create a directory, first copy the relevant files into that directory. Then go into that directory and type

You are to submit the following files: 5.3 Grading

Last updated: 10/26/2004