Exercises on ns-2. Chadi BARAKAT. INRIA, PLANETE research group 2004, route des Lucioles 06902 Sophia Antipolis, France



Similar documents
ns-2 Tutorial Exercise

Network Simulator: ns-2

TCP Performance Simulations Using Ns2. Johanna Antila 51189d TLT

Daniele Messina, Ilenia Tinnirello

Improving the Performance of TCP Using Window Adjustment Procedure and Bandwidth Estimation

Robust Router Congestion Control Using Acceptance and Departure Rate Measures

APPENDIX 1 USER LEVEL IMPLEMENTATION OF PPATPAN IN LINUX SYSTEM

Data Networks Summer 2007 Homework #3

EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science

Congestion Control Review Computer Networking. Resource Management Approaches. Traffic and Resource Management. What is congestion control?

First Midterm for ECE374 03/24/11 Solution!!

Application Level Congestion Control Enhancements in High BDP Networks. Anupama Sundaresan

Applications. Network Application Performance Analysis. Laboratory. Objective. Overview

Oscillations of the Sending Window in Compound TCP

ns-2 Tutorial (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Jianping Wang, 2004 cs757 1 Today

Lecture 15: Congestion Control. CSE 123: Computer Networks Stefan Savage

Evaluation and Comparison of Wired VoIP Systems to VoWLAN

Transport Layer Protocols

Basic Multiplexing models. Computer Networks - Vassilis Tsaoussidis

Chapter 4. VoIP Metric based Traffic Engineering to Support the Service Quality over the Internet (Inter-domain IP network)

TCP and UDP Performance for Internet over Optical Packet-Switched Networks

TCP Behavior across Multihop Wireless Networks and the Wired Internet

TCP, Active Queue Management and QoS

MMPTCP: A Novel Transport Protocol for Data Centre Networks

TCP over Multi-hop Wireless Networks * Overview of Transmission Control Protocol / Internet Protocol (TCP/IP) Internet Protocol (IP)

Performance Evaluation of AQM Techniques in PIM-DM Multicast Network for SRM Protocol

Analysis and Detection of a Denial-of-Service Attack Scenario generated by TCP Receivers to Edge Network

TCP/IP Performance with Random Loss and Bidirectional Congestion

TCP in Wireless Mobile Networks

Optimization of Communication Systems Lecture 6: Internet TCP Congestion Control

Design and analysis of flow aware load balancing mechanisms for multi-service networks

SJBIT, Bangalore, KARNATAKA

Flow aware networking for effective quality of service control

The Interaction of Forward Error Correction and Active Queue Management

Effects of Filler Traffic In IP Networks. Adam Feldman April 5, 2001 Master s Project

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

Achieving QoS for TCP traffic in Satellite Networks with Differentiated Services

VoIP Network Dimensioning using Delay and Loss Bounds for Voice and Data Applications

Comparative Analysis of Congestion Control Algorithms Using ns-2

QoS Strategy in DiffServ aware MPLS environment

The Quality of Internet Service: AT&T s Global IP Network Performance Measurements

Strategies. Addressing and Routing

Master s Thesis. Design, Implementation and Evaluation of

TCP based Denial-of-Service Attacks to Edge Network: Analysis and Detection

A Survey on Congestion Control Mechanisms for Performance Improvement of TCP

Performance evaluation of TCP connections in ideal and non-ideal network environments

Final for ECE374 05/06/13 Solution!!

First Midterm for ECE374 03/09/12 Solution!!

Performance Analysis on VoIP over LTE network Website:

A Passive Method for Estimating End-to-End TCP Packet Loss

Internet Congestion Control for Future High Bandwidth-Delay Product Environments

Active Queue Management

Lecture 16: Quality of Service. CSE 123: Computer Networks Stefan Savage

Servicesin ns-3. Outline SIMULACIÓN DE PROTOCOLOS DE ENRUTAMIENTO PARA REDES MÓVILES AD-HOC MEDIANTE HERRRAMIENTA DE SIMULACIÓN NS-3

PART III. OPS-based wide area networks

Why Congestion Control. Congestion Control and Active Queue Management. Max-Min Fairness. Fairness

Simulation-Based Comparisons of Solutions for TCP Packet Reordering in Wireless Network

Study of Active Queue Management Algorithms ----Towards stabilize and high link utilization

EFFECT OF TRANSFER FILE SIZE ON TCP-ADaLR PERFORMANCE: A SIMULATION STUDY

Master s Thesis. A Study on Active Queue Management Mechanisms for. Internet Routers: Design, Performance Analysis, and.

Answer: that dprop equals dtrans. seconds. a) d prop. b) d trans

PFS scheme for forcing better service in best effort IP network

The Impact of QoS Changes towards Network Performance

A Survey: High Speed TCP Variants in Wireless Networks

Technote. SmartNode Quality of Service for VoIP on the Internet Access Link

Low-rate TCP-targeted Denial of Service Attack Defense

Active Queue Management (AQM) based Internet Congestion Control

Ring Protection: Wrapping vs. Steering

Quality of Service using Traffic Engineering over MPLS: An Analysis. Praveen Bhaniramka, Wei Sun, Raj Jain

Chaoyang University of Technology, Taiwan, ROC. 2 Department of Computer Science and Information Engineering

Performance Modeling of TCP/IP in a Wide-Area Network

Performance improvement of active queue management with per-flow scheduling

A NOVEL RESOURCE EFFICIENT DMMS APPROACH

Computer Networks Homework 1

A Spectrum of TCP-Friendly Window-Based Congestion Control Algorithms

Performance Analysis of AQM Schemes in Wired and Wireless Networks based on TCP flow

THE Transmission Control Protocol (TCP) has proved

Effectiveness of close-loop congestion controls for DDoS attacks

Chapter 3 ATM and Multimedia Traffic

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

Comparison of Wireless Protocols. Paweł Ciepliński

Assessing the Impact of Multiple Active Queue Management Routers

How To Monitor Performance On Eve

Computer Networks - CS132/EECS148 - Spring

A Policy-Based Admission Control Scheme for Voice over IP Networks

Outline. TCP connection setup/data transfer Computer Networking. TCP Reliability. Congestion sources and collapse. Congestion control basics

Tutorial: The ns-2 Network Simulator. Outline. Michael Welzl Institute of Computer Science University of Innsbruck, Austria

Outline. Tutorial: The ns-2 Network Simulator. Some thoughts about network simulation. What to use it for. Michael Welzl

First Midterm for ECE374 02/25/15 Solution!!

CSE 473 Introduction to Computer Networks. Exam 2 Solutions. Your name: 10/31/2013

FEW would argue that one of TCP s strengths lies in its

Quality of Service versus Fairness. Inelastic Applications. QoS Analogy: Surface Mail. How to Provide QoS?

AN IMPROVED SNOOP FOR TCP RENO AND TCP SACK IN WIRED-CUM- WIRELESS NETWORKS

Delay-Based Early Congestion Detection and Adaptation in TCP: Impact on web performance

Exam 1 Review Questions

Introduction. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross

1. The subnet must prevent additional packets from entering the congested region until those already present can be processed.

CROSS LAYER BASED MULTIPATH ROUTING FOR LOAD BALANCING

Gateway Adaptive Pacing for TCP across Multihop Wireless Networks and the Internet*

CH.1. Lecture # 2. Computer Networks and the Internet. Eng. Wafaa Audah. Islamic University of Gaza. Faculty of Engineering

Transcription:

Exercises on ns-2 Chadi BARAKAT INRIA, PLANETE research group 2004, route des Lucioles 06902 Sophia Antipolis, France Email: Chadi.Barakat@sophia.inria.fr November 21, 2003 The code provided between the lines is not complete. You are asked to add your own code. 1 Simulation of a M/D/1 queue Consider a simple network composed of only two nodes (S and D), and one link connecting them. The link connecting the two nodes has a speed of 1Mbps, a propagation delay of 100 ms, and a DropTail buffer at its input of very large size. $ns duplex-link $S $D 1Mb 100ms DropTail $ns queue-limit $S $D 10000 We run on node S a Poisson source of traffic. The destination of the packets being node D. Let λ be the intensity of the Poisson traffic in terms of packets/s. Take λ = 1200 packets/s and set the packet size of the Poisson source to a fixed value 100 bytes. Write the code of a simulation of this scenario, then run the simulation for 1000 seconds. The Poisson source can be created as follows: set udp [new Agent/UDP] $ns attach-agent $S $udp set null [new Agent/Null] $ns attach-agent $D $null $ns connect $udp $null set poisson [new Application/Traffic/Poisson] $poisson attach-agent $udp $ns at 0 $poisson start Don t forget the ns run! 1

Verify the load of the queue. What is the expected load? You get the load from the simulation by computing the total number of packets that leave the queue, then by dividing it by the total number of packets that would leave the queue if the link was busy all time. Use the queue monitor object to obtain the total number of packets that leave the queue. set monitor [$ns monitor-queue $S $D stdout] We focus on the computation of the average queue length. Compute theoretically this average value. Recall that the average queue length in a M/G/1 queue is equal to q = ρ + λ2 E [ σ 2] 2(1 ρ). This average queue length includes the packet in the server (physically, the packet being transmitted). The Queue- Monitor object gives the number of packets waiting in the queue, without counting the packet in the server. You will notice that there is a difference ρ between the theoretical value and the measured value. ρ is the average number of packets occupying the server of the queue. Now validate this average value using your simulation. You need to write a function that samples the queue length many times during the simulation, then you compute the average over all the samples you obtain. proc queuelength {sum number} { global ns monitor set time 0.1 set len [$monitor set pkts ] set now [$ns now] set sum [expr $sum+$len] set number [expr $number+1] puts [expr 1.0*$sum/$number] $ns at [expr $now+$time] "queuelength $sum $number"} $ns at 0 "queuelength 0 0" As a final exercise on this scenario, write in a file the queue size in packets (on two columns, the first one for time, the second one for queue size), and plot this queue size versus time using gnuplot. 2 Simulation of a M/M/1/K queue We want to simulate a M/M/1/K queue. This queue requires that the service time of packets is exponentially distributed. The Poisson source in ns generates packets of constant size, that we fixe at the beginning of the simulation. We overcome this lack by considering a large number of Poisson sources, with the sizes of their packets generated from an exponential random variable. Why aggregating Poisson sources in this way gives a queue close to M/M/1/K? The topology of the network is the same as that in the previous section. The only difference is the packet size at the input of the link S-D, which is now set to a finite value, say for example 20 packets. We want the aggregate traffic to have a total arrival rate λ = 1200 packets/s, and an average packet size equal to 100 2

bytes. Suppose that we aggregate 1000 Poisson sources. The packet arrival rate of each source is then 1.2 packets/s. The packet size of each source is set by sampling an exponential random variable of average 100 bytes. We give now the code that allows to generate the 1000 Poisson sources. Note that the total number of agents we can connect to a node is 256, so we have to connect the 1000 sources (and destinations) to more than one node, then connect these nodes to S (to D). While doing that, ensure that the links between the nodes carrying the sources and S do not impact the results of the simulation. set rng [new RNG] %Random number generator $rng seed 0 set size [new RandomVariable/Exponential] $size set avg 100 $size use-rng $rng for {set i 1} {$i<=4} {set i [expr $i+1]} { set s($i) [$ns node] set d($i) [$ns node] $ns duplex-link $s($i) $S 100Mb 0ms DropTail $ns duplex-link $D $d($i) 100Mb 0ms DropTail for {set j 1} {$j<=250} {set j [expr $j+1]} { set udp($i,$j) [new Agent/UDP] $ns attach-agent $s($i) $udp($i,$j) set null($i,$j) [new Agent/Null] $ns attach-agent $d($i) $null($i,$j) $ns connect $udp($i,$j) $null($i,$j) set poisson($i,$j) [new Application/Traffic/Poisson] $poisson($i,$j) attach-agent $udp($i,$j) $poisson($i,$j) set interval [expr 1.0/1.2] $poisson($i,$j) set size [expr 1.0*[$size value]] $ns at 0 $poisson($i,$j) start } } First, measure the load of the queue and compare it to the expected value (using the variable barrivals of the QueueMonitor object). Second, measure the packet loss rate and the average queue length and compare them to what the analysis gives. To measure the packet loss rate, you need to use the variable pdrops of the QueueMonitor object. Recall that the packet loss rate of a M/M/1/K queue is equal to p = (1 ρ)ρk 1 ρ K+1. The average queue length is equal to q = ρ (K + 1)ρK+1 1 ρ 1 ρ K+1. Using gnuplot, plot the queue length versus time. Repeat the simulation with other seeds for the random number generator. Do you obtain close results? Do you estimate that taking 1000 sources is enough to simulate the M/M/1/K queue? 3

3 TCP with random losses Consider a NewReno TCP connection that crosses a network where packets are dropped with probability p. Let RT T be the round-trip time of the connection, and let rwnd be the receiver advertised window. Denote by S the size of TCP packets in bytes. We set S in this section to 500 bytes. The slow start threshold at the beginning of the connection is set to the receiver window. The receiver is supposed to acknowledge every other packet (delay ACK enabled). The objective of this simulation is to study the performance of TCP in such a scenario, particularly when we change the packet loss probability p. Two approximations exist for TCP throughput in presence of random losses. The first one, called the square root formula, does not account for timeouts, nor for rwnd. It tells that the throughput of TCP is equal to, X = S 3 RT T 4p. The second approximation accounts for timeouts and rwnd. We call it the PFTK formula (in correspondence with the initials of the authors). According to the PFTK formula, the throughput of TCP is equal to X = min rwnd RT T, RT T S ( 4p 3 (1, + 4 min 3 We want to validate these two expressions for TCP throughput using ns-2. ) ). 6p 8 p(1 + 32p 2 ) Consider a simple network similar to that studied in Section 1. A TCP connection is run between S and D (no Poisson traffic). What is the bandwidth-delay product of such a network? Set the receiver window and the slow start threshold to the bandwidth-delay product. set tcp [new Agent/TCP/Newreno] $ns attach-agent $S $tcp set sink [new Agent/TCPSink/DelAck] $ns attach-agent $D $sink $ns connect $tcp $sink $tcp set packetsize 500 $set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 0 "$ftp start" Run the TCP connection for 1000 seconds. According to you, what should be the utilization of the link? What should be the queue size at the input of the link? If the receiver window is set to a very large value, how should we set the buffer at the input of the link in order to fully utilize the available bandwidth? Validate with the simulation your answer about the utilization of the link and the queue size. Add the code the allows you to plot the window size versus time. Plot this window using gnuplot. We insert now on the link between S and D an object that randomly drops TCP packets with probability p. This object belongs to the class ErrorModel. Here is the code: set lossmodel [new ErrorModel] $lossmodel set rate value-of-p 4

$lossmodel unit packet $lossmodel drop-target [new Agent/Null] $set lossylink [$ns link $S $D] $lossylink install-error $lossmodel Plot the congestion window of the TCP connection for the two values of p: 10 4 and 10 2. Interpret the results. Change the packet drop probability p between 5 10 5 and 5 10 1. For each probability, compute the utilization of the link, the utilization given by the square root formula, and the utilization given by the PFTK formula. How does the performance of TCP vary when p increases? Explain. Which one of the two formulas approximates better the throughput of TCP? Where can we consider the square root formula as a good approximation of TCP throughput, and why it does not work in the other regimes? 4 Fairness and TCP-friendliness TCP congestion control aims at avoidance the congestion collapse in the Internet and at imposing fairness between flows. With TCP, all flows sharing the same path and having approximately the same round-trip time are known to realize the same throughput. This is done by detection congestion via packet losses and reacting to packet losses by dividing the congestion window by two. However, TCP is known to suffer when competing for the bandwidth with flows using UDP. What is your explanation for this unfairness when competing with UDP? The purpose of this exercise is to study this fairness issue. Consider the same network as that of Section 2 (1Mbps, 100ms delay, a buffer of 20 packets). Run on this network a New Reno TCP connection of packet size 500 bytes, and of very large receiver window and slow start threshold. Keep this connection running for 1500s. At time 500s, run another TCP connection between S and D for 500s. We want to plot the throughput of both connections as a function of time. We use to this end the flow monitor object described in the course. First we associate a color to both flows (1 and 2): $tcp1 set fid 1 $tcp2 set fid 2 Then we create the flow monitor, we associate it to the buffer, and we get a pointer to its classifier (get the pointer to the classifier couple of seconds after the start of the simulation, you must be sure that at least one packet of each flow have already been monitored). set flowmon [$ns makeflowmon Fid] set L [$ns link $S $D] $ns attach-fmon $L $flowmon set fcl [$flowmon classifier] #Run this at 1 second set flowstats1 [$fcl lookup auto 0 0 1] #And this at 501 seconds set flowstats1 [$fcl lookup auto 0 0 2] 5

Now you can probe the two objects flowstats1 and flowstats2 every 10 seconds, read the number of bytes of each flow that cross the link, divide this number by 10 seconds, compute the throughput, save it in a file, then plot it with gnuplot. What do you conclude? Do both flows share fairly the available bandwidth? Repeat now the simulation but this time with a CBR UDP flow of 800 kbps instead of the second TCP flow. CBR packets are of 500 bytes each. You must create first the UDP agent then the CBR traffic generator: set cbr [new Application/Traffic/CBR] $cbr set packet size 500 $cbr set rate 800kb Do both flows share fairly the available bandwidth? Who is favored in this scenario? 6