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

[ns] some TCP questions



Hi,

 I'm interested in studying different versions of TCP over a lossy &
high delay link. While running some simulations I have discovered
several issues in different TCPs for which I would like to know if it is
"normal" TCP behavior or not. (I have included my simulation scripts at
the end). I use ns-2 version 2.1b5 (It is the only one I finaly got to
run under Solaris).
My applolgies in advance if I have overlooked the answers in the mailing
list archeives or made some other mistakes.

1. TCP Newreno with partial window deflation:  the line 	
  cwnd_ -= (deflate - dupwnd_); 
sometimes results in a negative congestion window and can causes the
transmission to get stuck and only to resumes because of a timeout to a
packet that has not yet been sent. NS-2 TCP implementation seems to set
the timeout not for the last packet that has been transmitted by for the
next packet to be transmitted. This behavior can be seen with seed
1428561886 in the loss event strating from packt 281 and ending in a
timeout for 656. With bugfix set to false and seed 1428561886 or
1652060933  the transmission stops completely. 

2. TCP Newreno: when a partial ack arrives the dupack count is not set
to 0 but continues to be increased. This implementation prevents some
unnecessary retransmission if the packet is retransmitted on the first
partial acks and after that more then 3 duplicates of this partial acks
arrive. 

3.TCP Reno: When a packet is first retransmitted with fast retransmit
and the retransmission is lost again it is retransmitted by a timeout.
If, after that timeout retransmission, more duplicat acks for this
packet arrive the Reno sender tranmits new packets using this duplicat
acks. So it does not really perform slow start but fast recovery even
after a timeout. Only when the first new ack arrives the sender performs
slow start. (seed 1911226991, pk 10959)

4. TCP Sack (2nd simulation script): This simulation run has no bit
errors but a limit output buffer of 50 pks. Only 400 pks are
transmitted. In this run a timeout occurs even with TCP Sack that
happens because when the first sack arrives all user data has already
been transmitted and therefor the statement t_seqno_ < curseq_ in
 while (t_seqno_ <= highest_ack_ + win && t_seqno_ < curseq_)
prevents that the transmission loop is re-entered. 
After the timeout the sack blocks contain the 3 highest losses in the
receiver buffer so the information doesn't help to recover the losses
ack 229,sack left 399, sack right 400
ack 229,sack left 397, sack right 398
ack 229,sack left 395, sack right 396

Thank you very much for any comments and thoughts on these matters.
Tanja
#####################################################
# create new simulation object
set ns [new Simulator]

#randomise
set rand 1652060933
set rand [ns-random $rand]

#open trace file for pk traces
set f [open /home/tanja/ns_test/out.tr w]
$ns trace-all $f

#create 2 network nodes
set n0 [$ns node]
set n1 [$ns node]
#create a duplex link with 1.5Mb bandwidth and 100ms delay
#between the 2 nodes
$ns duplex-link $n0 $n1 1.5Mb 100ms DropTail
#set the queue size to a large value
set q [[$ns link $n0 $n1] queue]
$q set limit_ 10000

#create a TCP connection between the 2 nodes
set tcp [new Agent/TCP/Newreno]
$ns attach-agent $n0 $tcp
set tcp_sink [new Agent/TCPSink]
$ns attach-agent $n1 $tcp_sink
$ns connect $tcp $tcp_sink

#set the error model for the lossy link
set em [new ErrorModel]
$em unit pkt
#this should roughthly equal a ber of 10-6
$em set rate_ 0.02332
$ns link-lossmodel $em $n0 $n1

#set the pk size
$tcp set packetSize_ 536
$tcp set window_ 1000
$tcp set bugFix_ 1
#only for Newreno 
$tcp set partial_window_deflation_ 1

proc finish {} {
         global f 
         close $f
	 exit 0
}

#transfer a 10Mbyte file
$ns at 0.5 "$ftp send 10000000"

# tells the simulation to call "finish" 
$ns at 2000.0 "finish"

# run the simulation
$ns run

###########################################
# create new simulation object
set ns [new Simulator]

#open trace file for pk traces
set f [open /home/tanja/ns_test/out.tr w]
$ns trace-all $f

#create 2 network nodes
set n0 [$ns node]
set n1 [$ns node]
#create a duplex link with 1.5Mb bandwidth and 100ms delay
#between the 2 nodes
$ns duplex-link $n0 $n1 1.5Mb 100ms DropTail

#create a TCP connection between the 2 nodes
set tcp [new Agent/TCP/Sack1]
$ns attach-agent $n0 $tcp
set tcp_sink [new Agent/TCPSink/Sack1]
$ns attach-agent $n1 $tcp_sink
$ns connect $tcp $tcp_sink

#set the pk size and receiver window
$tcp set packetSize_ 100
$tcp set window_ 1000

#create ftp source
set ftp [new Application/FTP]
$ftp attach-agent $tcp


# close file 
proc finish {} {
         global f 
         close $f
         exit 0
}

#send 400 pks with a size of 100bytes
$ns at 0.5 "$ftp send 40000"

# tells the simulation to call "finish"
$ns at 15.0 "finish"

# run the simulation
$ns run
############################################
-- 
For God so loved the world that he gave his one and only Son, that 
whoever believes in him shall not perish but have eternal life.
                                                         John 3:16

Tanja Lang
PhD student
Institute for telecommunications research (ITR)
University of South Australia
http://www.itr.unisa.edu.au/
------------------------------------------------------
postal address:
Torrens Valley International Residence
41 - 69 Smart Road
Modbury, SA 5092
AUSTRALIA