[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Why 1 TCP source get more bandwidth than others in my script?



Hi.

My simulation topology is...

S1----|                                      |-----R1
          |                                      |
S2----|------G0-------G1------|-----R2
.         |                                      |        .
.         |                                      |        .
.         |                                      |        .
S20---|                                      |-----R20

All links are 10Mbps and 10msec delay and Drop tail

Here are the results
---------------------------------------------------------------
ns app.tcl
processing output ...
Goodput per source:
Goodput for source 0 : 330.20689655172413 kb/s
Goodput for source 1 : 2337.1034482758619 kb/s
Goodput for source 2 : 414.89655172413791 kb/s
Goodput for source 3 : 485.51724137931035 kb/s
Goodput for source 4 : 336.0 kb/s
Goodput for source 5 : 392.27586206896552 kb/s
Goodput for source 6 : 311.17241379310343 kb/s
Goodput for source 7 : 426.48275862068965 kb/s
Goodput for source 8 : 404.13793103448273 kb/s
Goodput for source 9 : 395.58620689655174 kb/s
Goodput for source 10 : 458.20689655172413 kb/s
Goodput for source 11 : 373.51724137931035 kb/s
Goodput for source 12 : 536.55172413793105 kb/s
Goodput for source 13 : 398.34482758620692 kb/s
Goodput for source 14 : 399.44827586206895 kb/s
Goodput for source 15 : 359.17241379310343 kb/s
Goodput for source 16 : 402.75862068965517 kb/s
Goodput for source 17 : 416.27586206896552 kb/s
Goodput for source 18 : 406.34482758620692 kb/s
Goodput for source 19 : 327.17241379310343 kb/s
---------------------------------------------------------------

Following are my code
----myapp.tcl----
Class TraceApp -superclass Application

TraceApp instproc init {args} {
   $self instvar bytes_
   $self instvar tempbytes
   $self set bytes_ 0
   $self set tempbytes 0
   eval $self next $args
}

TraceApp instproc recv {byte} {
   global ns
   $self instvar tempbytes
   set now [$ns now]
   
   $self instvar bytes_
   set bytes_ [expr $bytes_ + $byte]
   
   return $bytes_
}

TraceApp instproc get_bytes {} {
   $self instvar bytes_
   return $bytes_
}

TraceApp instproc reset {} {
   $self instvar bytes_
   set bytes_ 0
}

set NUM  20

set START 0
set END  30.0
set END_FILE 30.1
set WINDOWSIZE 20
set PACKETSIZE 1000
set WARMUP 1.0

set f [open out.tr w]
for {set i 0} {$i < $NUM} {incr i} {
 set fd($i) [open out-tcp$i.tr w]
 set cfd($i) [open out-ctcp$i.tr w]
}

set ns [new Simulator]
for {set i 0} {$i < $NUM} {incr i} {
 set s($i) [$ns node]
}
for {set i 0} {$i < $NUM} {incr i} {
 set r($i) [$ns node]
}
set g0 [$ns node]
set g1 [$ns node]

$ns duplex-link $g0 $g1 10.0Mb 0.01ms DropTail
for {set i 0} {$i < $NUM} {incr i} {
 $ns duplex-link $s($i) $g0 10.0Mb 10.0ms DropTail
}
for {set i 0} {$i < $NUM} {incr i} {
 $ns duplex-link $r($i) $g1 10.0Mb 10.0ms DropTail
}

# trace the bottleneck queue 
$ns trace-queue $g0 $g1 $f

Agent/TCP set window_ $WINDOWSIZE
Agent/TCP set packetSize_ $PACKETSIZE
for {set i 0} {$i < $NUM} {incr i} {
 set tcp($i) [new Agent/TCP]
 $ns attach-agent $s($i) $tcp($i)
 set ftp($i) [new Application/FTP]
 $ftp($i) attach-agent $tcp($i)
}
for {set i 0} {$i < $NUM} {incr i} {
 $tcp($i) set class_ $i
}
for {set i 0} {$i < $NUM} {incr i} {
 set sink($i) [new Agent/TCPSink]
 $ns attach-agent $r($i) $sink($i)
 set counter($i) [new TraceApp]
 $counter($i) attach-agent  $sink($i)
}
for {set i 0} {$i < $NUM} {incr i} {
 $ns connect $tcp($i) $sink($i)
}
for {set i 0} {$i < $NUM} {incr i} {
 $ns at $WARMUP "$counter($i) start"
}

#start
for {set i 0} {$i < $NUM} {incr i} {
 $ns at 0.0 "$ftp($i) start"
}

$ns at $END_FILE "finish"

#Record for drawing Xgraph
$ns at 0.0 "record"
proc record {} {
 global tcp sink fd cfd NUM
 set ns [Simulator instance]
 for {set i 0} {$i < $NUM} {incr i} {
  set seqno [$tcp($i) set t_seqno_]
  set cwnd [$tcp($i) set cwnd_]
  set now [$ns now]
  puts $fd($i) "$now $seqno"
  puts $cfd($i) "$now $cwnd"
 }
 $ns at [expr $now+0.01] "record"
}

proc finish {} {
 global ns f NUM counter END WARMUP
 $ns flush-trace
 close $f
 puts "processing output ..."
 exec cat out.tr | awk -f finish.awk > out

 puts "Goodput per source:"
 for {set i 0} {$i < $NUM} {incr i} {
  set bytes [$counter($i) get_bytes]
  set rate [expr $bytes*8/(1000*($END-$WARMUP))]
  puts "Goodput for source $i : $rate kb/s"
 }
     exit 0
}

$ns run

---------------------------------------------------------------

I don't know what this situlation is happen.

Thanks a lot in advance,
And with best regards...

--
Young S.Choi
mailto:[email protected]
ICQ : 93158371 
http://tenet2.knu.ac.kr/~guru0109
/"\ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
\ /   ASCII Ribbon Campaign  . Windows: "Where do you want to go today?"
 X  - NO HTML/RTF in e-mail  . Linux: "Where do you want to go tomorrow?"
/ \ - NO Word docs in e-mail . BSD: "Are you guys coming or what?"