CS 268: Transport and Congestion Control Lecture 5 February 2, 2005.

Slides:



Advertisements
Similar presentations
Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
Advertisements

TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Transmission Control Protocol (TCP)
Fundamentals of Computer Networks ECE 478/578 Lecture #20: Transmission Control Protocol Instructor: Loukas Lazos Dept of Electrical and Computer Engineering.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
1 CS492B Project #2 TCP Tutorial # Jin Hyun Ju.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Winter 2008CS244a Handout #61 CS244a: An Introduction to Computer Networks Handout 6: The Transport Layer, Transmission Control Protocol (TCP), and User.
1 TCP Congestion Control. 2 TCP Segment Structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
TCP: Transmission Control Protocol Overview Connection set-up and termination Interactive Bulk transfer Timers Improvements.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Congestion Control Created by M Bateman, A Ruddle & C Allison As part of the TCP View project.
School of Information Technologies TCP Congestion Control NETS3303/3603 Week 9.
Transport Layer 3-1 Fast Retransmit r time-out period often relatively long: m long delay before resending lost packet r detect lost segments via duplicate.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 TCP Congestion Control: AIMD and Binomial Shivkumar Kalyanaraman Rensselaer Polytechnic Institute.
CS 268: Congestion Control and Avoidance Kevin Lai Feb 4, 2002.
Lecture 7 Transport Protocols: UDP, TCP
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
1 EE 122: Advanced TCP Ion Stoica TAs: Junda Liu, DK Moon, David Zats (Materials with thanks to Vern Paxson,
TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - TCP Instructor: Dr. Li-Chuan Chen Date: 09/22/2003 Based in part upon slides.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
TCP Lecture 13 November 13, TCP Background Transmission Control Protocol (TCP) TCP provides much of the functionality that IP lacks: reliable service.
CS332, Ch. 26: TCP Victor Norman Calvin College 1.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Chapter 12 Transmission Control Protocol (TCP)
CSE679: Computer Network Review r Review of the uncounted quiz r Computer network review.
EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.
1 Mao W07 Midterm Review EECS 489 Computer Networks Z. Morley Mao Monday Feb 19, 2007 Acknowledgement: Some.
1 TCP - Part II Relates to Lab 5. This is an extended module that covers TCP data transport, and flow control, congestion control, and error control in.
Lecture 9 – More TCP & Congestion Control
What is TCP? Connection-oriented reliable transfer Stream paradigm
CS640: Introduction to Computer Networks Aditya Akella Lecture 15 TCP – III Reliability and Implementation Issues.
Computer Networking Lecture 18 – More TCP & Congestion Control.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
CS640: Introduction to Computer Networks Aditya Akella Lecture 15 TCP – III Reliability and Implementation Issues.
Transport Layer3-1 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles.
Computer Networks23-1 PART 5 Transport Layer. Computer Networks23-2 Position of Transport Layer Responsible for the delivery of a message from one process.
1 TCP - Part II. 2 What is Flow/Congestion/Error Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver with information.
Peer-to-Peer Networks 13 Internet – The Underlay Network
EE 122: Transport Protocols Kevin Lai October 16, 2002.
CIS679: TCP and Multimedia r Review of last lecture r TCP and Multimedia.
CS 268: Lecture 5 (TCP Congestion Control) Ion Stoica February 4, 2004.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Transmission Control Protocol (TCP) TCP Flow Control and Congestion Control CS 60008: Internet Architecture and Protocols Department of CSE, IIT Kharagpur.
CSEN 404 Transport Layer II Amr El Mougy Lamia AlBadrawy.
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
Computer Networking Lecture 16 – Reliable Transport.
DMET 602: Networks and Media Lab Amr El Mougy Yasmeen EssamAlaa Tarek.
DMET 602: Networks and Media Lab
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP flow control, congestion control, and error control in TCP.
TCP Lecture 4.
Chapter 3 outline 3.1 transport-layer services
Introduction to Networks
Introduction to Congestion Control
TCP.
TCP.
PART 5 Transport Layer Computer Networks.
TCP.
Introduction of Transport Protocols
TCP - Part I Karim El Defrawy
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP flow control, congestion control, and error control in TCP.
Lecture 19 – TCP Performance
CS 268: Lecture 4 (TCP Congestion Control)
CS640: Introduction to Computer Networks
CS 268: Lecture 5 (TCP Congestion Control)
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
TCP Overview.
EE 122: Lecture 10 (Congestion Control)
Transport Layer: Congestion Control
Presentation transcript:

CS 268: Transport and Congestion Control Lecture 5 February 2, 2005

2 Projects  Proposals due on Monday!

3 Today’s Lecture  Basics of Transport  Basics of Congestion Control  Comments on Congestion Control

4 Duties of Transport  Demultiplexing: -IP header points to protocol -Transport header needs demultiplex further UDP: port TCP: source and destination address/port -Well known ports and ephemeral ports  Data reliability (if desired): -UDP: checksum, but no data recovery -TCP: checksum and data recovery

5 TCP Header  Sequence number, acknowledgement, and advertised window – used by sliding-window based flow control  Flags: -SYN, FIN – establishing/terminating a TCP connection -ACK – set when Acknowledgement field is valid -URG – urgent data; Urgent Pointer says where non-urgent data starts -PUSH – don’t wait to fill segment -RESET – abort connection Source port Destination port Options (variable) Sequence number Acknowledgement Advertised window ChecksumUrgent pointer FlagsHdrLen

6 TCP Header (Cont)  Checksum – 1’s complement and is computed over -TCP header -TCP data -Pseudo-header (from IP header) Note: breaks the layering! Source address Destination address TCP Segment length 0Protocol (TCP)

7 TCP Connection Establishment  Three-way handshake -Goal: agree on a set of parameters: the start sequence number for each side Client (initiator) Server SYN, SeqNum = x SYN and ACK, SeqNum = y and Ack = x + 1 ACK, Ack = y + 1

8 TCP Issues  Connection confusion: -ISNs can’t always be the same  Source spoofing: -Need to make sure ISNs are random  SYN floods: -SYN cookies  State management with many connections -Server-stateless TCP (NSDI 05)

9 TCP Flow Control  Make sure receiving end can handle data  Negotiated end-to-end, with no regard to network  Ends must ensure that no more than W packets are in flight -Receiver ACKs packets -When sender gets an ACK, it knows packet has arrived

10 Sliding Window Last ACKed (without gap)Last received (without gap) 7

11 Observations  Throughput is ~ (w/RTT)  Sender has to buffer all unacknowledged packets, because they may require retransmission  Receiver may be able to accept out-of-order packets, but only up to its buffer limits

12 What Should the Receiver ACK? 1. ACK every packet, giving its sequence number 2. Use negative ACKs (NACKs), indicating which packet did not arrive 3. Use cumulative ACK, where an ACK for number n implies ACKS for all k < n 4. Use selective ACKs (SACKs), indicating those that did arrive, even if not in order

13 Error Recovery  Must retransmit packets that were dropped  To do this efficiently -Keep transmitting whenever possible -Detect dropped packets and retransmit quickly  Requires: -Timeouts (with good timers) -Other hints that packet were dropped

14 Timer Algorithm  Use exponential averaging: A(n) = b*A(n- 1) + (1 – b)T(n) D(n) = b*D(n-1) + (1 – b)*(T(n) – A(n)) Timeout(n) = A(n) +4D(n) Notes: 1.Measure T(n) only for original transmissions 2.Double Timeout after timeout … 3.Reset Timeout for new packet and when receive ACK Question: Why not set timeout to average delay?

15 Hints  When should I suspect a packet was dropped?  When I receive several duplicate ACKs -Receiver sends an ACK whenever a packet arrives -ACK indicates seq. no. of last received consecutively received packet -Duplicate ACKs indicates missing packet

16 TCP Congestion Control  Can the network handle the rate of data?  Determined end-to-end, but TCP is making guesses about the state of the network  Two papers: -Good science vs great engineering

17 Dangers of Increasing Load  Knee – point after which -Throughput increases very slow -Delay increases fast  Cliff – point after which -Throughput starts to decrease very fast to zero (congestion collapse) -Delay approaches infinity  In an M/M/1 queue -Delay = 1/(1 – utilization) Load Throughput Delay kneecliff congestion collapse packet loss

18 Cong. Control vs. Cong. Avoidance  Congestion control goal -Stay left of cliff  Congestion avoidance goal -Stay left of knee Load Throughput kneecliff congestion collapse

19 Control System Model [CJ89]  Simple, yet powerful model  Explicit binary signal of congestion User 1 User 2 User n x1x1 x2x2 xnxn   x i > X goal y

20 Possible Choices  Multiplicative increase, additive decrease -a I =0, b I >1, a D <0, b D =1  Additive increase, additive decrease -a I >0, b I =1, a D <0, b D =1  Multiplicative increase, multiplicative decrease -a I =0, b I >1, a D =0, 0<b D <1  Additive increase, multiplicative decrease -a I >0, b I =1, a D =0, 0<b D <1  Which one?

21 Multiplicative Increase, Additive Decrease User 1: x 1 User 2: x 2 fairness line efficiency line (x 1h,x 2h ) (x 1h +a D,x 2h +a D ) (b I (x 1h +a D ), b I (x 2h +a D ))  Fixed point at Fixed point is unstable!

22 Additive Increase, Additive Decrease User 1: x 1 User 2: x 2 fairness line efficiency line (x 1h,x 2h ) (x 1h +a D,x 2h +a D ) (x 1h +a D +a I ), x 2h +a D +a I ))  Reaches stable cycle, but does not converge to fairness

23 Multiplicative Increase, Multiplicative Decrease User 1: x 1 User 2: x 2 fairness line efficiency line (x 1h,x 2h ) (b d x 1h,b d x 2h ) (b I b D x 1h, b I b D x 2h )  Converges to stable cycle, but is not fair

24 (b D x 1h +a I, b D x 2h +a I ) Additive Increase, Multiplicative Decrease User 1: x 1 User 2: x 2 fairness line efficiency line (x 1h,x 2h ) (b D x 1h,b D x 2h )  Converges to stable and fair cycle

25 Modeling  Critical to understanding complex systems -[CJ89] model relevant after 15 years, 10 6 increase of bandwidth, 1000x increase in number of users  Criteria for good models -Two conflicting goals: reality and simplicity -Realistic, complex model  too hard to understand, too limited in applicability -Unrealistic, simple model  can be misleading  My approach: theory as homeopathy -A tiny bit of reality goes a long way!

26 TCP Congestion Control  [CJ89] provides theoretical basis for basic congestion avoidance mechanism  Must turn this into real protocol

27 TCP Congestion Control  Maintains three variables: -cwnd: congestion window -flow_win: flow window; receiver advertised window -Ssthresh: threshold size (used to update cwnd) -  For sending, use: win = min(flow_win, cwnd)

28 TCP: Slow Start  Goal: reach knee quickly  Upon starting (or restarting): - Set cwnd =1 - Each time a segment is acknowledged increment cwnd by one (cwnd++).  Slow Start is not actually slow -cwnd increases exponentially

29 Slow Start Example  The congestion window size grows very rapidly  TCP slows down the increase of cwnd when cwnd >= ssthresh ACK 2 segment 1 cwnd = 1 cwnd = 2 segment 2 segment 3 ACK 4 cwnd = 4 segment 4 segment 5 segment 6 segment 7 ACK6-8 cwnd = 8

30 Congestion Avoidance  Slow down “Slow Start”  ssthresh is lower-bound guess about location of knee  If cwnd > ssthresh then each time a segment is acknowledged increment cwnd by 1/cwnd (cwnd += 1/cwnd).  So cwnd is increased by one only if all segments have been acknowledged.

31 Slow Start/Congestion Avoidance Example  Assume that ssthresh = 8 Roundtrip times Cwnd (in segments) ssthresh

32 Putting Everything Together: TCP Pseudocode Initially: cwnd = 1; ssthresh = infinite; New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd; Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1; while (next < unack + win) transmit next packet; where win = min(cwnd, flow_win); unacknext win seq #

33 The big picture Time cwnd Timeout Slow Start Congestion Avoidance

34 Fast Retransmit  Don’t wait for window to drain  Resend a segment after 3 duplicate ACKs ACK 2 segment 1 cwnd = 1 cwnd = 2 segment 2 segment 3 ACK 4 cwnd = 4 segment 4 segment 5 segment 6 segment 7 ACK 3 3 duplicate ACKs ACK 4

35 Fast Recovery  After a fast-retransmit set cwnd to ssthresh/2 -i.e., don’t reset cwnd to 1  But when RTO expires still do cwnd = 1  Fast Retransmit and Fast Recovery -Implemented by TCP Reno -Most widely used version of TCP today  Lesson: avoid RTOs at all costs!

36 Fast Retransmit and Fast Recovery  Retransmit after 3 duplicated acks -prevent expensive timeouts  No need to slow start again  At steady state, cwnd oscillates around the optimal window size. Time cwnd Slow Start Congestion Avoidance

37 Engineering vs Science in CC  Great engineering built useful protocol: -TCP Reno, etc.  Good science by CJ and others -Basis for understanding why it works so well

38 Behavior of TCP  Are packets smoothly paced? -NO! Ack-compression  Are long-lived flows nicely interleaved? -NO!  How does throughput depend on drop rate? Tput ~ 1/sqrt(d)

39 Extensions to TCP  Selective acknowledgements: TCP SACK  Explicit congestion notification: ECN  Delay-based congestion avoidance: TCP Vegas  Discriminating between congestion losses and other losses: cross-layer signaling and guesses  Randomized drops (RED) and other router mechanisms

40 Issues with TCP  Fairness: -Throughput depends on RTT  High speeds: -to reach 10gbps, packet losses occur every 90 minutes!  Short flows: -How to set initial cwnd properly  What about flows that want congestion control, but don’t want reliable delivery?

41 TCP: Cooperation and Compatibility  TCP assumes all flows employ TCP-like congestion control -TCP-friendly or TCP-compatible  Selfish flows: can get all the bandwidth they like  If new congestion control algorithms are developed, they must be TCP-friendly

42 Is AIMD the Only Answer?  Akella et al.: exploring congestion control -AIAD with a tiny bit of MD works better than AIMD  Binomial cc: Bansal and Balakrishnan -Nonlinear window adjustment algorithms -Can be TCP-friendly, and smoother (for media)