The Transport Layer: TCP & Congestion Control Smith College, CSC 249 Feb 20, 2018 1 Oeriew: TCP Basics q Recap: using SEQ and ACK numbers SEQ random initial number for numbering the bytes in the application message ACKnowledge next byte expected Read chapter to reiew q TCP congestion control Read through multiple s! q TCP flow control 2 1
TCP: SEQ and ACK numbers head len source port # dest port # sequence number acknowledgement number U A P R S F receie window application data (ariable length) Host A Host B ACK=100 Seq=100, 20 bytes data head len source port # dest port # sequence number acknowledgement number U A P R S F receie window application data (ariable length) ACK=120 3-3 TCP: Cumulatie ACK Host A Host B r Seq=100, 20 bytes data X loss ACK=100 ACK=120 Cumulatie ACK scenario 3-4 2
TCP possible sender eents: (1) Data receied from application: 1. Create a segment and assign a SEQ number SEQ # is byte-stream number of first data byte in segment 2. Start r if it is not already running Timer is for the oldest un-acked segment Expiration interal: TimeOutInteral (2) Timeout (ACK not receied): 1. Retransmit segment that caused the out 2. Restart the r (3) ACK receied for preiously unacked segments 1. Update what is known to be acked 2. Start r if there are outstanding segments 5 TCP: retransmission scenarios Host A Host B Host A Host B out X loss ACK=100 Seq=92 out Seq=100, 20 bytes data ACK=100 ACK=120 SendBase = 100 ACK=100 lost ACK scenario Seq=92 out ACK=120 premature out 1) What is/was A s next step? 2) What does B then do? 6 3
What does A do next, and when does it do it? Host A Host B triple duplicate ACKs seq # x1 seq # x2 seq # x3 seq # x4 seq # x5 resend seq X2 X ACK x1 ACK x1 ACK x1 ACK x1 out Fast retransmit, before the r s out 7 New Today: Principles of Congestion Control q Packet loss is caused by oerflowing router buffers q Retransmission treats the symptom q Congestion control treats the cause q What are costs of congestion? 8 4
TCP Congestion Control q Three questions 1. How does a sender sense congestion? 2. How does a sender limit its sending rate? 3. What algorithm is used to change the send-rate? 10 TCP Congestion Control: details How does sender perceie congestion? q A loss eent is? A out or 3 duplicate ACKs How does sender limit its send rate? q TCP sender reduces the send rate ia changing a ariable alue, the CongWin, after a loss eent LastByteSent-LastByteAcked CongWin 12 5
TCP Congestion Control Window q CongWin is dynamic, function of perceied network congestion q Sender limits transmission: LastByteSent-LastByteAcked CongWin q Changing CongWin changes the SendRate 13 TCP Congestion Control Algorithm 14 6
TCP Congestion Control Algorithm Three major mechanisms: 1) Slow start 2) Congestion Aoidancce AIMD = additie increase, multiplicatie decrease 3) Fast Recoery: Reaction to out eents ersus 3 duplicate ACKs Are used to adjust...? Adjust CongWin 15 TCP Slow Start 1) When connection begins, CongWin = 1 MSS Aailable bandwidth probably much greater Desirable to quickly ramp up to respectable rate 2) Increase rate exponentially fast until first loss eent Grow window 1MSS for each ACK receied q Summary: initial rate is slow but ramps up exponentially fast 16 7
TCP: detecting, reacting to loss Loss indicated by out cwnd set to 1 MSS; Window (cwnd ) grows exponentially (slow start) to the threshold, then grows linearly Loss indicated by 3 duplicate ACKs Duplicate ACKs indicate network capable of deliering some segments cwnd is cut in half window then grows linearly 17 TCP Slow Start with Exp. Increase q When connection begins, increase rate exponentially until first loss eent: RTT Host A Host B one segment Double CongWin eery RTT two segments Increment CongWin for eery ACK receied four segments 18 8
TCP: Congestion algorithm switching from slow start to CA Implementation: ariable ssthresh on loss eent, ssthresh is set to 1/2 of cwnd just before loss eent 19 Reaction to Loss Eents q Exponential increase switches to linear increase when CongWin gets to the threshold alue (size) 20 9
Identify eerything on this graph 21 Summary: TCP Congestion Control Increase Sending Rate Phase Options: 1. When CongWin is below Threshold, sender in slow-start phase, window grows exponentially. 2. When CongWin is aboe Threshold, sender is in congestion-aoidance phase, window grows linearly. Decrease Sending Rate Phase Options: 1. When a triple duplicate ACK occurs, Threshold set to CongWin/2 and CongWin set to Threshold. 2. When out occurs, Threshold set to CongWin/2 and CongWin is set to 1 MSS. 27 10