Introduction§
Use the ttcp tool to measure effective bandwidth, or throughput, on an emulated network.
Acknowledgments§
This lab is based on experiments 11.1 and 11.2 from Hands-On Networking with Internet Technologies by Douglas Comer (2nd edition, 2005).
Goals§
- Learn about and experiment with a tool for measuring effective bandwidth.
- Set up a real experiment in Emulab. Further consider the uses of network emulation.
Preparation§
Search the web for "ttcp" and read anything that looks interesting/useful. (Don't worry, there is not too much.) In particular, look out for the Wikipedia article and "The Story of the TTCP Program."
Assignment§
Part A: Experimental Setup§
Create an Emulab experiment with a network configured as follows. The Emulab tutorial links to a Java applet that lets you create the needed .ns file in a GUI, or you can write it yourself following the examples in the tutorial.
- Setup four nodes, all running the FreeBSD OS (not the default Linux - so make sure to set the OS option for each node correctly). Name these nodeA, nodeB, nodeC, and nodeD.
- Nodes A and B are connected by a 100 Mbps link with 0 latency. (A latency of less than 1 ms is typical for a local area network. With a latency of 0 ms on Emulab, you should get the true latency of the underlying physical network.)
- Nodes A and C are connected by a 10 Mbps link with 0 latency.
- Nodes A and D are connected by a 10 Mbps link with 100 ms of latency. (This is typical for a connection across the U.S.)
Start your experiment. Note that if you are having difficulty acquiring enough nodes, you can create a smaller network with only two nodes and one link; in that case, you will need to reconfigure the network several times in parts C and D to create the needed links.
Part B: Loopback throughput§
-
Connect to node A using SSH.
-
Read the manpage for the
ttcpprogram. (Run man ttcp when logged in on one of the nodes of your experiment. Press 'h' for help to learn what keystrokes you can use in themaninterface.) -
On your node, test
ttcpin loopback, that is, connecting back to the same computer. Start one copy in receive mode and another in transmit mode. I suggest you use the-soption so thatttcpwill automatically source (that is, create) and sink (discard) its own data. You can use the-noption to tellttcphow many buffers of data to send; this should be sufficiently large that the transfer takes tens of seconds.For example,
> ttcp -r -s & [1] 2121 > ttcp -t -s -n 100000 localhost(The
&sign at the end of the first command tells the shell to run that command in the background. The shell responds by printing the job ID "[1]" and PID "2121" of the program so you can still control the backgrounded program, and then it gives you another prompt. Later, to end the program running in the background, you can use thekillprogram, giving it the PID of your backgrounded process. Seekill's manpage for details.)You will have to wait while the data is transferred — be patient! Note that
ttcptransfers data using TCP by default. -
In your lab report, record the size of data sent (in bytes) and the time taken (in seconds). Record the throughput in Kbps or Mbps. (Note that you will need to convert bytes to bits.)
-
Repeat the loopback test using UDP (the
-uoption). Record the size, time, and throughput. How does UDP throughput compare to TCP throughput? -
Using TCP to obtain measurements, measure the throughput for buffer sizes ranging from 16KB to 208KB in increments of 32KB. Use the
-boption to specify the socket buffer size. Record your measurements in a file or spreadsheet and plot the data. Include your plot into your lab report, and describe the trend you see. -
The
-Toption causes the sendingttcpto "touch" each byte of data as it is read, to emulate processing on the receiver. Repeat the TCP experiment in exercise 5 with the-Toption set for the receiver. How much is throughput affected?
Part C: TCP throughput on 10 and 100 Mbps networks§
-
Connect to node B using SSH.
-
Measure TCP throughput on the 100 Mpbs link as follows.
Run the
ttcpreceiver on node A and the sender on node B. For the sender, instead of a destination oflocalhostgive the short name of the other machine (e.g.,nodeA).Transfer at least 100000 buffers, or enough data that the transfer takes tens of seconds. Be patient! But, it is more important that the connection take long enough time to reach steady state, than that you transfer all 819200000 bytes of data. If you wait more than about 60 seconds and it has not yet stopped, it is OK to hit CTRL-C on the sender. The throughput data collected will still be good.
-
Conduct a series of 5 such experiments, sending data from one node to the other. Record the throughput each time.
-
Compute and record three values:
- the mean throughput in bits per second (Mbps or Kbps);
- the standard deviation;
- the link utilization, that is, the percentage of the underlying network that was occupied by data.
-
Repeat your experiment with the 10 Mbps link by using nodes A and C. You can reduce the transfer size, as long as it still takes tens of seconds to complete the transfer. Compare the results.
-
Repeat your experiment with the 10 Mbps, high latency link. Compare the results.
Part D: UDP throughput on 10 and 100 Mbps networks§
Repeat part C, exercises 2-4, using UDP rather than TCP. By how much does the throughput differ?
Part E (10% extra credit): Reading source§
Obtain the C language source code for ttcp, read/skim it, and write a paragraph or two giving a high-level explanation of how it works.
(Tips: Start with main(); look up functions you don't recognize using man or the internet; use a text editor with syntax highlighting (TextWrangler on the Macs is good, and Notepad++ works well for Windows); and don't dig too deep.)
(Note: The code is not hugely long, but neither is it well-documented. Do your best, but don't obsess!)
Part F (10% extra credit): TCP throughput across "real" networks§
If you have further time and interest, use ttcp to measure TCP throughput across one or more "real" networks. To do this, try the following steps.
- Identify two or more machines where you have login access and can install/run
ttcp. (ttcpis installed by default on FreeBSD; there is a Darwin package to install it on Mac OS; you can also get it for Linux.) - Locate, download, compile, and/or install
ttcpon at least two machines. - Record the hostname, IP address, and geographic location (if known) of each machine.
- Use the
pingprogram to determine the RTT between each pair of machines. - Conduct the experiment in part C, exercises 2-4, for one or more pairs of machines. You may want to try doing the same pair twice, reversing the role of sender and receiver. What do you learn?
Advice§
I hope the Emulab tutorial will be good preparation for this experiment. You may need to refer back to the tutorial to remind you how to do some things.
The ttcp manpage is very useful. There are also some online tutorials; if you find one useful, please cite it in your lab report and share it with others.
Feel free to ask for help (from me or your classmates) if you get stuck.
Lab Report§
Include:
- your
nsconfiguration files, - a picture of the network topology you used (you can take a screenshot of the GUI builder or draw it yourself, and please add the properties of each link to the picture),
- the procedures followed (describe in English, briefly, what you did for each part (A, B, C, etc.)),
- discussion of the questions asked in the lab description,
- results obtained for your experiments, and
- your answers to the discussion questions below.
Discussion Questions§
Answer the following questions to the best of your understanding.
- Why is throughput not infinite for the loopback configuration?
- Why does the use of a different transport protocol (UDP vs TCP) affect throughput?
- What is the socket buffer size in
ttcp? Why does it affect throughput? - How does link utilization compare for a 10 Mbps versus a 100 Mbps link? Form a hypothesis as to why this relationship exists.
- Why would latency affect throughput?
- What did you find most surprising or interesting about this assignment?
- How long did you spend on this assignment? What problems, if any, did you run into?