Quiz 2 - CPSC 4240/6240 Spring 2017 Solution
last update: 2/23/2017
Step 1 - download, unpack and build the UDPEcho2 package
On your VM,
- >cd; mkdir UDPEcho2;cd ./UDPEcho2;
- >wget https://people.cs.clemson.edu/~jmarty/courses/Spring-2017/CPSC424/code/UDPEcho2.tar.gz
(If you don't have wget, issue 'sudo apt-get install wget' )
Unpack and build:
- >gzip -d UDPEcho2.tar.gz
- >tar -xf UDPEcho2.tar
- >make clean
- >make
Step 2. Get familiar with the client and server - source code, usage, make several extensions
Read the readme.txt and look over the client and server code - see https://people.cs.clemson.edu/~jmarty/courses/Spring-2017/CPSC424/code/UDPEcho2/
Please make the following changes
- Change the client source code so that the iteration delay is in units of microseconds rather than seconds. Make sure the client correctly uses for a delay that is more precise than seconds.
- Make changes to the client and server source to make it more robust for operation over wireless links (where the link miight drop and reactivate randomly). The following are what you should think about:
- The client should be modified to reuse a socket, until an error occurs.
- All system calls, including any external library calls, should deal with any/all errors or unexpected events.
- Various testing strategies include:
- while the client/server are running (with localhost, or with client on your VM interacting with a server on a deptartment machine) drop the link and reactivate.
- On linux : issue 'ifconfig' to learn the name of the network interfaces. On my VM I see enp0s17...
- To force a link down, 'sudo ifconfig enp0s17 down' (and then issue an up to restore the link)
- If operating the client on your VM and the server on an external machine, you can use netem to force random packet loss
- tc qdisc add dev enp0s17 root netem limit 1000 delay 20ms loss 6% (this adds fixed delay of 20ms to each outbound packet with a random loss process of 6%.
Step 3 Collect Data - Perform two experiments
For both experiments, the following holds:
Run the server : ./server 5000
Run the client : ./client localhost 5000 100000 1000 5000 > exp*Results.dat ; 5000 iterations, 0.100 seconds (100000 useconds) iteration delay, 1000 byte msg size, 5000 iterations
Develop a simple bash script that uses awk and processes the file as follows:
- Create a new file with the delay sample in microseconds
- Compute and display the mean.
Finally, use matlab, octave, excel, (or any tool you want) to plot the probability distribution of the data set of RTTs.
- Experiment 1 - run both the client and server on your VM (two shells)
- Experiment 2 - run the client on your VM and the server on a dept. Linux machine.
This is a matlab script that reads an input file (currently set to ping.dat, modify that line to read in your data file, with a timeseries of data (1 field per line representing the number of milliseconds) ), it does a pass through the data to deal with outliers (defines a maxValue - you would need to adjust this to fit your data set), and then generates a probability distribution. In matlab, this is done in two steps - first the data is binned to create a historgram; second that data is normalized by modifying the y axis data to be a frequency of occurrence which when plotted with an X axis of the possible values in the data set produces the probability distribution. If you just plot the histogram that is OK for the quiz but for future questions make sure you refresh your memory related to probability distributions.
Step 4. Submission: two components
- -handin UPDEcho2.tar.gz with your changes and the data files.
- -Submit a PDF that contains your two probability distribution plots using turnitin.
Solution: The modified UDPEcho2 is in the package UDPEchoV1-2.tar.gz
- Reuses the same socket, on a certain number of errors (errorCount > ERROR_LIMIT) it closes and opens a new socket
- Supports debug output - optionally creates an output file RTT.dat (at server, a File but not used at the moment).
- The #if 0 is a placeholder for the next step which is to integrate with perfTool.tar.gz
- Ran into build issue on MacOS - platform specific areas:
- <endian.h> - on linux, but MacOS has its own, freeBSD has its own. This is where the htonl, ntohl (and similar) macros are located.
- Created portable_endian.h - appears ok on linux, MacOS (have not yet tested on freeBSD).
We ran the server on a Mac and two clients on two different Linux machines. All three Hosts were connected by WiFi.
Both clients were run on a VM on two diffferent laptops. Client 1 on as follows: ./client 192.168.0.9 5000 1000000 1000 2000 130
The server : ./server 5000 130
MacOS ---- ./server 5000 130 ----- wifi ----|---->two Linux Hosts (client1 and client2)
- To test the reliability, I did the following:
- while running the client on my VM and the server on IMP8, use 'ifconfig ethxx down' and then 'ifconfig ethxx up' to cause the link to drop and then restore
- use tc to generate artificial random loss:
- VM to VM :
- UDPEchoClient2(1.2):exit(1487806502.255782) duration:5001.581572 #attempts/samples/#Lost/#TOs/NumberNewSockets: :5000:5000:0:0:1 (#errors:0)
meanCurRTT:0.000111758 smoothedRTT:0.000157080, avgLoss:0.00000, numberLost:0, numberOutOfOrder:0
- RTT output : VMtoVM.dat
- Each line represents status at the time an RTT sample is created...8 fields per line:
- 1487747591.227005 0.002747 0.001373 1 1 0 0 0
- Timestamp : unix timestamp when a valid ACK arrives allowing a new RTT sample.
- RTT sample : in seconds, based on the current iteration.
- smoothedRTT : average based on a moving average (0.5*smoothedRTT) + (0.5*RTTSample)
- RxSeqNumber : Seq number of the ACK that just arrives.
- largestSeqNumberSent
- #outOforder : If the RxSeqNumber that arrives is less than largestSeqNumberSent
- Example: Just sent seqNumber 100 but then RxSeqNumber 99 (or lower) arrives. SeqNumber 100 is only sent if either of the following occur (the second possibility defines this counter)
- RxSeqNumber 99 arrives
- A timeout occurs causing seqNumber 100 to be sent. But....for whatever reason, RxSeqNumber 99 was not lost but just arrives very late causing an errorneous retransmission.
- #Lost
- #errors
- The second experiment's RTT data is in the file VMtoIMP8.dat
- UDPEchoClient2(1.2):exit(1487830757.006141) duration:5115.128835 #attempts/samples/#Lost/#TOs/NumberNewSockets: :5000:4997:3:0:1 (#errors:0)
meanCurRTT:0.022236723 smoothedRTT:0.031627658, avgLoss:0.06000, numberLost:3, numberOutOfOrder:0
RTT data analysis.
- We can issue the following to produce a single column RTT.dat file : cat VMtoVM.dat | awk '{ print $2}' > RTT.dat
And then