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

[ns] Fairness in NS




Hi, I am trying to running a simulation to evaluate the fairness of RED
gateways when 2 of the three TCP's have ECN enabled.

I am finding that the source without ECN is getting far more throughput
than the ECN enabled sources.  Further, the non-ECN source gets only 3
packets dropped whilst the ECN sources get the E bit (congestion
experienced) set at least 10 times each in the simulation.

I have analysed red.cc but still can't find the cause of this.  According
to red.cc, whether a source is ECN capable shouldn't affect the rate at
which its packets are dropped/marked.

I would be grateful for any comments. And have included my code for
reference.

Thank you
Joshua Mentz

#Create a simulator object
set ns [new Simulator]

#Define different colors of data flows for NAM
$ns color 1 blue
$ns color 2 red
$ns color 3 green


#Open the NAM trace file and the queue trace file   
set nf [open sim1.nam w]
$ns namtrace-all $nf


#--------------Define a 'finish' procedure---------------------
proc finish {} {
        	global ns nf f 
        	$ns flush-trace
        	#Close the NAM trace file
        	close $f
		close $nf
        	#Execute NAM on the trace file
        	exec nam.exe sim1.nam &		
        	exit 0				
       	       }

#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]


#-----------CLASS VARIABLE MODIFICATIONS---------------------------

Application/Traffic/Exponential set packetSize_ 1500
Application/Traffic/Exponential set burst_time_ 50ms
Application/Traffic/Exponential set idle_time_ 2ms
Application/Traffic/Exponential set rate_ 100M

Agent/TCP/Sack1 set window_ 30
#Agent/TCP/Sack1 set ecn_ true	
Agent/TCP/Sack1 set packetSize_ 552
Queue/RED set setbit_ true


Queue/RED set thresh_ 10
Queue/RED set maxthresh_ 20
Queue/RED set q_weight_ 0.01
Queue/RED set linterm_ 40
Queue/RED set wait_ true
Queue/RED set gentle_ true
Queue/RED set drop_tail_ false

#Create links between the nodes
$ns duplex-link $n0 $n3 6.312Mb 4ms DropTail
$ns duplex-link $n1 $n3 6.312Mb 4ms DropTail
$ns duplex-link $n2 $n3 6.312Mb 4ms DropTail
$ns duplex-link $n3 $n4 6.312Mb 10ms RED

   
#Set Queue Size of link (n3-n4) to 40 packets
$ns queue-limit $n3 $n4 40


#Give node position (for NAM) 
$ns duplex-link-op $n0 $n3 orient right-down
$ns duplex-link-op $n1 $n3 orient right
$ns duplex-link-op $n2 $n3 orient right-up
$ns duplex-link-op $n3 $n4 orient right

#Monitor the queue for link (n3-n4). (for NAM)
$ns duplex-link-op $n3 $n4 queuePos 0.5

#create queue trace file
set f [open sim1Q.tr w]
$ns trace-queue $n3 $n4 $f

#---------TCP connection 0-------------------------------

set tcp0 [new Agent/TCP/Sack1]			
$ns attach-agent $n0 $tcp0
$tcp0 set ecn_ true

set sink [new Agent/TCPSink/Sack1]
$ns attach-agent $n4 $sink
$ns connect $tcp0 $sink
$tcp0 set fid_ 0


set traf0 [new Application/Traffic/Exponential]
$traf0 attach-agent $tcp0
#$traf0 set interval_ 0.001

#---------TCP connection 1-------------------------------
set tcp1 [new Agent/TCP/Sack1]			
$ns attach-agent $n1 $tcp1
$tcp1 set ecn_ false

set sink [new Agent/TCPSink/Sack1]
$ns attach-agent $n4 $sink
$ns connect $tcp1 $sink
$tcp1 set fid_ 1

set traf1 [new Application/Traffic/Exponential]
$traf1 attach-agent $tcp1

#---------TCP connection 2-------------------------------
set tcp2 [new Agent/TCP/Sack1]			
$ns attach-agent $n2 $tcp2
$tcp2 set ecn_ true

set sink [new Agent/TCPSink/Sack1]
$ns attach-agent $n4 $sink
$ns connect $tcp2 $sink
$tcp2 set fid_ 2

set traf2 [new Application/Traffic/Exponential]
$traf2 attach-agent $tcp2



#-----------------Schedule events----------------------------

$ns at 0.0 "$traf0 start"
$ns at 0.0 "$traf1 start"
$ns at 0.0 "$traf2 start"
$ns at 4.0 "$traf0 stop"
$ns at 4.0 "$traf1 stop"
$ns at 4.0 "$traf2 stop"

$ns at 4.2 "finish"

#Print CBR packet size and interval
#puts "traf rate = [$traf0 set rate_]"
#puts "traf packet size = [$traf0 set packet_size_]"
#puts "traf interval = [$traf0 set interval_]"

#Run the simulation
$ns run