[e2e] RED vs DropTail using NS2
Scheffenegger, Richard
rs at netapp.com
Tue Feb 24 08:19:59 PST 2015
Hi Anjali,
Is this work you are doing out of personal interest, or do you want to write a paper/thesis of some kind around this?
If the latter, why not use one of the modern alternatives to RED, like PIE, Codel or FQ_Codel?
Agreed, it may not be as easy as using the stock code that is in NS-2 for the AQM, and binding it together with a bit of TCL; but it would probably be more relevant nowadays, as RED has many well-known deficiencies, which these newer algorithms try to address...
And global synchronization / biasing was one of the potential objections against plain Codel (due to the deterministic drop/marks under steady conditions; non-simulated environments are probably never that steady for this to become a real problem though).
Best regards,
Richard
> -----Original Message-----
> From: end2end-interest-bounces at postel.org [mailto:end2end-interest-
> bounces at postel.org] On Behalf Of anjali chawla
> Sent: Freitag, 06. Februar 2015 08:49
> To: end2end-interest at postel.org
> Subject: Re: [e2e] RED vs DropTail using NS2
>
> Hi all
> i am sharing my ".tcl" files which shows how RED solves global
> synchronization problem of DropTail (i.e. mutiple connections reducing
> their window at the same time).
> please test with same and tell me whether results are ok or not ???
> or any other improvement which needs to be done further.
> Thanks
>
>
> ####################DropTail.tcl##########################################
> #############################
>
> set ns [new Simulator]
>
>
> # Open NAM trace file
>
> set NumbSrc 1000
> set SimDuration 50
>
> set nf [open droptail.nam w]
> $ns namtrace-all $nf
>
>
> set tf [open droptail.tr w]
> $ns trace-all $tf
>
> # Open TCP cndw trace file
>
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> #$ns at 0.1 "plotWindow $tcp_src($j) $windowVsTime $j"
> set windowVsTime($j) [open wind($j) w]
> }
>
> #set windowVsTime [open wind w]
>
> # Open parameter recording file
> set param [open parametersd w]
>
>
> # Define a 'finish' procedure
> proc finish {} {
> global ns nf tf
>
> $ns flush-trace
> close $nf
> close $tf
> #exec nam droptail.nam &
> exit 0
> }
>
> # Create bottleneck and dest nodes
> set n2 [$ns node]
> set n3 [$ns node]
>
> Queue/RED set bytes_ false
> # default changed on 10/11/2004.
> Queue/RED set queue_in_bytes_ false
> # default changed on 10/11/2004.
> Queue/RED set q_weight_ 0.002
> Queue/RED set thresh_ 40
> Queue/RED set maxthresh_ 80
>
>
>
>
> # Create links between bottleneck nodes
> $ns duplex-link $n2 $n3 0.5Mb 1ms DropTail
> $ns queue-limit $n2 $n3 100
> # #################################################################
>
> # Create $NumbSrc source nodes
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> set S($j) [$ns node]
> }
>
>
> # Create a random generator for starting the ftp and
> # for bottleneck link delays
> set rng [new RNG]
> $rng seed 2
>
> # parameters for random variables for begenning of ftp connections
> set RVstart [new RandomVariable/Uniform]
> $RVstart set min_ 0
> $RVstart set max_ 7
> $RVstart use-rng $rng
>
> # Define random starting times for each connection
> for {set i 1} {$i<=$NumbSrc} { incr i } {
> set startT($i) [expr [$RVstart value]]
> set dly($i) 1
> puts "startT($i) $startT($i) sec"
> puts $param "startT($i) $startT($i) sec"
> }
>
> # Create links between source and bottleneck
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> $ns duplex-link $S($j) $n2 100Mb $dly($j)ms DropTail
> #$ns queue-limit $S($j) $n2 20
> }
>
>
> # Orient the links
> $ns duplex-link-op $n2 $n3 orient right
> $ns duplex-link-op $S(1) $n2 orient right-down
> $ns duplex-link-op $S(2) $n2 orient right
> $ns duplex-link-op $S(3) $n2 orient right-up
>
> # Set Queue Size of (bottleneck) link (n2-n3) to 100
> # $ns queue-limit $n2 $n3 100
>
> # Create TCP Sources
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> set tcp_src($j) [new Agent/TCP]
> $tcp_src($j) set window_ 8000
> }
>
> # Color the packets
> $tcp_src(1) set fid_ 1
> $ns color 1 red
> $tcp_src(2) set fid_ 2
> $ns color 2 yellow
> $tcp_src(3) set fid_ 3
> $ns color 3 blue
>
> # Create TCP Destinations
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> set tcp_snk($j) [new Agent/TCPSink]
> }
>
>
> # Define connections between TCP src's and sinks
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> $ns attach-agent $S($j) $tcp_src($j)
> $ns attach-agent $n3 $tcp_snk($j)
> $ns connect $tcp_src($j) $tcp_snk($j)
> }
>
> # Further parametrisation of TCP sources
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> $tcp_src($j) set packetSize_ 552
> }
>
>
> # Create FTP sources
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> set ftp($j) [$tcp_src($j) attach-source FTP]
> }
>
>
> # Schedule events for the FTP agents:
> for {set i 1} {$i<=$NumbSrc} { incr i } {
> $ns at $startT($i) "$ftp($i) start"
> $ns at $SimDuration "$ftp($i) stop"
> }
>
>
> # plotWindow(tcpSource file k): Write CWND of k tcpSources in file
> proc plotWindow {tcpSource file} {
> global ns
>
> set time 0.1
> set now [$ns now]
> set cwnd [$tcpSource set cwnd_]
> set wnd [$tcpSource set window_]
> puts $file "$now $cwnd"
> $ns at [expr $now+$time] "plotWindow $tcpSource $file"
> }
>
>
> # Start plotWindow() for all tcp sources
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> $ns at 0.1 "plotWindow $tcp_src($j) $windowVsTime($j)"
> }
>
>
> # Monitor avg queue length of link ($n2,$n3)
> set qfile [$ns monitor-queue $n2 $n3 [open queue.tr w] 0.05]
> [$ns link $n2 $n3] queue-sample-timeout;
>
> $ns at [expr $SimDuration] "finish"
>
> # run
> $ns run
> #
> ##########################################################################
> #############
>
> #
>
>
> #
>
>
> #
>
>
>
> #
>
>
> #
>
>
> #
>
>
>
> ##############################################RED.tcl#####################
> ######################
> set ns [new Simulator]
>
>
> # Open NAM trace file
>
> set NumbSrc 1000
> set SimDuration 50
>
> set nf [open red.nam w]
> $ns namtrace-all $nf
>
>
> set tf [open red.tr w]
> $ns trace-all $tf
>
>
>
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> #$ns at 0.1 "plotWindow $tcp_src($j) $windowVsTime $j"
> set windowVsTime($j) [open wind($j) w]
> }
>
> #set windowVsTime [open wind w]
>
>
> # Open parameter recording file
> set param [open parametersred w]
>
>
> # Define a 'finish' procedure
> proc finish {} {
> global ns nf tf
>
> $ns flush-trace
> close $nf
> close $tf
> #exec nam droptail.nam &
> exit 0
> }
>
> # Create bottleneck and dest nodes
> set n2 [$ns node]
> set n3 [$ns node]
>
> Queue/RED set bytes_ false
> # default changed on 10/11/2004.
> Queue/RED set queue_in_bytes_ false
> # default changed on 10/11/2004.
> Queue/RED set q_weight_ 0.002
> Queue/RED set thresh_ 40
> Queue/RED set maxthresh_ 80
>
>
>
>
>
> # Create links between bottleneck nodes
> $ns duplex-link $n2 $n3 0.5Mb 1ms RED
> $ns queue-limit $n2 $n3 100
>
>
>
> # Create $NumbSrc source nodes
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> set S($j) [$ns node]
> }
>
>
> # Create a random generator for starting the ftp and
> # for bottleneck link delays
> set rng [new RNG]
> $rng seed 2
>
>
> # parameters for random variables for begenning of ftp connections
> set RVstart [new RandomVariable/Uniform]
> $RVstart set min_ 0
> $RVstart set max_ 7
> $RVstart use-rng $rng
>
>
> # Define random starting times for each connection
> for {set i 1} {$i<=$NumbSrc} { incr i } {
> set startT($i) [expr [$RVstart value]]
> set dly($i) 1
> puts "startT($i) $startT($i) sec"
> puts $param "startT($i) $startT($i) sec"
> }
>
> # ####################################################################
> # Create links between source and bottleneck
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> $ns duplex-link $S($j) $n2 100Mb $dly($j)ms DropTail
> #$ns queue-limit $S($j) $n2 20
> }
>
>
> # ####################################################################
> # Orient the links
> $ns duplex-link-op $n2 $n3 orient right
> $ns duplex-link-op $S(1) $n2 orient right-down
> $ns duplex-link-op $S(2) $n2 orient right
> $ns duplex-link-op $S(3) $n2 orient right-up
>
> # ####################################################################
> # Set Queue Size of (bottleneck) link (n2-n3) to 100
> # $ns queue-limit $n2 $n3 100
>
> # ####################################################################
> # Create TCP Sources
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> set tcp_src($j) [new Agent/TCP]
> $tcp_src($j) set window_ 8000
> }
>
> # ####################################################################
> # Color the packets
> $tcp_src(1) set fid_ 1
> $ns color 1 red
> $tcp_src(2) set fid_ 2
> $ns color 2 yellow
> $tcp_src(3) set fid_ 3
> $ns color 3 blue
>
> # ####################################################################
> # Create TCP Destinations
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> set tcp_snk($j) [new Agent/TCPSink]
> }
>
> # ####################################################################
> # Define connections between TCP src's and sinks
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> $ns attach-agent $S($j) $tcp_src($j)
> $ns attach-agent $n3 $tcp_snk($j)
> $ns connect $tcp_src($j) $tcp_snk($j)
> }
>
> # ####################################################################
> # Further parametrisation of TCP sources
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> $tcp_src($j) set packetSize_ 552
> }
>
>
> # Create FTP sources
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> set ftp($j) [$tcp_src($j) attach-source FTP]
> }
>
> # Schedule events for the FTP agents:
> for {set i 1} {$i<=$NumbSrc} { incr i } {
> $ns at $startT($i) "$ftp($i) start"
> $ns at $SimDuration "$ftp($i) stop"
> }
>
>
> # plotWindow(tcpSource file k): Write CWND of k tcpSources in file
> proc plotWindow {tcpSource file} {
> global ns
>
> set time 0.1
> set now [$ns now]
> set cwnd [$tcpSource set cwnd_]
> set wnd [$tcpSource set window_]
> puts $file "$now $cwnd"
> $ns at [expr $now+$time] "plotWindow $tcpSource $file"
> }
>
>
> # Start plotWindow() for all tcp sources
> for {set j 1} {$j<=$NumbSrc} { incr j } {
> $ns at 0.1 "plotWindow $tcp_src($j) $windowVsTime($j)"
> }
>
>
> # Monitor avg queue length of link ($n2,$n3)
> set qfile [$ns monitor-queue $n2 $n3 [open queue.tr w] 0.05]
> [$ns link $n2 $n3] queue-sample-timeout;
>
>
>
> # Schedule simulation end
> $ns at [expr $SimDuration] "finish"
>
>
> # run
> $ns run
> # ####################################################################
>
> On Thu, Feb 5, 2015 at 12:28 PM, anjali chawla
> <anjaliachawla013 at gmail.com>
> wrote:
>
> > Hi all
> > i am sharing my ".tcl" files which shows how RED solves global
> > synchronization problem of DropTail (i.e. mutiple connections reducing
> > their window at the same time).
> > please test with same and tell me whether results are ok or not ???
> > or any other improvement which needs to be done further.
> > Thanks
> >
> > On Tue, Jan 6, 2015 at 12:51 PM, anjali chawla
> <anjaliachawla013 at gmail.com
> > > wrote:
> >
> >> Thank you all for your valuable suggestions.
> >> @Gyuyeong , link told by you contains some useful points.
> >> @Tom Henderson, i found http://www.icir.org/floyd/red.html#ns very
> >> useful.
> >> For sure i will try with these scripts.May b i can get some useful
> >> results .
> >> Thanks a lot.
> >>
> >>
> >>
> >> On Mon, Jan 5, 2015 at 3:21 AM, Detlef Bosau <detlef.bosau at web.de>
> wrote:
> >>
> >>> I'm not quite sure why you see RED and DropTail alternatively and want
> >>> to use ONLY RED.
> >>>
> >>> Detlef
> >>>
> >>> Am 03.01.2015 um 07:31 schrieb anjali chawla:
> >>> > Hi
> >>> > i want to prove that RED is better than DropTail using NS2. i have
> >>> followed
> >>> > "Random Early Detection Gateways for Congestion Avoidance,1993 "
> paper
> >>> > also. For showing RED solves global synchronization problem,bias
> againt
> >>> > bursty traffic,
> >>> > i tried a lot using tcl script making different scenarios. But no
> >>> useful
> >>> > results at all.
> >>> > In my case packet loss is more in RED than DropTail.
> >>> > somenone please help
> >>> > _______________________________________________
> >>> > end2end-interest mailing list
> >>> > end2end-interest at postel.org
> >>> > http://mailman.postel.org/mailman/listinfo/end2end-interest
> >>> > Contact list-owner at postel.org for assistance.
> >>>
> >>>
> >>> --
> >>> ------------------------------------------------------------------
> >>> Detlef Bosau
> >>> Galileistraße 30
> >>> 70565 Stuttgart Tel.: +49 711 5208031
> >>> mobile: +49 172 6819937
> >>> skype: detlef.bosau
> >>> ICQ: 566129673
> >>> detlef.bosau at web.de http://www.detlef-bosau.de
> >>>
> >>>
> >>
> >
> _______________________________________________
> end2end-interest mailing list
> end2end-interest at postel.org
> http://mailman.postel.org/mailman/listinfo/end2end-interest
> Contact list-owner at postel.org for assistance.
More information about the end2end-interest
mailing list