Ns-2 Simulation Code and Examples: Home Memb Ers Itmben CH Sats Archiv E Gm:Sigmetrics02 Gm:Spie02 Ns-2
Ns-2 Simulation Code and Examples: Home Memb Ers Itmben CH Sats Archiv E Gm:Sigmetrics02 Gm:Spie02 Ns-2
Ns-2 Simulation Code and Examples: Home Memb Ers Itmben CH Sats Archiv E Gm:Sigmetrics02 Gm:Spie02 Ns-2
When all the modules have been installed, we now see an illustrative scenario in which
flows of size 5 packets or below being identified as short flows, and enjoy high priorities
in packet delivery. Figure 1 depicts the simulation topology.
In this simple example, there are two parallel TCP sessions sharing a single bottleneck
link between
node 1 and node 2 (of capacity 700kb).
# Create a dumbbell topology
$ns duplex-link $s(0) $n(0) 1Mb 5ms DropTail
$ns duplex-link $s(1) $n(0) 1Mb 5ms DropTail
One of the sessions runs from node 3 to node 5, periodically transmitting 1000 packets.
Therefore, all flows in this session are long according to our definition. On the contrary,
in the session from node 4 to node 6, only 4 packets are transmitted in each flow. The
simulation script is shown below:
# Create sessions
proc build-fore-tcp { idx size intv stime } {
global ns ftcp fsink
if { $firsttime == 0 } {
$ns detach-agent $s([expr $idx%2]) $ftcp($idx)
$ns detach-agent $r([expr $idx%2]) $fsink($idx)
$ftcp($idx) reset
$fsink($idx) reset
}
$ns attach-agent $s([expr $idx%2]) $ftcp($idx)
$ns attach-agent $r([expr $idx%2]) $fsink($idx)
$ns connect $ftcp($idx) $fsink($idx)
$ftcp($idx) set fid_ 0
set forel_intv 1
set fores_intv 0.05
set ssize 4
set lsize 1000
build-fore-tcp 1 $ssize 1 0.1
build-fore-tcp 0 $lsize $forel_intv 0.5
Node 0 is the "size-aware classifier", which counts the incoming packets from each flow.
Once the count exceeds a certain threshold (in this case 5), the remaining packets from
the corresponding flow are identified as long flow packets. In the simulation, long flow
packets are colored in blue. All the other packets, i.e., packets from flows of size less
than 5, and the first 5 packets from a long flow, are all identified as short flow packets,
and colored in red in the simulation.
As a result, all packets between node 4 and node 6 are colored in red:
Figure 2: Packets from short flows.
For flows of size bigger than 5, the first 5 packets are colored in red, and the remaining
packets are colored in blue:
Figure 3: Packets from long flows.
At the bottleneck link (link between node 1 and node 2), a differentiated dropping
scheme is employed. This is achieved by:
$ns duplex-link $n(1) $n(2) 700Kb 25ms RED/myRIO
$ns duplex-link-op $n(1) $n(2) orient right
When congestion happens, low priority packets are dropped at a faster rate (on average
10 times faster) than that for high priority packets. This is illustrated in Figure 4:
As a result, high priority flows, or short flows, are transmitted at a rate higher than that of
low priority flows, or long flows, as TCP flows are responsive to packet drops. That is
the basic scheme of our size-aware scheduling. Figure 5 shows packets generated from
the two sessions, after some packets are dropped:
Figure 5: Red packets are generated faster than blue packets.
Reference
[GM:sigmetrics02] L. Guo and I. Matta. "Scheduling Flows with Unknown Sizes:
Approximate Analysis". Proc. ACM SIGMETRICS'02 (poster), Los Angeles, CA, June
2002. [.ps], [.pdf] Full paper available as BU CS Technical Report TR-2002-09.
[GM:spie02] L. Guo and Ibrahim Matta. Differentiated Control of Web Traffic: A
Numerical Analysis. Proc. SPIE ITCOM'2002: Scalability and Traffic Control in IP
Networks, Boston, MA, August 2002.