Subject: [Tsvwg] Inquire problem about TFRC

From: "Lv Qian" <[email-masked]>
Date: Thu, 17 Jun 2004 12:35:59 +0800

tcpmHi, all,
I met a problem when doing simulation on TFRC these days. I am using ns-2.26, Redhat 9.0, and all NS2 valication tests are passed.
I want to test the friendliness among some TFRC flows in the bottleneck link. The topology is very simple(the parameters such as bandwidth, queue is listed in the script below).
                       s0        k0
                        |        |
                s1 --- r1 ------ r2 --- k1
                        |        |
	                   s2        k2
However, when I use awk to get the throughput data of each flow, I found that when time < 300, the simulation result is satisfactory; however, when time >300, one flow increases abruptly while other flows descend to nearly zero. This is abnormal. I tested other scripts, including the test-suite-friendly.tcl/two-friendly script in ns-2.26/tcl/test. When I changed the relevant bandwidth parameters and simulation time to nearly 1000s, I got the similar result.  

The tfrcsim.tcl script is as follows:
########################################################
set flows 4
set queue  RED
set rate 15
#set ecn 1
set ecn 0
set discount 0

set ns [new Simulator]

proc stop {} {
       global ns s1_tf
       $ns flush-trace
       close $s1_tf
       exit 0
}

set node_(r1) [$ns node]
set node_(r2) [$ns node]
Queue/RED set gentle_ true
if {$ecn==1} {
  Queue/RED set setbit_ true
  Agent/TCP set ecn_ 1
}

$ns duplex-link $node_(r1) $node_(r2) [set rate]Mb 20ms $queue
$ns queue-limit $node_(r1) $node_(r2) 50
$ns queue-limit $node_(r2) $node_(r1) 50

Agent/TFRC set packetSize_ 1000
Agent/TFRCSink set discount_ $discount
Agent/TFRCSink set printLoss_ 1
Agent/TFRCSink set smooth_ 1
Agent/TFRC set printStatus_ 0
Agent/TFRC set df_ 0.95
Agent/TFRC set ca_ 1

for {set i 0} {$i < 3} {incr i} {
    set node_(s$i) [$ns node]
    set node_(k$i) [$ns node]
    $ns duplex-link $node_(s$i) $node_(r1) 100Mb 2ms DropTail
    $ns duplex-link $node_(k$i) $node_(r2) 100Mb 2ms DropTail
    set tf$i [$ns create-connection TFRC $node_(s$i) TFRCSink $node_(k$i) 0]
    set sec [expr $i/10]
    set frac [expr $i%10]
    set starttime $sec.$frac

    $ns at $starttime "[set tf$i] start"
    $ns at 1000 "[set tf$i] stop"
}

set s1_tf [open out.tr w]
$ns trace-queue $node_(r1) $node_(r2) $s1_tf

$ns at 1005 "stop"

$ns run
######################################################

Is there something wrong in my script? Or is there some bugs in the TFRC code in NS2? I am suffered for this problem these days. Can any one help me to solve it? Thank you!

Regards,
Lv Qian (SCE, NTU)
2004-06-17

_______________________________________________
tsvwg mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/tsvwg

---

From: Sally Floyd <[email-masked]>
Date: Thu, 17 Jun 2004 13:51:09 -0700

This is a classic case of phase effects.  You could look at
the 1992 paper "On Traffic Phase Effects in Packet-Switched Gateways",
available from "http://www.icir.org/floyd/papers.html".

One solution is to add some randomization in the form of
"overhead_", which dithers TFRC's outgoing packets:
  Agent/TFRC set overhead_ 1

>From tfrc.cc:
                next = size_/xrate;
                //
                // randomize between next*(1 +/- overhead_)
                //
                next = next*(2*overhead_*Random::uniform()-overhead_+1);

Other solutions are to use more realistic scenarios, including
competing TCP traffic, with some web traffic, and reverse-path
traffic (to include small Ack packets in the forward path).

I am enclosing a modified script below.  Instead of using a long
trace file, I modified the script to have NS print out the packet
information that was wanted.

The results can be displayed as follows:

./ns tfrcsim.tcl > data
awk '{if ($4==0) {print $2, $6;}}' data > data.0
awk '{if ($4==1) {print $2, $6;}}' data > data.1
awk '{if ($4==2) {print $2, $6;}}' data > data.2
xgraph -bb -tk -x time -y packets data.0 data.1 data.2 &

There is still a brief period with phase effects, but it is much more 
moderate than before.

You also might be interested in the paper "Internet Research Needs
Better Models", available from
"http://www.icir.org/models/bettermodels.html.

- Sally
http://www.icir.org/floyd/

====================================================================
tfrcsim.tcl (the modified version)
====================================================================
set flows 4
set queue  RED
set rate 15
#set ecn 1
set ecn 0
set discount 0

set ns [new Simulator]

proc stop {} {
       global ns 
       exit 0
}

proc printpkts { time flowid flow } {
       puts "time $time tfrc $flowid data_pkts_sent [$flow set ndatapack_]"
}

set node_(r1) [$ns node]
set node_(r2) [$ns node]

Agent/TFRC set packetSize_ 1000
Agent/TFRCSink set discount_ $discount
#Agent/TFRCSink set printLoss_ 1
Agent/TFRCSink set printLoss_ 0
Agent/TFRCSink set smooth_ 1
Agent/TFRC set printStatus_ 0
Agent/TFRC set df_ 0.95
Agent/TFRC set ca_ 1

#Agent/TFRC set overhead_ 0 
Agent/TFRC set overhead_ 1

    $ns at $starttime "[set tf$i] start"
    for {set time 0} {$time <= 1000} {incr time} {
   	 $ns at $time "printpkts $time $i [set tf$i]"
    }
    $ns at 1000 "[set tf$i] stop"
}

$ns at 1005 "stop"

$ns run