TCP vs. UDP

Overview

This module demonstrates differences in UDP and TCP by exploring how the two protocols share the link when running simultaneously. Students will use iperf to create a TCP flow from one node to another and UDP to create a flow in the other direction to show how TCP's congestion control reacts to UDP traffic.

Setup Time: Varies
Tutorial Time: 15 minutes

Objectives

Upon completing this module you will:

  • Be able to use iperf to generate both TCP and UDP traffic
  • Understand how TCP and UDP share a link
  • Understand the role of congestion control in both protocols

Tutorial

A. Slice Creation and Instrumentation

This module assumes you are setup for and familiar with creating slices using the GENI Portal. Unlike some other modules, it is not assumed that you already have a slice created, or resources allocated. You should understand how to adjust the MTU to 1400 on the client and server as in the TCP Traffic tutorial part C. This module assumes you have completed the TCP Traffic tutorial.

B. Video

If you haven't already, watch the video above. It will walk you through the steps of the module.

C. Set up the servers

1. Login to GENI Portal and click create slice to create a new slice.

2. Click Add Resources, then use Jacks to create a set up with two connected nodes named client and server. Select an Instageni aggregate and click Reserve Resources.

We're sending TCP packets in one direction (towards the 'server') and will then send UDP packets in the other direction (to the 'client'). This means that the 'server' will be set up to receive TCP packets, while the 'client' receives UDP packets.

3. Load GENI Desktop by selecting it from the drop down menu called "Tools". Once the nodes have loaded, open Passive Graphs. Turn on LiveUpdate and select only the TCP Graph and UDP Graph from the Graphs drop down. Click ApplyConfig. You should now be able to see TCP and UDP graphs in the Passive Graphs window for both nodes as you click between them in the diagram.

4. On the server SSH terminal start the iperf TCP server by typing:

iperf -s &

5. On the client SSH terminal start the iperf UDP server by typing:

iperf -s -u -i 10 &

"-u" indicates that this iperf server will be receiving UDP packets. and the "-i 10" tells iperf to print updates at intervals of 10 seconds.

D. Start traffic

Read all of part D before entering in any commands.

1. To set up the TCP client type the following on the client SSH terminal:

iperf -c server -t 180 &

This command causes TCP traffic to be sent from the client to the server. It will run for 180 seconds before closing the connection. Observe the TCP traffic graph and you should notice a distinct beginning of TCP traffic.

2. Wait approximately 60 seconds after running the above command (this allows the TCP traffic to reach a steady state), then on the server SSH terminal run:

iperf -c client -t 60 -u -b 100m &

This will send UDP packets from the 'server' to the 'client' at a rate of 100 Mbits/second for 60 seconds.

Remember, we ran the TCP for 180 seconds then waited 60 seconds to begin UDP, which we ran for another 60 seconds. Thus, the TCP traffic should continue 60 seconds after the UDP traffic ends. Once all traffic has ended, observe the TCP and UDP graphs. The TCP traffic should have fallen to for the duration of the UDP traffic. With this much UDP traffic--depending on the size of your link--the TCP traffic may disappear entirely. Below is an example of what your experiment might look like.

E. Try a different UDP Bandwidth

Repeat Step D substituting 40Mbit/s for 100Mbit/s in the UDP traffic.

iperf -c client -t 60 -u -b 40m &

Observe the graph. How did TCP behave differently when the UDP traffic had a lower bandwidth?

Going Further - Assignment

Set up the servers again, and start TCP traffic going from the client VM to the Server VM.

1. Report the bandwidth output of the TCP diagnostics (on the client). It should look something like this:

[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-60.0 sec   683 MBytes  95.5 Mbits/sec 

2. Alter the UDP bandwidth with the -b option: What is the smallest UDP bandwidth at which you can see TCP graph react?

3. Starting TCP and UDP traffic at the same time with the same -t option: at what UDP -b option do TCP and UDP to fairly share the link? That is, at what point does the TCP bandwidth approximate the UDP bandwidth? (Use the TCP client's output, and an estimation of the UDP's average bandwidth.)

4. Report how the sum of the shared bandwidths in part 3 compares to the bandwidth of TCP in part 1 when it is not sharing the link.

Shutdown

Upon completion of the module please delete your slice's resources as described in the Shutdown module.