Studying TCP's Throughput and Goodput using NS
来源:互联网 发布:gta5捏脸贝克汉姆数据 编辑:程序博客网 时间:2024/05/17 05:10
Studying TCP's Throughput and Goodput using NS
- What is Throughput
- Throughput is the amount of data received by the destination.
- The Average Throughput is the throughput per unit of time
- Example:
Suppose a TCP receiver receives 60 M Bytes of data in 1 min, then:
- The throughput of the period is 60 M Bytes
- The average throughput is 60 M Bytes/min or 1 M Bytes/sec
- Two kinds of Throughput
- There are 2 kinds of throughputs in networking:
- Indiscriminant throughput (= the average amount data received by the receiver per unit time, regardless of whether the data is retransmission or not).
- Good throughput (= the average amount data received by the receiver per unit time that are NOT retransmissions).
- The first kind of throughput is known as throughput in network literature.
- The second kind of throughput is known as goodput in network literature.
- There are 2 kinds of throughputs in networking:
- Obtaining Throughput and Goodput information in NS simulations
- Techniques to obtain the different throughput information in NS:
- The (indiscrimant) throughput information is obtained from trace information from queues in links obtained during the NS simulation run.
- The goodput information is obtained by attaching a trace application to the TCP Sink (receiving) Agent
- We will first look at how to obtain (indiscrimant) throughput information next
- Further down in this webpage (see: clickhere ), we will look at how to obtain goodput information
- Techniques to obtain the different throughput information in NS:
- Obtain Throughput information from Trace Information of Queues
- First, you make tell NS to print out trace information of a queue in a link, using:
$ns trace-queue $src_node $dest_node $output_file
This will instruct NS to write packet arriving activities on the link ($src_node, $dest_node) to the output file $output_file
- Example:
set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 2Mb 10ms DropTail set trace_file [open "out.tr" w] $ns trace-queue $n0 $n1 $trace_file
- The output file has the following format:
- Most important informations in the trace record:
- Each line of the trace file corresponds to one event of packet activity
- The first character of one trace record indicates the action:
- +: a packet arrives at a queue (it may or may not be dropped !)
- -: a packet leaves a queue
- r: a packet is received into a queue (buffered)
- d: a packet is dropped from a queue
- The last 4 fields contains:
- source id: id of sender (format is: x.y = node x and transport agent y)
- receiver id: id of receiver (format is: x.y = node x and transport agent y)
- sequence number: useful to determine if packet was new or a retransmission
- packet id: is always increasing - usefule to determine the number of packets lossed.
- The packet size contains the number of bytes in the packet
- Sample trace output:
- Trace record shows an arrival of a packet from TCP source 0 attached at node 0, for TCP destination 0 attached at node 4
- The size of this packet is 592 bytes.
+ 0.311227 3 4 tcp 592 ------- 0 0.0 4.0 0 0 - 0.311227 3 4 tcp 592 ------- 0 0.0 4.0 0 0 r 0.351867 3 4 tcp 592 ------- 0 0.0 4.0 0 0
- To compute the throughput, do:
- Trace the last hop link of the destination.
- Look for receive (r) events in the trace file.
- Look for the correct source and destination pair
- Add up all the packet sizes in the receive events
- First, you make tell NS to print out trace information of a queue in a link, using:
- Example Tracing TCP Throughput
- Recall the network simulated:
- Note that the last link to the destination is (n3, n4)
- The following addition is made to the Reno script to get trace data to the destination:
#Make a NS simulator set ns [new Simulator] # Define a 'finish' procedure proc finish {} { exit 0 } # Create the nodes: set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] set n4 [$ns node] set n5 [$ns node] # Create the links: $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns duplex-link $n2 $n3 0.3Mb 200ms DropTail $ns duplex-link $n3 $n4 0.5Mb 40ms DropTail $ns duplex-link $n3 $n5 0.5Mb 30ms DropTail # Add a TCP sending module to node n0 set tcp1 [new Agent/TCP/Reno] $ns attach-agent $n0 $tcp1 # Add a TCP receiving module to node n4 set sink1 [new Agent/TCPSink] $ns attach-agent $n4 $sink1 # Direct traffic from "tcp1" to "sink1" $ns connect $tcp1 $sink1 # Setup a FTP traffic generator on "tcp1" set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ftp1 set type_ FTP (no necessary) # Schedule start/stop times $ns at 0.1 "$ftp1 start" $ns at 100.0 "$ftp1 stop" # Set simulation end time $ns at 125.0 "finish" (Will invoke "exit 0") ################################################## ## Obtain Trace date at destination (n4) ################################################## set trace_file [open "out.tr" w] $ns trace-queue $n3 $n4 $trace_file # Run simulation !!!! $ns run
- Example Program: (Demo above code)
- Prog file: click here
Run progran with NS and you will get a trace file
- Recall the network simulated:
- Processing the Trace File
- Take a look at the output trace file "out.tr":
- + 0.311227 3 4 tcp 40 ------- 0 0.0 4.0 0 0 (@ 0.311227 sec: 40 bytes of TCP data arrives at node 3) - 0.311227 3 4 tcp 40 ------- 0 0.0 4.0 0 0 (@ 0.311227 sec: 40 bytes of TCP data departed from node 3)r 0.351867 3 4 tcp 40 ------- 0 0.0 4.0 0 0 (@ 0.351867 sec: 40 bytes of TCP data is received by node 4)+ 0.831888 3 4 tcp 592 ------- 0 0.0 4.0 1 2 (@ 0.831888 sec: 592 bytes of TCP data arrives at node 3) - 0.831888 3 4 tcp 592 ------- 0 0.0 4.0 1 2 (@ 0.831888 sec: 592 bytes of TCP data departed from node 3)+ 0.847675 3 4 tcp 592 ------- 0 0.0 4.0 2 3 (@ 0.847675 sec: 592 bytes of TCP data arrives at node 3) - 0.847675 3 4 tcp 592 ------- 0 0.0 4.0 2 3 (@ 0.847675 sec: 592 bytes of TCP data departed from node 3)r 0.88136 3 4 tcp 592 ------- 0 0.0 4.0 1 2 (@ 0.88136 sec: 592 bytes of TCP data is received by node 4)r 0.897147 3 4 tcp 592 ------- 0 0.0 4.0 2 3+ 1.361381 3 4 tcp 592 ------- 0 0.0 4.0 3 6- 1.361381 3 4 tcp 592 ------- 0 0.0 4.0 3 6+ 1.377168 3 4 tcp 592 ------- 0 0.0 4.0 4 7- 1.377168 3 4 tcp 592 ------- 0 0.0 4.0 4 7+ 1.392955 3 4 tcp 592 ------- 0 0.0 4.0 5 8- 1.392955 3 4 tcp 592 ------- 0 0.0 4.0 5 8+ 1.408741 3 4 tcp 592 ------- 0 0.0 4.0 6 9- 1.408741 3 4 tcp 592 ------- 0 0.0 4.0 6 9r 1.410853 3 4 tcp 592 ------- 0 0.0 4.0 3 6
- Computing the throughput received in each time interval is nothing more than tallying the total number of bytes received in each interval.
- Example:
- From the above trace file, we can tally the number of bytes received in the first second of interval time by adding the packet sizes that are received in the first second.
These are the packets that are received by TCP entity "4.0" in the first second:
- r 0.351867 3 4 tcp 40 ------- 0 0.0 4.0 0 0r 0.88136 3 4 tcp 592 ------- 0 0.0 4.0 1 2r 0.897147 3 4 tcp 592 ------- 0 0.0 4.0 2 3
The total number of bytes received in the first second is therefore:
- 40 + 592 + 592 = 1224 bytes
or:
- 1224 × 8 = 9792 bits
So the throughput in the first second is 9792 bits/sec = 0.009792 Mbps
Repeat the process for the second second, and so on...
You do NOT want to do that by hand...
- You need to write a program to identify the correct source, destination pair and add up all the packet size...
- Someone has done that !!!
- Here is a PERL program that can be used to process trace files: click here
Save it and run as using:
perl throughput.pl trfile destNode srcNode.port# destNode.port# \ time-granularity
Time-granularity let you compute the throughput over time intervals, each interval will have the size given by the time-granularity
- Example:
You can use the following command to get average throughput data from the trace file obtained in the NS script above:
perl throughput.pl out.tr 4 0.0 4.0 1 > out
We need to use these parameters to extract the throughput data because of:
- 4 is the node ID
- 0.0 is the ID of the TCP source
- 4.0 is the ID of the TCP sink
- The parameter "out.tr" is the input filename
- The parameter "1" is interval size (here: interval size is 1 second)
r 0.351867 3 4 tcp 592 ------- 0 0.0 4.0 0 0
- The throughput.pl script will create an output file that is suitable for plotting.
To plot the progressing of average throughput, use gnuplot:
gnuplot >> plot "out" using 1:2 title "TCP throughput" with lines 1
Goodput..... - Take a look at the output trace file "out.tr":
- The difference between Throughput and Goodput
- Consider the following receive events in the trace file that happens between 3 and 4 seconds (you can obtain the trace file when running the example program: click here )
- r 3.01512 3 4 tcp 592 ------- 0 0.0 4.0 32 63r 3.030907 3 4 tcp 592 ------- 0 0.0 4.0 33 64r 3.046693 3 4 tcp 592 ------- 0 0.0 4.0 34 65r 3.06248 3 4 tcp 592 -------
- Consider the following receive events in the trace file that happens between 3 and 4 seconds (you can obtain the trace file when running the example program: click here )
- Studying TCP's Throughput and Goodput using NS
- Understanding Throughput and TCP Windows
- Activity, Throughput, and Load
- using namespace [ns]与 using [ns]区别
- Little's Law: Latency & Throughput
- Path loss, Range and Throughput
- Shuffle Latency and throughput 对比
- +++++Understanding oracle IOPS and Throughput
- Wireless Throughput Calculations and Limitations
- process communication by using pipe and tcp
- Using Swing's Pluggable Look and Feel
- Who's Using Cyberthreat Intelligence and How?
- Running Ns and Nam Under Windows 9x/2000/XP Using Cygwin
- throughput test result about ovs and VyOS
- Maximizing BLE Throughput on iOS and Android
- Comparative 11n throughput and range
- Reverse linked list using stack and stack's implementation
- Fourth calibration example - Calibration using Bakstein and Halir's data
- 索引注意
- C语言总结之const
- [Win8] 右键 新建菜单不见了
- 当ViewPager嵌套在ScrollView/ListView里时,手势冲突如何处理?
- php 介绍
- Studying TCP's Throughput and Goodput using NS
- 二分使第K个数尽量大--poj2010
- 避免Java应用中空指针异常的技巧和最佳实践
- mysql介绍
- iconv 文件编码转换
- CentOS软件包管理相关整理
- 一致性 hash 算法( consistent hashing )
- mysql数据库导出数据结构和数据的方法
- 使用PHP生成带LOGO的个性化二维码图像