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

[ns] question on long FTP



Hi!

I simulated long FTPs on N parallel TCPs through a single, B sized buffer. I 
found that after the transient period, there are sharp jumps in the loss rate 
(loss per RTT), and the position of the jumps (in transfered packet units) are 
almost independent from the TCP number (N) and the buffer size (B), if the B/N 
ratio is below 2.

I don't have any idea what can cause this phenomenon. Why are there any sharp 
jumps and why are they independent from N and B? Is it a bug in ns, or my 
program is wrong? If you have any idea or you have noticed similar things, 
please write me.

Thanks,
Attila
-------------------------------------------------------------------------------
You can reproduce my trace file with the following command:

ns xtracer.tcl -QueueLimit 32 -AgentNumber 64 -Duration 33554.432 -TraceAt 0 
-Resolution 0.256 -Verbose false -Output trace.log

were my 'xtracer.tcl' program code is the following:

proc usage {} {
    global opts
    puts stderr {usage: ns XTracer.tcl [options]}
    puts stderr "
    Link options:
    -BandWidth ($opts(BandWidth))
    -Delay ($opts(Delay))
    -QueueLimit ($opts(QueueLimit))

    Agent options:
    -AgentNumber ($opts(AgentNumber))
    -SourceType ($opts(SourceType))
    -DestType ($opts(DestType))
    -PacketSize ($opts(PacketSize))

    Application option:
    -ApplicationType ($opts(ApplicationType))
    -Duration ($opts(Duration))
    -Resolution ($opts(Resolution))
    
    Misc. options:
    -TraceAt ($opts(TraceAt))
    -Output ($opts(Output))
    -Verbose ($opts(Verbose))
"
    exit 1
}

Class XTracer

XTracer instproc tracer_record {} {
    global opts
    $self instvar time trace_file_ ns_ Agent_ flow_monitor
    
    set window_sum 0
    set real_time [expr $time*$opts(Resolution)]
    if {$real_time>=$opts(TraceAt)} {
	set flow1 [[$flow_monitor classifier] lookup auto 0 256 0]
	set dep1 [$flow1 set pdepartures_]
	set drp1 [$flow1 set pdrops_]
	set dep [$flow_monitor set pdepartures_]
	set drp [$flow_monitor set pdrops_]
	puts $trace_file_ "$dep1 $drp1 $dep $drp" 
	if {$opts(Verbose)} {puts "$real_time"}
    }
    incr time
    $ns_ at $real_time "$self tracer_record"
}

    
XTracer instproc init {} {
    global opts

    # network
    $self instvar ns_ node1_ node2_ link12_
    set ns_ [new Simulator]
    set node1_ [$ns_ node]
    set node2_ [$ns_ node]
    $ns_ duplex-link $node1_ $node2_ $opts(BandWidth) $opts(Delay) DropTail
    $ns_ queue-limit $node1_ $node2_ $opts(QueueLimit)
    # this is gross!
    set link12_ [$ns_ link $node1_ $node2_]

    # traffic
    $self instvar Agent_ Application_
    for {set i 0} {$i<$opts(AgentNumber)} {incr i} {
	set Agent_($i) [$ns_ create-connection $opts(SourceType) $node1_ 
$opts(DestType) $node2_ 0]
	set Application_($i) [$Agent_($i) attach-app $opts(ApplicationType)]
	$Agent_($i) set packetSize_ $opts(PacketSize)
	$Agent_($i) set window_ 64000
	$Agent_($i) set overhead_ 0
	$ns_ at 0 "$Application_($i) start"
    }
    
    # traces
    $self instvar trace_file_ flow_monitor time
    global tcl_precision
    set trace_file_ [open $opts(Output) w]
    set tcl_precision 9
    set time 0

    set flow_monitor [$ns_ makeflowmon Fid [expr $opts(AgentNumber) + 20]]
    $ns_ attach-fmon $link12_ $flow_monitor
    $flow_monitor attach $trace_file_

    # run things
    $ns_ at 0 "$self tracer_record"
    $ns_ at $opts(Duration) "$self finish"
    $ns_ run
}


XTracer instproc finish {} {
    $self instvar trace_file_
    if [info exists trace_file_] {
	close $trace_file_
    }
    
    exit 0
}


proc default_options {} {
    global opts opt_wants_arg
    
    set raw_opt_info {
	# Link parameters
	BandWidth 1000000
	Delay 0ms
	QueueLimit 32
	
	# Agent parameters
	AgentNumber 64
	SourceType TCP
	DestType TCPSink
	PacketSize 1000

	# Application parameters
	ApplicationType FTP

	Duration 524.288
	Resolution 0.008
	TraceAt 0
	Output xtrace.tr
	
	# boolean:
	Verbose true
	TraceOpt none
    }

    while {$raw_opt_info != ""} {
	if {![regexp "^\[^\n\]*\n" $raw_opt_info line]} {
	    break
	}
	regsub "^\[^\n\]*\n" $raw_opt_info {} raw_opt_info
	set line [string trim $line]
	if {[regexp "^\[ \t\]*#" $line]} {
	    continue
	}
	if {$line == ""} {
	    continue
	} elseif [regexp {^([^ ]+)[ ]+([^ ]+)$} $line dummy key value] {
	    set opts($key) $value
	    set opt_wants_arg($key) 1
	} else {
	    set opt_wants_arg($key) 0
	    # die "unknown stuff in raw_opt_info\n"
	}
    }
}

proc process_args {} {
    global argc argv opts opt_wants_arg
    
    default_options
    for {set i 0} {$i < $argc} {incr i} {
	set key [lindex $argv $i]
	if {$key == "-?" || $key == "--help" || $key == "-help" || $key == "-h"} 
{
	    usage
	}
	regsub {^-} $key {} key
	if {![info exists opt_wants_arg($key)]} {
	    puts stderr "unknown option $key";
	    usage
	}
	if {$opt_wants_arg($key)} {
	    incr i
	    set opts($key) [lindex $argv $i]
	} else {
	    set opts($key) [expr !opts($key)]
	}
    }
}

proc main {} {
	process_args
	new XTracer
}

main