1 Data Transmissions in TCP Dr. Rocky K. C. Chang 17 October 2006.

Slides:



Advertisements
Similar presentations
1 Transport Protocols & TCP CSE 3213 Fall April 2015.
Advertisements

Transport Layer – TCP (Part2) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
CSCI 4550/8556 Computer Networks
Slide Set 13: TCP. In this set.... TCP Connection Termination TCP State Transition Diagram Flow Control How does TCP control its sliding window ?
Fundamentals of Computer Networks ECE 478/578 Lecture #20: Transmission Control Protocol Instructor: Loukas Lazos Dept of Electrical and Computer Engineering.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Provides a reliable unicast end-to-end byte stream over an unreliable internetwork.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
1 TCP - Part II. 2 What is Flow/Congestion/Error Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver with information.
Fundamentals of Computer Networks ECE 478/578 Lecture #21: TCP Window Mechanism Instructor: Loukas Lazos Dept of Electrical and Computer Engineering University.
TCP© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science Department.
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 TCP (Part III: Miscl) Shivkumar Kalyanaraman Rensselaer Polytechnic Institute
1 K. Salah Module 6.1: TCP Flow and Congestion Control Connection establishment & Termination Flow Control Congestion Control QoS.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
TCP: flow and congestion control. Flow Control Flow Control is a technique for speed-matching of transmitter and receiver. Flow control ensures that a.
1 Transport Layer Computer Networks. 2 Where are we?
COMT 4291 Communications Protocols and TCP/IP COMT 429.
TCP Timers Chia-tai Tsai Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.
Copyright © Lopamudra Roychoudhuri
1 TCP : Transmission Control Protocol ( Stevens TCP/ IP Illustrated Volume 1) TCP is connection oriented Unit of information passed by TCP to IP is a segment.
3: Transport Layer3b-1 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection m MSS: maximum.
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.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Chapter 12 Transmission Control Protocol (TCP)
1 TCP: Reliable Transport Service. 2 Transmission Control Protocol (TCP) Major transport protocol used in Internet Heavily used Completely reliable transfer.
2000 년 11 월 20 일 전북대학교 분산처리실험실 TCP Flow Control (nagle’s algorithm) 오 남 호 분산 처리 실험실
Malathi Veeraraghavan Originals by Jörg Liebeherr 1 Error Control Congestion Control Timers.
Copyright 2008 Kenneth M. Chipps Ph.D. Controlling Flow Last Update
Copyright © Lopamudra Roychoudhuri
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.
Chapter 24 Transport Control Protocol (TCP) Layer 4 protocol Responsible for reliable end-to-end transmission Provides illusion of reliable network to.
Computer Networking Lecture 18 – More TCP & Congestion Control.
TCP: Transmission Control Protocol Part II : Protocol Mechanisms Computer Network System Sirak Kaewjamnong Semester 1st, 2004.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
1 TCP Timeout And Retransmission Chapter 21 TCP sets a timeout when it sends data and if data is not acknowledged before timeout expires it retransmits.
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.
1 TCP - Part II. 2 What is Flow/Congestion/Error Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver with information.
ECE 4110 – Internetwork Programming
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 TCP.
TCP Timeout and Retransmission
TCP continued. Discussion – TCP Throughput TCP will most likely generate the saw tooth type of traffic. – A rough estimate is that the congestion window.
Fall 2004FSU CIS 5930 Internet Protocols1 TCP – Data Exchange Reading: Section 24.4.
TCP as a Reliable Transport. How things can go wrong… Lost packets Corrupted packets Reordered packets …Malicious packets…
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.
11 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
Computer Networks 1000-Transport layer, TCP Gergely Windisch v spring.
Computer Networking Lecture 16 – Reliable Transport.
Chapter 5 Peer-to-Peer Protocols and Data Link Layer Timing Recovery.
1 Transmission Control Protocol (TCP) RFC: Introduction The TCP is intended to provide a reliable process-to-process communication service in a.
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
3. END-TO-END PROTOCOLS (PART 2) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
TCP - Part II.
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
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 - Part III TCP Timers Selective Acknowledgements.
Chapter 5 TCP Sequence Numbers & TCP Transmission Control
TCP Wrap-up TCP Timers Selective Acknowledgements.
5. End-to-end protocols (part 1)
Chapter 17 and 18: TCP is connection oriented
Computer Networks Bhushan Trivedi, Director, MCA Programme, at the GLS Institute of Computer Technology, Ahmadabad.
Chapter 5 TCP Transmission Control
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP flow control, congestion control, and error control in TCP.
5. End-to-end protocols (part 2)
TCP: Transmission Control Protocol Part II : Protocol Mechanisms
Presentation transcript:

1 Data Transmissions in TCP Dr. Rocky K. C. Chang 17 October 2006

2 TCP sliding window protocol  The classical TCP employs a sliding window protocol with +ve acknowledgment and without selective repeat. Recover lost data, and perform congestion and flow control.  Failure of receiving ACKs within a timeout period is possibly due to Data/ACKs dropped by intermediate routers or end hosts due to errors, or Data/ACKs dropped by intermediate routers due to congestion, or

3 TCP sliding window protocol Data/ACKs dropped by end hosts due to a lack of buffer (overflow) Packet reordering  The size of the sender’s sliding window Determines the rate of sending segments, and is Determined jointly by the sender and receiver.  Max. throughput = min{( SND_WND * 8)/RTT, B} SND_WND is the sender window’s size in bytes. B is the network bandwidth in bits/second. RTT is the round-trip time.

4 TCP sliding window protocol sender receiver ACK 1st byte of data

5 TCP buffering Application buffer Socket send buffer Kernel Application Application data Application segmentation TCP segmentation (segments not larger than MSS) Application buffer Application data Socket receive buffer

6 Send sequence space  Each segment written to the socket send buffer can be in any of the following states: Sent and acknowledged (removed from buffers) Sent and unacknowledged Can be sent immediately Cannot be sent until the window moves  Use three variables: SND_WND : size of the send window SND_UNA : oldest unacknowledged SN SND_NXT : SN of the next segment to be sent

7 Send sequence space  Assume here that the sender’s window is determined only by the receiver’s offered window size.  An acceptable ACK is one for which SND_UNA  AN  SND_NXT AN = SND_UNA is a duplicate ACK.  When a segment is retransmitted, SND_NXT is set to an older value.  What is the condition for “all segments have been acknowledged?” The condition is given by snd_nxt = snd_una The condition is given by snd_nxt = snd_una

8 Send sequence space SND_UNASND_NXT SND_WND (advertised by the receiver) Sent and ackedSent and unackedCan sent ASAP Wait for the window

9 Receive sequence space  Use two variables: RCV_WND : size of the receive window RCV_NXT : SN of the next segment to be received  The receiver considers a received segment valid if all the data in a segment fit in the receive window: RCV_NXT  beginning SN of segment < RCV_NXT + RCV_WND, and RCV_NXT  ending SN of segment < RCV_NXT + RCV_WND.

10 Receive sequence space  An ACK may be sent when RCV_NXT = beginning SN of a received segment RCV_NXT RCV_WND (advertised to sender) Acked Future SNs

11 A processing sequence  When a TCP receiver is in the ESTABLISHED state, it will process a segment according to the following order: Check the SN. Check the RST bit. Check the security and precedence. Check the SYN bit. Check the AN. Check the URG bit. Process the segment text. Check the FIN bit.

12 Sequence number and max window size  Given a SN space, what is the maximum window size? Given a maximum window size, what is the smallest SN space?  The SN wraparound problem  Take a simplest case, let the maximum window size be 1.

13 Acknowledgment strategies  Send an ACK for every segment received (RFC 793). Cumulative acknowledgments When a out-of-ordered segment is received, send an ACK = RCV_NXT (a duplicate ACK).  Delayed acknowledgment (RFC 1122) Give the application an opportunity to update the window and perhaps to send a response. In remote login, a delayed ACK can reduce the number of segments by a factor of 3 (ACK, window update, and echo character).

14 Delayed acknowledgements However, excessive delays on ACKs can disturb the round-trip timing and packet “clocking” algorithms.  Guidelines in RFC 1122: In a stream of MSS-sized segments, there should be an ACK for at least every second segment. Should not delay sending acknowledgment for more than 500ms (delay acknowledgment timer).  Newer systems use 200ms instead (any time between 0 and 200ms).

15 Selective acknowledgements (SACKs)  When multiple segments are lost, the sender either wait a roundtrip time to find out about each lost segment, or to unnecessarily retransmit segments which have been correctly received.  SACK allows a receiver to acknowledge noncontiguous blocks of segments to the sender. The SACK option does not change the meaning of AN in the TCP header.

16 Selective acknowledgements (SACKs)  SACKs are implemented in two TCP options. SACK-Permitted option sent in a SYN segment. SACK option sent in data segments.

17 Retransmissions and repacketization  A sender may retransmit the segment starting with SN = SND_UNA : Upon retransmission timeout or Upon receiving the third duplicate ACK (fast retransmission).  When a retransmission takes place, the retransmitted segment may also include other segments. Linux does not repacketize old segments with new segments, but it repacketizes old segments with old segments.

18 Retransmissions and timeouts  BSD uses a coarse-grain timer for TCP’s six timers. The coarse-grain timer ticks off every 500ms. TCP timers: connection-establishment, retransmission, persist, keepalive, FIN_WAIT, TIME_WAIT  The retransmission timer is bounded between 1 and 64 seconds, and a function of the round-trip time estimate. It also depends on the time of starting the timer in reference to the coarse-grain timer.

19 Estimating the RTT  Problem: How does a TCP sender determine its timeout value? If over-estimate the timeout value, delay the retransmission. If under-estimate the timeout value, inject duplicate packets into the network.  TCP uses an adaptive transmission algorithm to accommodate varying delays in the Internet: A TCP sender monitors the RTT, either in coarse-grain or fine-grain measurement. Exponential backoff (will be discussed later)

20 RTT measurements and timeout  Given a new RTT measurement M, TCP updates an estimate of the average RTT by R  R + (1 )M.  is a filter gain constant (0 <  < 1), determining how much the new measurement contributes to the estimate.  is usually set to 0.9.  The timeout value RTO is set to R.  accounts for the variation in the RTT.  is usually set to 2.

21 RTT measure. and timeout (from [1])

22 A better estimator  Estimate the variation in the RTT by D  D + (1)|RM|. A mean deviation is used instead of standard deviation to avoid integer overflow due to multiplication. The mean deviation is also more conservative than the standard deviation.  The timeout value is now given by RTO = R + 2D or R + 4D.  How does the initialization of the parameters affect the estimator?

23 A better estimator (from [1])

24 Silly window syndrome (RFC 813)  SWS problem: “a stable pattern of small incremental window movements.” The sender window moves by a very small amount. The sender is forced to send small segments (smaller than MSS). SWS can only occur during the transmission of a large amount of data.

25 Sender-side SWS and Nagle algo.  For example, the sender window size = 4*MSS. After sending 3 MSS-sized segments, the sender only has 0.5*MSS of data to send. Shortly after, the sender also sends another 0.5*MSS of data. When the ACK for the first 0.5*MSS data returns, the sender can only send 0.5*MSS, instead of an MSS-sized segment.

26 Sender-side SWS and Nagle algo.  Nagle algorithm (RFC 896) If a TCP sender has less than an MSS-sized segment to transmit, and if any previous segment had not yet been acknowledged, do not transmit the segment. Open-loop congestion avoidance mechanism  Nagle’s algorithm needs to be turned off for some applications, e.g., X-window, and transaction-based applications.

27 Receiver-side SWS and delayed ACK  The sender window can also be advanced incrementally when the receiver sends ACKs too frequent or/and increase the offered window size by small amounts.  Receiver-side SWS solutions: Delayed acknowledgment (probably with a new window update). Send a window update only if it could advance by a “significant amount.”  E.g., 35% of the receive buffer size or 2*MSS.

28 Temporary deadlocks  Temporary deadlocks as a result of an interaction between Nagle algorithm and the receiver-side SWS algorithms. Nagle algorithm prevents the sender from sending more data. The delayed ACK algorithm and window update algorithm prevent the receiver from sending ACK and window updates.  For example, the send window = 2*MSS and the data passed to the TCP socket buffer is slightly less than 4*MSS.

29 Temporary deadlocks S-->R: 2 MSS-sized segments and then stop (due to the window full). R-->S: 1 ACK for the 2 segments (based on ACK every other MSS-sized segment) S-->R: 1 MSS-sized segment and then stop (due to Nagle algorithm). R-->S: Do not send an ACK or window update immediately after receiving the 3rd MSS-sized segment (due to the receiver-side SWS algms). R-->S: Send an ACK after 200ms when the delayed ACK timer fires.

30 Temporary deadlocks S-->R: After receiving the ACK, send the last nonMSS-sized segment. The total time required is 3*RTT + 200ms, instead of 2*RTT.  Similar temporary deadlocks can occur when there is an application buffer tearing, the socket send buffer is not large enough, and the MTU is too large.

31 Zero advertised window  Problem: A deadlock occurs when segment 9 is lost or corrupted. ACKs are not reliable win 0 win senderreceiver

32 Persist timer  Solution: A sender uses a persist timer to periodically send a window probe when the receive window closes up. Exponential backoff until the period reaches a limit, say 2 minutes. Then a window probe is sent every 2 minutes until the window opens up or either side of the application closes.  The window probe contains 1 byte of data.  TCP is always allowed to send 1 byte of data beyond the end of a closed window.

33 An idle TCP connection  If neither process at the ends of a TCP connection are sending data, nothing is exchanged between the two processes. Assume that the application protocol that uses the TCP does not detect inactivity. If a router or a link between them is down and is restored later on, can the two ends still use the connection?  A keepalive timer is (normally) used by a server to know whether a client is crashed and is down, or is crashed or is rebooted.

34 Keepalive timer  If there is no activity on a TCP connection for 2 hours, the server sends a probe segment to the client. If the client is up, it responds to the probe. If the client has crashed and is still down, the server times out (after 75 sec) and resends the probe again (every 75 sec) for a number of times (10). If the client has crashed and is rebooted, the client responds by sending a RESET segment.

35 Summary  When moved to the Established state, TCP uses a sliding window protocol to control the transmission rate and recover lost segments.  TCP employs a cumulative ACK strategy with an optional SACK scheme.  Retransmissions take place upon timeouts which are functions of the RTT estimates.  Special care was taken to ensure that the sender window does not increase on small increments.

36 Summary  Temporary deadlock could occur when Nagle algorithm interacts with delayed ACK and window update algorithms.  Special care was also taken for special circumstances, such as zero window update and client crash before terminating the connection properly.

37 References 1. Requirements for Internet Hosts -- Communication Layers (RFC 1122) 2. Van Jacobson, “Congestion avoidance and control,” Proc. SIGCOMM, vol. 18, no. 4, Aug J. Mogul and G. Minshall, “Rethinking the TCP Nagle Algorithm,” ACM Computer and Commun. Review, Jan