190 likes | 363 Views
Communications Protocols and TCP/IP. COMT 429. TCP Sliding Window Operation. Sender. snd.una +snd.wnd. snd.una. snd.nxt. snd.wnd. Receiver. rcv.nxt +rcv.wnd. rcv.nxt. rcv.wnd. Example. Sender. 5001. 1001. 2001. 2501. Available window for further sends. Next segment to send.
E N D
Communications Protocols and TCP/IP COMT 429
TCP Sliding Window Operation Sender snd.una +snd.wnd snd.una snd.nxt snd.wnd Receiver rcv.nxt +rcv.wnd rcv.nxt rcv.wnd
Example ... Sender 5001 1001 2001 2501 Available window for further sends Next segment to send Sent but no ack received yet Receiver 5001 1001 1501 Available receive window space Received and acked; not yet picked up by client
Segment Dispatch • Dispatch segment to IP • Set RTO (Retransmit Time Out) timer • Proportional to the Round Trip Time (RTT) Sender 5001 1001 2001 2501 Available window for further sends Next segment to send Sent but no ack received yet
Segment Receipt withPickup Receiver • Send Ack segment with Ack=2001 • Window = 4000 5001 6001 1001 1501 2001 Available receive window space Received and picked up by client
Segment Receipt w/oPickup Receiver • Send Ack packet with Ack = 2001 • Window = 3500 5001 5501 1001 1501 2001 Available receive window space Received but not picked up by client Received and picked up by client
Acknowledgement Receipt • Seg received with Ack=2001, Win=3500 • Left window edge to 2001 • Right window edge to 5501 Sender before 5001 1001 2001 2501 after 5001 5501 2001 2501
Segment Receipt AfterSegment Loss Receiver • Send a “duplicate” acknowledgement • Send Ack packet with Ack = 2001 • Window = 3500 5001 5501 1001 1501 2001 Last segment received Missing segment Received but not picked up by client Received and picked up by client
Retransmission • Highest Ack Number received is 2001 • Duplicate Ack=2001 may have been received • RTO timer for segment 2001 expires and 2001 is retransmitted • Trigger congestion avoidance algorithm Sender 5001 5501 2001 2501
Retransmit Timing andWindow Size - Single Error • BDP (Bandwidth Delay Product) • Ethernet: 1ms * 10Mbps = 1250 bytes • Satcom T1: 500ms * 1.5Mbps = 94 kbytes • Assume window size = BDP • RTO > 2*RTT • “Recovery Ack” after retransmit needs 1 RTT • Channel idles for length of RTO (“drained pipe”) 5001 5501 2001 2501
Retransmission TimerImplementation • Running estimate (based on Acks) of • Average RTT • RTT variance factor • Exclude retransmissions • Set RTO to RTT times RTT variance factor (with a hard upper bound) • Around 2 RTT for lightly loaded links • As high as 16 RTT for congested links
The Congestion Collapse Problem • Original TCP specs used the window for flow control, and 2*RTT for the RTO • Congestion of a link causes the RTO timers to “go off” before an ack can be returned • The network goes into steady state congestion where every segement is transmitted about three times
Congestion Issues • Slow Start - New Connection • Set send window to MSS • Increase the window by MSS for each ack received • Exponential increase in send window size x x x x x x x 5000 1001
Congestion Issues cont... • Slow Start - After retransmission • Exponential slow-start up to 1/2 of the original window size • Increase the window by MSS for each send window acked without loss • Linear increase in send window size x x x x x x x 5000 1001
Congestion Issues cont... • Congestion Avoidance, Timer Back-Off • Reduce send window to 1/2 of previous size for each retransmit (exponential back-off) • After a segment is retransmitted, set the new RTO timer for that segment to 2*RTO, up to a hard upper bound (2*MSL, Maximum Segment Life)
Fast Retransmit Sender • Duplicate Ack=2001 have been received • Re-send segment 2001 before RTO expires • “Guess” that 2001 was lost • Wait for >=3 dup acks (segements could just have arrived out-of-order) • Enter congestion avoidance with allowance for duplicate acks 5001 5501 2001 2501
Selective Acknowledgement Receiver • Enabled during Syn and Syn/Ack • Receiver send segment with • Ack = 2001, Window = 3500 • SACK option: block start=2501, end=2600 5001 5501 1001 1501 2001 2501 2601 Last segment received Missing Segment
Resources • RFC 793 - Transmission Control Protocol • Draft-ietf-tcplw-sack-02 - Selective Ack. • RCF 1323 - TCP Extensions • Van Jacobson Note on Fast Recovery (attached)