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

[ns] Queue size obtained by Flowmon & from RED not the same.




Hi, 

I set up a simple simulation using RED, by sending a TCP and a UDP flow thru' a
common link ( R2 -R3).  ( TCP starts at 10 sec, UDP starts at 50sec) .I wrote a
proc  to get the average and current queue szie in RED. At the same time I set
up a queue monitor too, to get the packet dropped and queue size as well.
After looking at the data from both monitors ...   I found out that the current
queue size from RED and Queue Monitor sometimes doesn't match. Since they are
monitor the same link , it should match right???  


The following is my code:

=============================================================
Simulator instproc get-link {node1 node2} {
	$self instvar link_
	set id1 [$node1 id]
	set id2 [$node2 id]
	return $link_($id1:$id2)
}


set l [$ns get-link $R2 $R3]
set qred [$l queue]



# write RED information
# linterm_  --> dropping pobability varies from 0 to 1/linterm_
# ave_  --> average queue size
# curq_ --> current queue size
# prob1_  --> dropping pobability

proc avgqueue {qred} {
	global ns avg status redq
	
	set maxpr [$qred set linterm_]   
	set egz [$qred set ave_]
	set cur [$qred set curq_]
	set prob [$qred set prob1_]
	set curt [$ns now]
	
	puts $redq [format "%9.3f %9.3f %9.3f %9.3f %9.3f" $curt $egz $cur $prob	$maxpr]
	
}


# set up queue monitor

set qlink [$ns link $R2 $R3]
set qmon [$qlink queue]
set qlnk [$ns monitor-queue $R2 $R3 $qmon]


# write queue size (link) to file
# format : Time; current queue size; packets dropped; packets arrived; 
#	   packets departed.


proc lnkqueue {qlnk} {
	global ns linkq status
	
	set cur [$qlnk set pkts_]
	set pdrop [$qlnk set pdrops_]
	set parrv [$qlnk set parrivals_]
	set pdep [$qlnk set pdepartures_]
	set curt [$ns now]
	
	puts $linkq [format "%9.3f %9.3f %9.3f %9.3f %9.3f" $curt $cur $pdrop $parrv $pdep]
}


===============================================================

I have attached the data file (extract of where it all went wrong).


extract from RED monitor:
  
   Time	     avg.      Current    Drop      literm_
   	     Queue     Queue      Prob.
=====================================================   
   12.000    45.537    91.000     0.035     4.000
   12.100    47.234    91.000     0.045     4.000
   12.200    48.842    90.000     0.055     4.000
   12.300    50.364    89.000     0.065     4.000
   12.400    51.712    88.000     0.073     4.000
   12.500    53.050    87.000     0.082     4.000
   12.600    53.317    85.000     0.083     4.000
   12.700    53.317    85.000     0.083     4.000
   12.800    53.317    85.000     0.083     4.000
   12.900    53.317    85.000     0.083     4.000
   13.000    53.317    85.000     0.083     4.000
   13.100    53.317    85.000     0.083     4.000
   13.200    53.317    85.000     0.083     4.000
   13.300    53.317    85.000     0.083     4.000
   13.400    53.317    85.000     0.083     4.000
   13.500    53.317    85.000     0.083     4.000
   13.600    53.317    85.000     0.083     4.000
   13.700    53.317    85.000     0.083     4.000
   13.800    53.317    85.000     0.083     4.000
   13.900    53.317    85.000     0.083     4.000
   14.000    53.317    85.000     0.083     4.000
   14.100    53.317    85.000     0.083     4.000
   14.200    53.317    85.000     0.083     4.000
   14.300    53.317    85.000     0.083     4.000
   14.400    53.317    85.000     0.083     4.000
   14.500    17.587     0.000     0.083     4.000
   14.600    16.285     3.000     0.083     4.000
   14.700    15.617    11.000     0.083     4.000
   14.800    15.616    17.000     0.083     4.000
   14.900    15.684    18.000     0.083     4.000
   15.000    15.766    18.000     0.083     4.000
   


extract from Queue Monitor:
    
   Time	    Current    Packet   Packet    Packet
   	    Queue      Dropped  Arrived   Departed
=====================================================   

   12.000    91.000     1.000   451.000   359.000
   12.100    91.000     1.000   470.000   378.000
   12.200    91.000     2.000   489.000   396.000
   12.300    90.000     3.000   508.000   415.000
   12.400    88.000     4.000   526.000   434.000
   12.500    87.000     5.000   545.000   453.000
   12.600    73.000     5.000   549.000   471.000
   12.700    54.000     5.000   549.000   490.000
   12.800    35.000     5.000   549.000   509.000
   12.900    16.000     5.000   549.000   528.000
   13.000     0.000     5.000   549.000   544.000
   13.100     0.000     5.000   549.000   544.000
   13.200     0.000     5.000   549.000   544.000
   13.300     0.000     5.000   549.000   544.000
   13.400     0.000     5.000   549.000   544.000
   13.500     0.000     5.000   549.000   544.000
   13.600     0.000     5.000   549.000   544.000
   13.700     0.000     5.000   549.000   544.000
   13.800     0.000     5.000   549.000   544.000
   13.900     0.000     5.000   549.000   544.000
   14.000     0.000     5.000   549.000   544.000
   14.100     0.000     5.000   549.000   544.000
   14.200     0.000     5.000   549.000   544.000
   14.300     0.000     5.000   549.000   544.000
   14.400     0.000     5.000   549.000   544.000
   14.500     0.000     5.000   552.000   547.000
   14.600     2.000     5.000   564.000   557.000
   14.700    11.000     5.000   592.000   576.000
   14.800    18.000     5.000   617.000   594.000
   14.900    19.000     5.000   637.000   613.000
   15.000    18.000     5.000   655.000   632.000
   
==========================================================================

As you can see : the current queue size from the 2 monitors does not match from
 time 12.600 to 14.500.