######################################################## # High-Speed TCP Studies - hstcp.tcl # # Michele Weigle and Pankaj Sharma # # - based on scripts from L. Xu, K. Harfoush, I. Rhee # # - based on scripts from S. Floyd and E. Souza # ######################################################## # ARGS: endtime flow1_type flow2_type FASTalpha flow2_start run DATADIR set begintime [clock second] # simulation end time set endtime [lindex $argv 0] # high-speed flow 1 type, flow 2 type set hstcp_type(0) [lindex $argv 1]; # HS, Scalable, FAST, BIC, CUBIC set hstcp_type(1) [lindex $argv 2]; # HS, Scalable, FAST, BIC, CUBIC set hstcpflows_num 2 set hstcpflows_type 0 # FASTalpha set alpha [lindex $argv 3] # flow 2 start time set flow2_start [lindex $argv 4] # run set run [lindex $argv 5] # datadir set DATADIR [lindex $argv 6] set bandwidth 622; # 622 Mbps set delay 48; # total of 100 ms RTT set buffer 1; # qlen is 1 x BDP # parameters for CUBIC set cubic_tcp_mode 1 set low_window 0 set high_window 83000 set high_p 0.0000001 set high_decrease 0.1 set hstcp_fix 1 remove-all-packet-headers ; # removes all except common add-packet-header Flags IP TCP ; # hdrs reqd for TCP source utils.tcl set frep [open $DATADIR/report.txt w] set urep [open $DATADIR/util.out w] puts "---------------------------------------------------------------" puts "---------------------------------------------------------------" puts [pwd] printlegend set ns [new Simulator] #$ns use-scheduler Heap global defaultRNG #$defaultRNG seed 0; # set the seed to current time/date $defaultRNG seed 9999; for {set i 1} {$i < $run} {incr i} { $defaultRNG next-substream } set n1 [$ns node] set n2 [$ns node] Agent/TCP set timestamps_ 1 Agent/TCP set window_ 67000 Agent/TCP set packetSize_ 1000 Agent/TCP set overhead_ 0.000008 Agent/TCP set max_ssthresh_ 100 Agent/TCP set maxburst_ 2 # BIC Agent/TCP set bic_beta_ 0.8 Agent/TCP set bic_B_ 4 Agent/TCP set bic_max_increment_ 32 Agent/TCP set bic_min_increment_ 0.01 Agent/TCP set bic_fast_convergence_ 1 Agent/TCP set bic_low_utilization_threshold_ 0 Agent/TCP set bic_low_utilization_checking_period_ 2 Agent/TCP set bic_delay_min_ 0 Agent/TCP set bic_delay_avg_ 0 Agent/TCP set bic_delay_max_ 0 Agent/TCP set bic_low_utilization_indication_ 0 # CUBIC Agent/TCP set cubic_beta_ 0.8 Agent/TCP set cubic_max_increment_ 16 Agent/TCP set cubic_fast_convergence_ 1 Agent/TCP set cubic_scale_ 0.4 Agent/TCP set cubic_tcp_friendliness_ $cubic_tcp_mode Agent/TCP set cubic_low_utilization_threshold_ 0 Agent/TCP set cubic_low_utilization_checking_period_ 2 Agent/TCP set cubic_delay_min_ 0 Agent/TCP set cubic_delay_avg_ 0 Agent/TCP set cubic_delay_max_ 0 Agent/TCP set cubic_low_utilization_indication_ 0 #set bf_size [expr $bandwidth*$delay*2*1000*$buffer/[Agent/TCP set packetSize_]/8] set bf_size 1555 puts "BufferSize(Packets) $bf_size" puts $frep "BufferSize(Packets) $bf_size" $ns duplex-link $n1 $n2 [expr $bandwidth]Mb [expr $delay]ms DropTail $ns queue-limit $n1 $n2 $bf_size $ns queue-limit $n2 $n1 $bf_size set qmon [$ns monitor-queue $n1 $n2 ""] set qfp [open $DATADIR/queue.out w] print-queue 0.1 $qfp set fmon [$ns makeflowmon Fid] $ns attach-fmon [$ns link $n1 $n2] $fmon # back path fmon set fmon2 [$ns makeflowmon Fid] $ns attach-fmon [$ns link $n2 $n1] $fmon2 #set rng_ [new RNG] #for {set i 1} {$i < $run} {incr i} { # $rng_ next-substream #} set starttime(0) 0.1 set starttime(1) $flow2_start for {set i 0} {$i < $hstcpflows_num} {incr i} { set hsnode(s$i) [$ns node] set hsnode(r$i) [$ns node] # set del [$rng_ uniform 0.1 1.9] # $ns duplex-link $hsnode(s$i) $n1 1000Mb ${del}ms DropTail $ns duplex-link $hsnode(s$i) $n1 1000Mb 1ms DropTail $ns duplex-link $hsnode(r$i) $n2 1000Mb 1ms DropTail # puts "hstcp$i, forwardlink delay=[format %.2f $del] ms" # puts $frep "hstcp$i, forwardlink delay=$del ms" # puts "hstcp$i, RTT = [format %.2f [expr ($del+1.0+$delay)*2 ]] ms" # puts $frep "hstcp$i, RTT = [format %.2f [expr ($del+1.0+$delay)*2 ]] ms" puts "hstcp$i, forwardlink delay=1 ms" puts $frep "hstcp$i, forwardlink delay=1 ms" puts "hstcp$i, RTT = 100.00 ms" puts $frep "hstcp$i, RTT = 100.00 ms" $ns queue-limit $hsnode(s$i) $n1 67000 $ns queue-limit $n1 $hsnode(s$i) 67000 $ns queue-limit $n2 $hsnode(r$i) 67000 $ns queue-limit $hsnode(r$i) $n2 67000 if {$hstcp_type($i) != "FAST"} { set hstcp$i [$ns create-connection TCP/Sack1 $hsnode(s$i) TCPSink/Sack1 $hsnode(r$i) $i] if {$hstcp_type($i) == "HS"} { set hstcpflows_type 8 set low_window 38 } elseif {$hstcp_type($i) == "Scalable"} { set hstcpflows_type 9 set low_window 16 [set hstcp$i] set scalable_lwnd_ $low_window } elseif {$hstcp_type($i) == "BIC"} { set hstcpflows_type 12 set low_window 14 } elseif {$hstcp_type($i) == "CUBIC"} { set hstcpflows_type 13 } elseif {$hstcp_type($i) == "HTCP"} { set hstcpflows_type -10 } if {$hstcp_type($i) != "HTCP"} { [set hstcp$i] set max_ssthresh_ 100 } else { [set hstcp$i] set max_ssthresh_ 1 } [set hstcp$i] set windowOption_ $hstcpflows_type [set hstcp$i] set low_window_ $low_window [set hstcp$i] set high_window_ $high_window [set hstcp$i] set high_p_ $high_p [set hstcp$i] set high_decrease_ $high_decrease [set hstcp$i] set hstcp_fix_ $hstcp_fix } else { # set hstcp$i [$ns create-connection TCP/Fast $hsnode(s$i) TCPSink $hsnode(r$i) $i] set hstcp$i [$ns create-connection TCP/Fast $hsnode(s$i) TCPSink/Sack1 $hsnode(r$i) $i] [set hstcp$i] set alpha_ $alpha [set hstcp$i] set beta_ $alpha } set hsftp$i [[set hstcp$i] attach-app FTP] set lastBytes($i) 0 $ns at $starttime($i) "[set hsftp$i] start" $ns at [expr $endtime+5] "[set hsftp$i] stop" # print this connection start time puts "hstcp$i starttime: $starttime($i)" puts $frep "hstcp$i starttime: $starttime($i)" set cfp_hs($i) [open $DATADIR/cwnd_hstcp$i.out w] set tput_hs($i) [open $DATADIR/tput_hstcp$i.out w] if { $hstcpflows_type == 12 } { print-cwnd-bic [set hstcp$i] 0.1 $cfp_hs($i) } else { print-cwnd [set hstcp$i] 0.1 $cfp_hs($i) } set lastKBytes($i) 0 print-th-one $i $fmon 1 } set halftime [expr $endtime / 2] puts stderr "halftime: $halftime endtime: $endtime" for {set i 0} {$i < $hstcpflows_num} {incr i} { $ns at $halftime "print-stat-one-pre $i $fmon" $ns at $endtime "print-stat-one $i $fmon" } $ns at $halftime "print-stat-all-pre" $ns at $endtime "print-stat-all" $ns at $endtime "printlegend" $ns at $endtime "finish" $ns at 0 "timeReport 1" $ns at 0.1 "print-util 0.1 0" $ns run