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.

Slides:



Advertisements
Similar presentations
Simulation-based Comparison of Tahoe, Reno, and SACK TCP Kevin Fall & Sally Floyd Presented: Heather Heiman September 10, 2002.
Advertisements

Flow control Connection management TCP, UDP
1 Transport Protocols & TCP CSE 3213 Fall April 2015.
TCP: Transmission Control Protocol Overview Connection set-up and termination Interactive Bulk transfer Timers Improvements.
1 Transport Protocols Relates to Lab 5. UDP and TCP.
Flow and Error Control. Flow Control Flow control coordinates the amount of data that can be sent before receiving acknowledgement It is one of the most.
1 TCP - Part II. 2 What is Flow/Congestion/Error Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver with information.
1 TCP CSE May TCP Services Flow control Connection establishment and termination Congestion control 2.
School of Information Technologies TCP Congestion Control NETS3303/3603 Week 9.
TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
1 Spring Semester 2007, Dept. of Computer Science, Technion Internet Networking recitation #7 TCP New Reno Vs. Reno.
1 Internet Networking Spring 2002 Tutorial 10 TCP NewReno.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
1 Internet Networking Spring 2004 Tutorial 10 TCP NewReno.
CMPE 257 Spring CMPE 257: Wireless and Mobile Networking Spring 2005 E2E Protocols (point-to-point)
1 K. Salah Module 6.1: TCP Flow and Congestion Control Connection establishment & Termination Flow Control Congestion Control QoS.
TCP: flow and congestion control. Flow Control Flow Control is a technique for speed-matching of transmitter and receiver. Flow control ensures that a.
CS 4396 Computer Networks Lab
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapter 11 Data Link Control Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
1 Transport Protocols (continued) Relates to Lab 5. UDP and TCP.
Chapter 5 Peer-to-Peer Protocols and Data Link Layer PART I: Peer-to-Peer Protocols ARQ Protocols and Reliable Data Transfer Flow Control.
1 Transport Layer Lecture 10 Imran Ahmed University of Management & Technology.
1 TCP III - Error Control TCP Error Control. 2 ARQ Error Control Two types of errors: –Lost packets –Damaged packets Most Error Control techniques are.
Malathi Veeraraghavan Originals by Jörg Liebeherr 1 Error Control Congestion Control Timers.
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.
Lecture 9 – More TCP & Congestion Control
Chapter 3: Channel Coding (part 3). Automatic repeat request (ARQ) protocols ▫Used in combination with error detection/correction ▫Block of data with.
CS640: Introduction to Computer Networks Aditya Akella Lecture 15 TCP – III Reliability and Implementation Issues.
Computer Networking Lecture 18 – More TCP & Congestion Control.
Lab The network simulator ns The network simulator ns Allows us to watch evolution of parameters like cwnd and ssthresh Allows us to watch evolution of.
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. 2 What is Flow/Congestion/Error Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver with information.
1 Computer Networks Congestion Avoidance. 2 Recall TCP Sliding Window Operation.
Malathi Veeraraghavan Originals by Jörg Liebeherr 1 Data Transfer in TCP Acknowledgements Flow Control.
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 Congestion Control 컴퓨터공학과 인공지능 연구실 서 영우. TCP congestion control2 Contents 1. Introduction 2. Slow-start 3. Congestion avoidance 4. Fast retransmit.
Fall 2004FSU CIS 5930 Internet Protocols1 TCP – Data Exchange Reading: Section 24.4.
Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.
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.
DATA LINK CONTROL. DATA LINK LAYER RESPONSIBILTIES  FRAMING  ERROR CONTROL  FLOW CONTROL.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 4 : Chapter 7 Data & computer.
Data Link Layer.
Malathi Veeraraghavan Originals by Jörg Liebeherr 1 Congestion Control TCP implements congestion control at the sender –This control is intended to reduce.
TCP - Part II.
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP flow control, congestion control, and error control in TCP.
Reliable Transmission
Data Link Layer Flow Control.
TCP - Part III TCP Timers Selective Acknowledgements.
Introduction to Congestion Control
TCP Wrap-up TCP Timers Selective Acknowledgements.
Chapter 17 and 18: TCP is connection oriented
Chapter 5: Transport Protocols
Instructor Mazhar Hussain
Flow 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.
Flow and Error Control.
TCP - Part II Suman Banerjee CS 640, UW-Madison
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Lecture 18 – More TCP & Congestion Control
TCP III - Error Control TCP Error Control.
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Lecture 4 Peer-to-Peer Protocols and Data Link Layer
TCP: Transmission Control Protocol Part II : Protocol Mechanisms
Presentation transcript:

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 TCP.

2 Interactive and bulk data TCP applications can be put into the following categories bulk data transfer- ftp, mail, http interactive data transfer- telnet, rlogin TCP has algorithms to deal which each type of applications efficiently.

3 tcpdump of an rlogin session This is the output of typing 3 (three) characters : argon.cs.virginia.edu.1023 > neon.cs.virginia.edu.login: P 0:1(1) ack neon.cs.virginia.edu.login > argon.cs.virginia.edu.1023: P 1:2(1) ack 1 win argon.cs.virginia.edu.1023 > neon.cs.virginia.edu.login:. ack 2 win argon.cs.virginia.edu.1023 > neon.cs.virginia.edu.login: P 1:2(1) ack 2 win neon.cs.virginia.edu.login > argon.cs.virginia.edu.1023: P 2:3(1) ack 2 win argon.cs.virginia.edu.1023 > neon.cs.virginia.edu.login:. ack 3 win : argon.cs.virginia.edu.1023 > neon.cs.virginia.edu.login: P 2:3(1) ack 3 win : neon.cs.virginia.edu.login > argon.cs.virginia.edu.1023: P 3:4(1) ack 3 win : argon.cs.virginia.edu.1023 > neon.cs.virginia.edu.login:. ack 4 win 17520

4 Rlogin “Rlogin” is a remote terminal applications Originally build only for Unix systems. Rlogin sends one segment per character (keystroke) Receiver echoes the character back. So, we really expect to have four segments per keystroke Q: What is the total number of bytes transmitted for a single keystroke?

5 Rlogin We would expect that tcpdump shows this pattern: However, tcpdump shows this pattern: So, TCP has delayed the transmission of an ACK

6 Delayed Acknowledgement TCP delays transmission of ACKs for up to 200ms The hope is to have data ready in that time frame. Then, the ACK can be piggybacked with the data segment. Delayed ACKs explain why the ACK and the “echo of character” are sent in the same segment. What are the delays of the ACKs in the tcpdump example?

7 tcpdump of a wide-area rlogin session This is the output of typing 9 characters : 54: argon.cs.virginia.edu.1023 > tenet.CS.Berkeley.EDU.login: P 1:2(1) ack 2 win : tenet.CS.Berkeley.EDU.login > argon.cs.virginia.edu.1023: P 2:3(1) ack 2 win : argon.cs.virginia.edu.1023 > tenet.CS.Berkeley.EDU.login: P 2:3(1) ack 3 win : tenet.CS.Berkeley.EDU.login > argon.cs.virginia.edu.1023: P 3:4(1) ack 3 win : argon.cs.virginia.edu.1023 > tenet.CS.Berkeley.EDU.login: P 3:4(1) ack 4 win : tenet.CS.Berkeley.EDU.login > argon.cs.virginia.edu.1023: P 4:5(1) ack 4 win : argon.cs.virginia.edu.1023 > tenet.CS.Berkeley.EDU.login: P 4:8(4) ack 5 win : tenet.CS.Berkeley.EDU.login > argon.cs.virginia.edu.1023: P 5:9(4) ack 8 win 16384

8 Wide-area Rlogin: Observation 1 Transmission of segments follows a different pattern. The delayed acknowled- gment does not kick in Reason is that there is always data at aida when the ACK arrives.

9 Wide-area Rlogin: Observation 2 There are fewer transmissions than there are characters. Aida never has multiple segments outstanding. This is due to Nagle’s Algorithm: Each TCP connection can have only one small (1-byte) segment outstanding that has not been acknowledged. Implementation: Send one byte and buffer all subsequent bytes until acknowledgement is received.Then send all buffered bytes in a single segment. (Only enforced if byte is arriving from application one byte at a time) Nagle’s rule reduces the amount of small segments. The algorithm can be disabled.

10 Flow Control Congestion Control Error Control TCP:

11 What is Flow/Congestion/Error Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver with information? Congestion Control: Algorithms to prevent that the sender overloads the network Error Control: Algorithms to recover or conceal the effects from packet losses  The goal of each of the control mechanisms are different.  But the implementation is combined

12 TCP Flow Control

13 TCP Flow Control TCP implements sliding window flow control Sending acknowledgements is separated from setting the window size at sender. Acknowledgements do not automatically increase the window size Acknowledgements are cumulative

14 Sliding Window Flow Control Sliding Window Protocol is performed at the byte level: Here: Sender can transmit sequence numbers 6,7,8.

15 Sliding Window: “Window Closes” Transmission of a single byte (with SeqNo = 6) and acknowledgement is received (AckNo = 5, Win=4):

16 Sliding Window: “Window Opens” Acknowledgement is received that enlarges the window to the right (AckNo = 5, Win=6): A receiver opens a window when TCP buffer empties (meaning that data is delivered to the application).

17 Sliding Window: “Window Shrinks” Acknowledgement is received that reduces the window from the right (AckNo = 5, Win=3): Shrinking a window should not be used

18 Window Management in TCP The receiver is returning two parameters to the sender The interpretation is: I am ready to receive new data with SeqNo= AckNo, AckNo+1, …., AckNo+Win-1 Receiver can acknowledge data without opening the window Receiver can change the window size without acknowledging data

19 Sliding Window: Example

20 TCP Congestion Control

21 TCP Congestion Control TCP has a mechanism for congestion control. The mechanism is implemented at the sender The window size at the sender is set as follows: where flow control window is advertised by the receiver congestion window is adjusted based on feedback from the network Send Window = MIN (flow control window, congestion window)

22 TCP Congestion Control The sender has two additional parameters: –Congestion Window (cwnd) Initial value is 1 MSS (=maximum segment size) counted as bytes –Slow-start threshhold Value (ssthresh) Initial value is the advertised window size) Congestion control works in two modes: –slow start (cwnd < ssthresh) –congestion avoidance (cwnd >= ssthresh)

23 Slow Start Initial value: –cwnd = 1 segment Note: cwnd is actually measured in bytes: 1 segment = MSS bytes Each time an ACK is received, the congestion window is increased by MSS bytes. –cwnd = cwnd + 1 –If an ACK acknowledges two segments, cwnd is still increased by only 1 segment. –Even if ACK acknowledges a segment that is smaller than MSS bytes long, cwnd is increased by 1. Does Slow Start increment slowly? Not really. In fact, the increase of cwnd can be exponential

24 Slow Start Example The congestion window size grows very rapidly –For every ACK, we increase cwnd by 1 irrespective of the number of segments ACK’ed TCP slows down the increase of cwnd when cwnd > ssthresh

25 Congestion Avoidance Congestion avoidance phase is started if cwnd has reached the slow-start threshold value If cwnd >= ssthresh then each time an ACK is received, increment cwnd as follows: cwnd = cwnd + 1/ [cwnd] Where [cwnd] is the largest integer smaller than cwnd So cwnd is increased by one segment (=MSS bytes) only if all segments have been acknowledged.

26 Slow Start / Congestion Avoidance Here we give a more accurate version than in our earlier discussion of Slow Start: If cwnd <= ssthresh then Each time an Ack is received: cwnd = cwnd + 1 else /* cwnd > ssthresh */ Each time an Ack is received : cwnd = cwnd + 1 / [ cwnd ] endif

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

28 Responses to Congestion Most often, a packet loss in a network is due to an overflow at a congested router (rather than due to a transmission error) So, TCP assumes there is congestion if it detects a packet loss A TCP sender can detect lost packets via: Timeout of a retransmission timer Receipt of a duplicate ACK When TCP assumes that a packet loss is caused by congestion and reduces the size of the sending window

29 TCP Tahoe Congestion is assumed if sender has timeout or receipt of duplicate ACK Each time when congestion occurs, –cwnd is reset to one: cwnd = 1 –ssthresh is set to half the current size of the congestion window: ssthressh = cwnd / 2 –and slow-start is entered

30 Slow Start / Congestion Avoidance A typical plot of cwnd for a TCP connection (MSS = 1500 bytes) with TCP Tahoe:

31 TCP Error Control Background on Error Control TCP Error Control

32 Background: ARQ Error Control Two types of errors: –Lost packets –Damaged packets Most Error Control techniques are based on: 1. Error Detection Scheme (Parity checks, CRC). 2. Retransmission Scheme. Error control schemes that involve error detection and retransmission of lost or corrupted packets are referred to as Automatic Repeat Request (ARQ) error control.

33 Background: ARQ Error Control All retransmission schemes use all or a subset of the following procedures: Positive acknowledgments (ACK) Negative acknowledgment (NACK) All retransmission schemes (using ACK, NACK or both) rely on the use of timers The most common ARQ retransmission schemes are: Stop-and-Wait ARQ Go-Back-N ARQ Selective Repeat ARQ

34 Background: ARQ Error Control The most common ARQ retransmission schemes: –Stop-and-Wait ARQ –Go-Back-N ARQ –Selective Repeat ARQ The protocol for sending ACKs in all ARQ protocols are based on the sliding window flow control scheme

35 Background: Stop-and-Wait ARQ Stop-and-Wait ARQ is an addition to the Stop-and-Wait flow control protocol: Packets have 1-bit sequence numbers (SN = 0 or 1) Receiver sends an ACK (1-SN) if packet SN is correctly received Sender waits for an ACK (1-SN) before transmitting the next packet with sequence number 1-SN If sender does not receive anything before a timeout value expires, it retransmits packet SN

36 Background: Stop-and-Wait ARQ Packet 1 Lost Packet A B ACK 0 Packet 0 Timeout ACK 1 Packet 1 ACK 0

37 Background: Go-Back-N ARQ Operations: –A station may send multiple packets as allowed by the window size –Receiver sends a NAK i if packet i is in error. After that, the receiver discards all incoming packets until the packet in error was correctly retransmitted –If sender receives a NAK i it will retransmit packet i and all packets i+1, i+2,... which have been sent, but not been acknowledged

38 Example of Go-Back-N ARQ In Go-back-N, if packets are correctly delivered, they are delivered in the correct sequence Therefore, the receiver does not need to keep track of `holes’ in the sequence of delivered packets

39 Background: Go-Back-N ARQ Packet 0 Lost Packet A B Packet 2Packet 4Packet 1Packet 3 ACK 3 Packet 5Packet 6Packet 4Packet 5Packet 6 Packets 4,5,6 are retransmitted ACK 6 Packets 5 and 6 are discarded Timeout for Packet 2

40 Background: Selective-Repeat ARQ Similar to Go-Back-N ARQ. However, the sender only retransmits packets for which a time-out occured is received Advantage over Go-Back-N: –Fewer Retransmissions. Disadvantages: –More complexity at sender and receiver –Each packet must be acknowledged individually (no cumulative acknowledgements) –Receiver may receive packets out of sequence

41 Example of Selective-Repeat ARQ Receiver must keep track of `holes’ in the sequence of delivered packets Sender must maintain one timer per outstanding packet

42 Timeout for Packet 4: only Packet 4 is retransmitted Background: Selective-Repeat ARQ Packet 0 Lost Packet A B Packet 2Packet 1Packet 3 ACK 2 Packet 5Packet 6 ACK 6 Packet 4Packet 7Packet 0 ACK 7 ACK 1 ACK 3ACK 4 Packet 4 Packets 5 and 6 are buffered ACK 5ACK 0ACK 1

43 Error Control in TCP TCP implements a variation of the Go-back-N retransmission scheme TCP maintains a Retransmission Timer for each connection: –The timer is started during a transmission. A timeout causes a retransmission TCP couples error control and congestion control (I.e., it assumes that errors are caused by congestion) TCP allows accelerated retransmissions (Fast Retransmit)

44 TCP Retransmission Timer Retransmission Timer: –The setting of the retransmission timer is crucial for efficiency –Timeout value too small  results in unnecessary retransmissions –Timeout value too large  long waiting time before a retransmission can be issued –A problem is that the delays in the network are not fixed –Therefore, the retransmission timers must be adaptive

45 Round-Trip Time Measurements The retransmission mechanism of TCP is adaptive The retransmission timers are set based on round-trip time (RTT) measurements that TCP performs The RTT is based on time difference between segment transmission and ACK But: TCP does not ACK each segment Each connection has only one timer

46 Round-Trip Time Measurements Retransmission timer is set to a Retransmission Timeout (RTO) value. RTO is calculated based on the RTT measurements. The RTT measurements are smoothed by the following estimators srtt and rttvar: srtt n+1 =  RTT + (1-  ) srtt n rttvar n+1 =  ( | RTT - srtt n+1 | ) + (1-  ) rttvar n RTO n+1 = srtt n rttvar n+1 The gains are set to  =1/4 and  =1/8 srtt 0 = 0 sec, rttvar 0 = 3 sec, Also: RTO 1 = srtt rttvar 1

47 Karn’s Algorithm If an ACK for a retransmitted segment is received, the sender cannot tell if the ACK belongs to the original or the retransmission. Karn’s Algorithm: Don’t update srtt on any segments that have been retransmitted. Each time when TCP retransmits, it sets: RTO n+1 = max ( 2 RTO n, 64) (exponential backoff)

48 Measuring TCP Retransmission Timers Transfer file from Argon to neonn Unplug Ethernet of Argon cable in the middle of file transfer

49 Interpreting the Measurements The interval between retransmission attempts in seconds is: 1.03, 3, 6, 12, 24, 48, 64, 64, 64, 64, 64, 64, 64. Time between retrans- missions is doubled each time (Exponential Backoff Algorithm) Timer is not increased beyond 64 seconds TCP gives up after 13th attempt and 9 minutes.