1 / 57

Computer Networks: Transmission Control Protocol (TCP)

Computer Networks: Transmission Control Protocol (TCP). Ivan Marsic Rutgers University. Chapter 2 - TCP. Transmission Control Protocol (TCP). Chapter 2. UDP Header. Topic : TCP Protocol.  TCP Packet (“Segment”) Format  Setting Retransmission Timers  Flow Control.

laurie
Download Presentation

Computer Networks: Transmission Control Protocol (TCP)

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. Computer Networks:Transmission Control Protocol (TCP) Ivan Marsic Rutgers University Chapter 2 - TCP

  2. Transmission Control Protocol (TCP) Chapter 2

  3. UDP Header

  4. Topic:TCP Protocol  TCP Packet (“Segment”) Format  Setting Retransmission Timers  Flow Control

  5. TCP in the Protocol Stack • End-to-end protocol • Most popular protocolin the Internet(together with IP,“TCP/IP protocol suite”

  6. Transmission Control Protocol (TCP) • Notion of a “session” or “connection”, so TCP is said to be a connection-oriented protocol • TCP “Quality of Service”: Assured delivery • Congestion avoidance helps improve throughput

  7. TCP Session • Continuous stream of bytesbecomes available for application to use when a connection is establishedand disappears when the connection is closed

  8. Encapsulation of TCP Datain IP Datagrams

  9. TCP Header

  10. Recall the IPv4 Packet Header

  11. Urgent Data Pointer • Last byte of urgent data (LBUD) = sequenceNumber+ urgentPointer • First byte of urgent data never explicitly defined • Any data in Receive buffer up to LBUD may be considered urgent

  12. Search the Web for RTT distribution measurement Retransmission Timer Calculation

  13. Retransmission Timer CalculationExponential Weighted Moving Average (EWMA) Timeout Interval, set as +4 :TimeoutInterval(t) = EstimatedRTT(t) + 4 DevRTT(t) Estimated mean value of RTT:EstimatedRTT(t) = (1) EstimatedRTT(t 1) + SampleRTT(t) Estimated current standard deviation of RTT:DevRTT(t) = (1) DevRTT(t 1) + SampleRTT(t) EstimatedRTT(t 1) The initial value is set as:DevRTT(0) = 1/2 SampleRTT(0) for the first RTT measurement Recommended values of the control parameters are  = 0.125 and  = 0.25

  14. Retransmission Timer Management(from Listing 2-1) • In method TCPSender.send(), Listing 2-1 // called by the application layer from above • in Line 24: • if (RTO timer not already running) { • set the RTO timer to the current value • as calculated in methods handle() and RTOtimeout(); • start the timer; • } • In method TCPSender.handle(), Listing 2-1 // called by IP layer when ACK arrives • in Lines 36 - 38: • if ((lastByteAcked < lastByteSent) { • calculate the new value of the RTO timer using Eq. (2.2); • re-start the RTO timer; • } • In method TCPSender.RTOtimeout(), Listing 2-1 // called when RTO timeout • in Line 43: • double the TimeoutInterval; // exponential backoff , Eq. (2.1) • start the timer;

  15. Visit http://en.wikipedia.org/wiki/Network_socket to learn about network sockets TCP Connection Establishment

  16. Example TCP Session

  17. Flow vs. Congestion Control

  18. Topic:TCP Congestion Control  TCP Tahoe  TCP Reno  TCP NewReno

  19. The Problem • TCP is a window-based protocol • Window size represents the amount of resources available for a communication session • It limits the number of outstanding (unacknowledged) packets • However, unlike a simple ARQ (Chapter 1), “resources” include both receiver resources and network resources • How to know the available network resources?

  20. Network Conceptual Model Many sources and many receivers … (a) We don’t know when sources will start/end their sessions; also their datarates are variable

  21. Simplified Network Model The entire network is abstracted as a single router – “black box” Receiver resources Represented by “Receive Window Size” (b) Network resources Represented by “Congestion Window Size”

  22. TCP Buffer Parameters

  23. TCP Congestion Control Summary • Sender starts with a small window size • Send a “burst” of packets (size of the current sender window) into the network • Wait for a feedback about success rate (acknowledgements from the receiver end) • When the (positive/negative) feedback arrives: • + If the success rate is greater than zero, increase the sender window size and go to Step 2 • – If loss is detected, decrease the sender window size and go to Step 2

  24. TCP Congestion Control Param’s

  25. TCP Sender State Diagram “Send data”  “Retransmit”  1. Set CongWin & SSThresh 2. Send EfctWin of data, if any 3. Re-start RTO timer 1. Set CongWin & SSThresh 2. Re-send oldest outstanding segment 3. Double the RTO timer & re-start it

  26. TCP Receiver State Diagram

  27. How Much Sender Can Send The sender must always ensure that:LastByteSent  LastByteAcked  min{CongWindow, RcvWindow}  the amount of unacknowledged data should never exceed:FlightSize = LastByteSent  LastByteAcked min{CongWindow, RcvWindow} TCP session invariant (“allowed to send”):EffectiveWindow = min{CongWindow, RcvWindow}  FlightSize

  28. How TCP Sender DetectsSegment Loss • Retransmission timer (RTO) expiration • Reception of three duplicate ACKs(four identical ACKs without the arrival of any other intervening packets)Why threedupACKs: • If there is just a reordering of the segments, there will be only one or two dupACKs before the reordered segment is processed, which will then generate a regular ACK. • If three or more dupACKs are received in a row, it is a strong indication that a segment has been lost.

  29. How TCP Sender DetectsSegment Loss

  30. Slow Start Threshold Determines when the “slow start” phase ends and the “congestion avoidance” phase begins SSThresh = max {½ FlightSize, 2MSS}

  31. TCP Tahoe Sender (Effective Window computed as before …) When packet loss detected via 3  dupACKs: SSThresh(t) = max {½ CongWindow(t1), 2MSS} (2.4) Congestion Window computation under Congestion Avoidance: Congestion Window computation under Congestion Avoidance: [bytes] (2.5)

  32. TCP-Tahoe Sender State Diagram “Send data”  “Retransmit”  1. Set CongWin & SSThresh 2. Send EfctWin of data, if any 3. Re-start RTO timer 1. Set CongWin & SSThresh 2. Re-send oldest outstanding segment 3. Double the RTO timer & re-start it

  33. TCP-Reno Sender State Diagram

  34. Example 2.1: TCP Bottleneck Link

  35. Detail of Transmission Round #5

  36. RTO Timer Timeout Pattern

  37. TCP Tahoe (2) MSS = 1024 bytes, RcvWindow = 64 KB

  38. TCP Tahoe (3)

  39. TCP Sender States / Phases Slow Start: Defined by: Congestion Window (CW)  SSThresh Congestion Window calculation: CW(t) = CW(t – 1) + #ACKMSS Fast Retransmit: Defined as:When 3  dupACKs received, retransmit the oldest outstanding packet without waiting for RTO timeout Congestion Avoidance: Defined by: Congestion Window (CW) > SSThresh Congestion Window calculation: CW(t) = CW(t – 1) + MSS #ACKMSS CW(t – 1)

  40. Reno-Specific State / Phase Same as for Tahoe: Slow Start, Fast Retransmit, Congestion Avoidance Fast Recovery: Defined as:When 3  dupACKs received, Congestion Window calculation: CW(t) = max {½ FlightSize(t), 2MSS} + 3MSS ( Unlike TCP Tahoe sender, which sets CW(t) = 1MSS when 3  dupACKs received )

  41. TCP Reno Sender (Effective Window computed as before …) When packet loss detected via 3  dupACKs: SSThresh(t) = max {½ FlightSize(t1), 2MSS} (2.6) CongWindow(t) = SSThresh(t) + 3MSS (2.7) Enter Fast Recovery: count each “old ACK” as +MSS to CongWin. When “new ACK” received, exit Fast Recovery and enter Congestion Avoidance. CongWindow = SSThresh (2.8)

  42. TCP Reno (1)

  43. TCP Reno (2)

  44. Topic:TCP NewReno Protocol  Partial ACKs for Pkt Loss Detection  Example

  45. How TCP Sender Discovers Packet Loss TCP Tahoe & TCP Reno TCP NewReno • Retransmission timer (RTO) expired •  3  dupACKs received • Partial ACK received

  46. TCP NewReno – Partial ACKs Defined at the time tloss when the sender discovers a packet loss (by 3  dupACKs): Full acknowledgment: If the sender will receive an ACK for all packets that were outstanding at the time tloss Partial acknowledgment: If the sender will receive an ACK for some of the packets that were outstanding at the time tloss

  47. TCP NewReno tloss At this time define: Full acknowledgment = ACK for all 6 outstanding pkts

  48. TCP NewReno Fast Recovery NewReno sender entersFast Recovery when a loss is detected (by 3  dupACKs) NewReno sender exitsFast Recovery when it receives the full acknowledgement(defined at time tloss) After Fast Recovery, NewReno sender enters Congestion Avoidance

  49. Congestion Window Calculationduring Fast Recovery NewlyAcked =LastByteAcked(t) LastByteAcked(t 1) If (NewlyAcked <MSS), thenCongWindow(t) =CongWindow(t 1)  NewlyAcked Else if (NewlyAcked  MSS), thenCongWindow(t) =CongWindow(t 1)  NewlyAcked + MSS

More Related