15-441 Computer NetworkingOutlineEstablishing ConnectionTCP Connection Setup ExampleTCP State Diagram: Connection SetupTearing Down ConnectionTCP Connection Teardown ExampleState Diagram: Connection Tear-downSlide 9Reliability ChallengesTCP = Go-Back-N VariantRound-trip Time EstimationOriginal TCP Round-trip EstimatorJacobson’s Retransmission TimeoutRTT Sample AmbiguityTimestamp ExtensionTimer GranularitySlide 18CongestionCauses & Costs of CongestionSlide 21Congestion CollapseCongestion Control and AvoidanceApproaches Towards Congestion ControlExample: TCP Congestion ControlSlide 26ObjectivesBasic Control ModelLinear ControlPhase PlotsSlide 31Additive Increase/DecreaseMuliplicative Increase/DecreaseConvergence to EfficiencyDistributed Convergence to EfficiencyConvergence to FairnessConvergence to Efficiency & FairnessWhat is the Right Choice?Important Lessons15-441 Computer NetworkingLecture 17 – TCP & Congestion ControlLecture 17: 03-18-2004 2Outline•TCP connection setup/data transfer•TCP reliability•Congestion sources and collapse•Congestion control basicsLecture 17: 03-18-2004 3Establishing Connection•Three-Way Handshake•Each side notifies other of starting sequence number it will use for sending•Why not simply chose 0?•Must avoid overlap with earlier incarnation•Security issues•Each side acknowledges other’s sequence number•SYN-ACK: Acknowledge sequence number + 1•Can combine second SYN with first ACKSYN: SeqCACK: SeqC+1SYN: SeqSACK: SeqS+1Client ServerLecture 17: 03-18-2004 4TCP Connection Setup Example•Client SYN•SeqC: Seq. #4019802004, window 65535, max. seg. 1260•Server SYN-ACK+SYN•Receive: #4019802005 (= SeqC+1)•SeqS: Seq. #3428951569, window 5840, max. seg. 1460•Client SYN-ACK•Receive: #3428951570 (= SeqS+1)09:23:33.042318 IP 128.2.222.198.3123 > 192.216.219.96.80: S 4019802004:4019802004(0) win 65535 <mss 1260,nop,nop,sackOK> (DF)09:23:33.118329 IP 192.216.219.96.80 > 128.2.222.198.3123: S 3428951569:3428951569(0) ack 4019802005 win 5840 <mss 1460,nop,nop,sackOK> (DF)09:23:33.118405 IP 128.2.222.198.3123 > 192.216.219.96.80: . ack 3428951570 win 65535 (DF)Lecture 17: 03-18-2004 5TCP State Diagram: Connection SetupCLOSEDSYNSENTSYNRCVDESTABLISTENactive OPENcreate TCBSnd SYN create TCBpassive OPENdelete TCBCLOSEdelete TCBCLOSEsnd SYNSENDsnd SYN ACKrcv SYNSend FINCLOSErcv ACK of SYNSnd ACKRcv SYN, ACKrcv SYNsnd ACKClientServerLecture 17: 03-18-2004 6Tearing Down Connection•Either Side Can Initiate Tear Down•Send FIN signal•“I’m not going to send any more data”•Other Side Can Continue Sending Data•Half open connection•Must continue to acknowledge•Acknowledging FIN•Acknowledge last sequence number + 1A BFIN, SeqAACK, SeqA+1ACKDataACK, SeqB+1FIN, SeqBLecture 17: 03-18-2004 7TCP Connection Teardown Example•Session•Echo client on 128.2.222.198, server on 128.2.210.194•Client FIN•SeqC: 1489294581•Server ACK + FIN•Ack: 1489294582 (= SeqC+1)•SeqS: 1909787689•Client ACK•Ack: 1909787690 (= SeqS+1)09:54:17.585396 IP 128.2.222.198.4474 > 128.2.210.194.6616: F 1489294581:1489294581(0) ack 1909787689 win 65434 (DF)09:54:17.585732 IP 128.2.210.194.6616 > 128.2.222.198.4474: F 1909787689:1909787689(0) ack 1489294582 win 5840 (DF)09:54:17.585764 IP 128.2.222.198.4474 > 128.2.210.194.6616: . ack 1909787690 win 65434 (DF)Lecture 17: 03-18-2004 8State Diagram: Connection Tear-downCLOSINGCLOSEWAITFINWAIT-1ESTABTIME WAITsnd FINCLOSEsend FINCLOSErcv ACK of FINLAST-ACKCLOSEDFIN WAIT-2snd ACKrcv FINdelete TCBTimeout=2mslsend FINCLOSEsend ACKrcv FINsnd ACKrcv FINrcv ACK of FINsnd ACKrcv FIN+ACKACKActive ClosePassive CloseLecture 17: 03-18-2004 9Outline•TCP connection setup/data transfer•TCP reliability•Congestion sources and collapse•Congestion control basicsLecture 17: 03-18-2004 10Reliability Challenges•Congestion related losses•Variable packet delays•What should the timeout be?•Reordering of packets•Ensure sequences numbers are not reused•How long do packets live?•MSL = 120 seconds based on IP behaviorLecture 17: 03-18-2004 11TCP = Go-Back-N Variant•Sliding window with cumulative acks•Receiver can only return a single “ack” sequence number to the sender.•Acknowledges all bytes with a lower sequence number•Starting point for retransmission•Duplicate acks sent when out-of-order packet received •But: sender only retransmits a single packet.•Reason???•Error control is based on byte sequences, not packets.•Retransmitted packet can be different from the original lost packet – Why?Lecture 17: 03-18-2004 12Round-trip Time Estimation•Wait at least one RTT before retransmitting•Importance of accurate RTT estimators:•Low RTT unneeded retransmissions•High RTT poor throughput•RTT estimator must adapt to change in RTT•But not too fast, or too slow!•Spurious timeouts•“Conservation of packets” principle – never more than a window worth of packets in flightLecture 17: 03-18-2004 13Original TCP Round-trip Estimator•Round trip times exponentially averaged:•New RTT = (old RTT) + (1 - ) (new sample)•Recommended value for : 0.8 - 0.9•0.875 for most TCP’s•Retransmit timer set to b RTT, where b = 2•Every time timer expires, RTO exponentially backed-off•Not good at preventing spurious timeouts•Why?Lecture 17: 03-18-2004 14Jacobson’s Retransmission Timeout•Key observation:•At high loads round trip variance is high•Solution:•Base RTO on RTT and standard deviation•RTO = RTT + 4 * rttvar•new_rttvar = * dev + (1- ) old_rttvar•Dev = linear deviation •Inappropriately named – actually smoothed linear deviationLecture 17: 03-18-2004 15RTT Sample Ambiguity•Karn’s RTT Estimator•If a segment has been retransmitted:•Don’t count RTT sample on ACKs for this segment•Keep backed off time-out for next packet•Reuse RTT estimate only after one successful transmissionA BACKSampleRTTOriginal transmissionretransmissionRTOA BOriginal transmissionretransmissionSampleRTTACKRTOXLecture 17: 03-18-2004 16Timestamp Extension•Used to improve timeout mechanism by more accurate measurement of RTT•When sending a packet, insert current timestamp into option•4 bytes for timestamp, 4 bytes for echo•Receiver echoes timestamp in ACK•Actually will echo whatever is in timestamp•Removes retransmission ambiguity•Can get RTT sample on any packetLecture 17: 03-18-2004 17Timer Granularity•Many TCP
View Full Document