Effect of RTT and Window Size on TCP Throughput
This module allows students to experiment with how RTT and TCP window size affect TCP throughput. They will learn how to adjust the RTT of a TCP connection by adding delay, as well as how to adjust the window size of an iperf TCP flow.
Setup Time: Varies
Tutorial Time: 20 minutes
Upon completing this module you will:
- Be able to adjust the delay on an interface
- Be able to start flows with custom window sizes
- Have a feel for how window size and RTT can affect TCP throughput
A. Slice Creation and Instrumentation
This module assumes you have an active slice with two connected nodes and SSH terminals to both nodes. If you don't, follow the steps in the GENI Setup module and the Instrumentation module, then continue here. It is also assumed that the IP addresses and hostnames are assigned as described in the GENI Setup module (client=10.1.1.1, server=10.1.1.2). If this is not the case, you will need to substitute the correct IP addresses and hostnames below.
If you haven't already, watch the video above. It will walk you through the steps of the module.
C. Adjust The MTU
If both your nodes are within the same aggregate or you have already adjusted the MTU, skip this section and continue to section D.
1. On the server SSH terminal, type:
to list the node's network interfaces and the attributes and status of each. Make note of the name of the interface that is assigned the 10.1.1.2 address (i.e. “gre2”).
2. A GRE tunnel is used to connect nodes from different aggregates. When a GRE tunnel is used, it is necessary to adjust the Maximum Transmission Unit (MTU) size for the interfaces. This can be done by issuing the following command:
sudo ifconfig <interface name> mtu 1400
where <interface name> is replaced with the name of the interface noted in the previous step (i.e. "gre2"). The MTU size for the interface is now compatible with the GRE link between the two nodes.
3. Repeat steps 1 and 2 on the client SSH terminal; however, be careful as the interface names may be different.
D. Adding and Removing Delay
1. First, determine the approximate Round Trip Time (RTT) between your nodes using the ping tool. In the server SSH terminal, type:
Note the "time=" value at the end of each line, which is the approximate RTT.
2. Type Ctrl-c on the server SSH terminal to stop the pinging.
3. Determine the name of the interface that is attached to IP address 10.1.1.2 on the server node (i.e. "gre2") using:
You will use this interface name in the commands below.
4. Linux offers a rich set of tools for controlling traffic. We will utilize the tc (for traffic control) tool here to add a fixed amount of delay to all packets leaving the given local interface. Issue the following command:
sudo tc qdisc add dev <interface name> root netem delay 100ms
where <interface name> is replaced with the interface name determined in step 3. This command adjusts the traffic control (tc) queuing discipline (qdisc) by adding (add) a network emulation (netem) delay of 100 milliseconds to the given device at its root.
5. Run ping again.
The RTT ("time=") should now be 100ms longer. Type Ctrl-c to stop the pinging.
6. Now, remove the delay with the following command:
sudo tc qdisc del dev <interface name> root
where <interface name> is again replaced with the interface name. This deletes (del) the current queuing discipline from the given device's root. Note: To change the delay on an interface, you must always first delete the queueing discipline and then add a new one.
7. Run ping yet again.
The RTT ("time=") should return to approximately what it was before adding delay. Type Ctrl-c to stop the pinging.
E. Adjusting The TCP Window Size
1. iperf is a tool for measuring TCP and UDP bandwidth performance. It also allows us to change the window size. In the server SSH terminal, start the iperf server by typing:
The node is running iperf in server mode ("-s") and is ready to receive iperf traffic.
2. In the client SSH terminal, start the iperf client by typing:
iperf –c server ‐t 10
This command starts iperf in client mode ("-c"), opens a TCP connection to the specified hostname ("server"), and begins sending packets using the default window sizes. The client will stop after 10 seconds ("-t 10").
3. Once the client is done, type "Ctrl-c" in the server SSH terminal to kill the server. Note the average bandwidth value, which is printed in the client terminal.
4. We will now repeat the procedure but we will limit the window size on both the client and server. Note that Linux automatically doubles the window size set by iperf, so the commands below request a 2KB window to obtain a 4KB window size. In the server SSH terminal, type:
iperf –s -w 2KB
5. In the client SSH terminal, type:
iperf –c server ‐t 10 -w 2KB
6. Once the client is done, type "Ctrl-c" in the server SSH terminal to kill the server. Note the average bandwidth value in the client window. The value should be significantly less than it when the default window size was used. (note the units Kbps vs Mbps)
Going Further - Assignment
Part 1: For this assignment, you will utilize the totaltraffic graphs to plot and compare the results of adjusting the RTT and Window Size parameters. For information on opening these graphs see section E of the Instrumentation module. Run experiments for every combination of two window sizes (4KB and 32KB) and two delay amounts (50ms and 250ms), and take a screenshot of the graphs from both nodes after each experiment has completed. You should have 8 pictures in total (e.g. one image for each of the two nodes for each of the following combinations: 4KB and 50ms, 4KB and 250ms, 32KB and 50ms, and 32KB and 250ms).
Part 2: You should have noticed a large difference in average throughput between the 4KB and 250ms case and the 32KB and 50ms case. Justify this difference in your own words and by referencing the TCP equation given in your notes. Note: If you actually work out the math with the TCP equation, you should use the total delay of your system, not just the delay you added.
Upon completion of the module please delete your slice's resources as described in the Shutdown module.