1 / 23

Transport Layer TCP and UDP

Transport Layer TCP and UDP. IS250 Spring 2010 chuang@ischool.berkeley.edu. Transport Layer Functions. Addressing (ports) Data integrity (error detection) Reliable data transport Flow control Congestion control. TCP Transmission Rate.

aglaia
Télécharger la présentation

Transport Layer TCP and UDP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Transport LayerTCP and UDP IS250 Spring 2010 chuang@ischool.berkeley.edu

  2. Transport Layer Functions • Addressing (ports) • Data integrity (error detection) • Reliable data transport • Flow control • Congestion control John Chuang

  3. TCP Transmission Rate • Q: Why limit ourselves to send only four packets at a time? • Q: how much data can be sent before ACK received? John Chuang

  4. Flow Control Producer Consumer Queue Stream of messages Flow control (“Slow down please!”) Note: We don’t want packet to travel the entire network only to be dropped at the destination. John Chuang

  5. Stop-and-go Sliding Window Flow Control: Two Approaches John Chuang

  6. Recipient explicitly requests lower send rate by specifying window size (or MaxUnackedPackets) Source stops sending when number of unacknowledged data equal to window size Sliding Window window_size acknowledged sent can be sent outside window John Chuang

  7. TCP Header: Flow Control 0 16 31 Source Port Number (16) Destination Port Number (16) Sequence Number (32) Acknowledgement Number (32) TCP Header Hdr Len (4) Reserved (6) Flags (6) Window Size (16) TCP Checksum (16) Urgent Pointer (16) Options (if any) Padding Data … John Chuang

  8. TCP Flow Control John Chuang

  9. Throughput as Function of Window Size Sender Receiver Time Window Size Throughput = Roundtrip Time John Chuang

  10. Transport Layer Functions • Addressing (ports) • Data integrity (error detection) • Reliable data transport • Flow control • Congestion control John Chuang

  11. Network Congestion • If link is congested • Router queue fills up • Drops packets • Source does not receive ACK • Resends packets • Makes congestion worse John Chuang

  12. Use packet drop as indicator of congestion Do not send all data to receiver at once Voluntary source-imposed policy (RFC 2581) slow start (SS) congestion avoidance (CA) fast retransmission fast recovery TCP Tahoe: SS + CA + fast retransmission TCP Reno: all four Other variants: TCP SACK, TCP Vegas, TCP Westwood, … TCP Congestion Control John Chuang

  13. TCP Congestion + Flow Control window_size • Control transmission rate by setting window size • Window size set to be smaller of: • rwnd: receiver window (flow control) • cwnd: congestion window (congestion control) win = min(rwnd, cwnd) • rwnd set by receiver • Question: how does sender set cwnd? acknowledged sent can be sent outside window John Chuang

  14. Congestion Window Size cwnd • TCP congestion control is an algorithm for sender to adaptively adjust window size • At steady state, cwnd oscillates around the optimal window size Congestion Avoidance Slow Start Time

  15. Slow Start • Whenever starting traffic on a new connection, or whenever increasing traffic after congestion was experienced: • Set cwnd =1 (one segment) • Each time a segment is acknowledged increment cwnd by one (cwnd++). • DoesSlow Startincrement slowly? Not really. In fact, the increase of cwnd is exponential John Chuang

  16. Slow Start Example • The congestion window size grows very rapidly • TCP slows down the increase of cwnd when cwnd >= ssthresh John Chuang

  17. Congestion Avoidance • Slows down “Slow Start” • Ifcwnd > ssthreshtheneach 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. • (We will learn later how to set ssthresh) John Chuang

  18. Slow Start/Congestion Avoidance Example • Assume that ssthresh = 8 ssthresh Cwnd (in segments) Roundtrip times John Chuang

  19. SEQ # unack next win TCP Congestion Control Pseudo-code win = min(cwnd, rwnd); while (next < unack + win) transmit next packet; 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 = 0.5 * win; cwnd = 1;

  20. The big picture cwnd Timeout Congestion Avoidance Slow Start 1 Time

  21. Cumulative and Duplicate ACKs • TCP uses cumulative ACK • ACK N means all bytes up to N-1 have been received • Duplicate ACKs may be due to • packets reordering • lost packet ACK 2 ACK 4 ACK 4 ACK 4 cwnd = 2 ACK 4 John Chuang

  22. Fast Retransmit/Fast Recovery cwnd • Retransmit after 3 duplicated ACKs • Don’t want for timeout • No need to slow start again • halve cwnd • At steady state, cwnd oscillates around the optimal window size. Congestion Avoidance Slow Start 1 Time

  23. TCP Congestion Control Shortcomings • “Fairness criterion” • Is “equal division” of resources always desirable? • Estimating congestion by retransmission is flawed for wireless links • Depends on accurate implementation -- cheating possible • Application can avoid congestion control by using UDP John Chuang

More Related