TCP - Part II.

Slides:



Advertisements
Similar presentations
Flow control Connection management TCP, UDP
Advertisements

1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
1 Transport Protocols Relates to Lab 5. UDP and TCP.
1 Week 10 Transport Protocols, UDP, TCP. 2 Orientation r We move one layer up and look at the transport layer across the Internet.
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.
Fundamentals of Computer Networks ECE 478/578 Lecture #21: TCP Window Mechanism Instructor: Loukas Lazos Dept of Electrical and Computer Engineering University.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Computer Networks Transport Layer. Topics F Introduction  F Connection Issues F TCP.
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.
COMT 4291 Communications Protocols and TCP/IP COMT 429.
CS 4396 Computer Networks Lab
1 Transport Protocols (continued) Relates to Lab 5. UDP and TCP.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
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.
2000 년 11 월 20 일 전북대학교 분산처리실험실 TCP Flow Control (nagle’s algorithm) 오 남 호 분산 처리 실험실
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.
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 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.
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.
Fall 2004FSU CIS 5930 Internet Protocols1 TCP – Data Exchange Reading: Section 24.4.
Transmission Control Protocol (TCP) connection-oriented stream data transfer data sent as an unstructured stream of bytes reliability acknowledgements.
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.
Chapter 3 Transport Layer
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.
Reliable Transmission
TCP - Part III TCP Timers Selective Acknowledgements.
Transmission Control Protocol (TCP) Retransmission and Time-Out
Chapter 5 TCP Sequence Numbers & TCP Transmission Control
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 full duplex data:
Transport Control Protocol
Chapter 15 Transmission Control Protocol (TCP)
TCP Wrap-up TCP Timers Selective Acknowledgements.
5. End-to-end protocols (part 1)
Chapter 17 and 18: TCP is connection oriented
Chapter 5: Transport Protocols
TCP.
PART 5 Transport Layer Computer Networks.
Instructor Mazhar Hussain
Flow Control.
Transport Layer Unit 5.
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.
Flow and Error Control.
TCP - Part II Suman Banerjee CS 640, UW-Madison
PUSH Flag A notification from the sender to the receiver to pass all the data the receiver has to the receiving application. Some implementations of TCP.
TCP Overview Connection-oriented Byte-stream Full duplex
CS4470 Computer Networking Protocols
Transport Control Protocol
Lecture 18 – More TCP & Congestion Control
Chapter 17. Transport Protocols
State Transition Diagram
TCP III - Error Control TCP Error Control.
TCP: Transmission Control Protocol Part II : Protocol Mechanisms
Presentation transcript:

TCP - Part II

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

Acknowledgements in TCP TCP receivers use acknowledgments (ACKs) to confirm the receipt of data to the sender Acknowledgment can be added (“piggybacked”) to a data segment that carries data in the opposite direction ACK information is included in the the TCP header Acknowledgements are used for flow control, error control, and congestion control Data for B Data for A ACK B A ACK

Sequence Numbers and Acknowledgments in TCP TCP uses sequence numbers to keep track of transmitted and acknowledged data Each transmitted byte of payload data is associated with a sequence number Sequence numbers count bytes and not segments Sequence number of first byte in payload is written in SeqNo field Sequence numbers wrap when they reach 232-1 The sequence number of the first sequence number (Initial sequence number) is negotiated during connection setup

Sequence Numbers and Acknowledgments in TCP An acknowledgment is a confirmation of delivery of data When a TCP receiver wants to acknowledge data, it writes a sequence number in the AckNo field, and sets the ACK flag IMPORTANT: An acknowledgment confirms receipt for all unacknowledged data that has a smaller sequence number than given in the AckNo field Example: AckNo=5 confirms delivery for 1,2,3,4 (but not 5).

Cumulative Acknowledgements TCP has cumulative acknowledgements: An acknowledgment confirms the receipt of all unacknowledged data with a smaller sequence number SeqNo=0 10 bytes SeqNo=10 10 bytes SeqNo=20 10 bytes SeqNo=30 10 bytes SeqNo=40 10 bytes SeqNo=50 10 bytes SeqNo=60 10 bytes SeqNo=70 10 bytes SeqNo=80 10 bytes SeqNo=90 10 bytes A B ACK 10 ACK 20 ACK 40 ACK 70 ACK 100

Cumulative Acknowledgements With cumulative ACKs, the receiver can only acknowledge a segment if all previous segments have been received With cumulative ACKs, receiver cannot selectively acknowledge blocks of segments: e.g., ACK for S0-S3 and S5-S7 (but not for S4) Note: The use of cumulative ACKs imposes constraints on the retransmission schemes: In case of an error, the sender may need to retransmit all data that has not been acknowledged

Rules for sending Acknowledgments TCP has rules that influence the transmission of acknowledgments Rule 1: Delayed Acknowledgments Goal: Avoid sending ACK segments that do not carry data Implementation: Delay the transmission of (some) ACKs Rule 2: Nagle’s rule Goal: Reduce transmission of small segments Implementation: A sender cannot send multiple segments with a 1-byte payload (i.e., it must wait for an ACK)

Observing Delayed Acknowledgements Remote terminal applications (e.g., Telnet) send characters to a server. The server interprets the character and sends the output at the server to the client. For each character typed, you see three packets: Client  Server: Send typed character Server  Client: Echo of character (or user output) and acknowledgement for first packet Client  Server: Acknowledgement for second packet

Observing Delayed Acknowledgements This is the output of typing 3 (three) characters : Time 44.062449: Argon  Neon: Push, SeqNo 0:1(1), AckNo 1 Time 44.063317: Neon  Argon: Push, SeqNo 1:2(1), AckNo 1 Time 44.182705: Argon  Neon: No Data, AckNo 2 Time 48.946471: Argon  Neon: Push, SeqNo 1:2(1), AckNo 2 Time 48.947326: Neon  Argon: Push, SeqNo 2:3(1), AckNo 2 Time 48.982786: Argon  Neon: No Data, AckNo 3 Time 55.116581: Argon  Neon: Push, SeqNo 2:3(1) AckNo 3 Time 55.117497: Neon  Argon: Push, SeqNo 3:4(1) AckNo 3 Time 55.183694: Argon  Neon: No Data, AckNo 4

Why 3 segments per character? We would expect four segments per character: But we only see three segments per character: This is due to delayed acknowledgements

Delayed Acknowledgement TCP delays transmission of ACKs for up to 200ms Goal: Avoid to send ACK packets that do not carry data. The hope is that, within the delay, the receiver will have data ready to be sent to the receiver. Then, the ACK can be piggybacked with a data segment In Example: Delayed ACK explains why the “ACK of character” and the “echo of character” are sent in the same segment The duration of delayed ACKs can be observed in the example when Argon sends ACKs Exceptions: ACK should be sent for every second full sized segment Delayed ACK is not used when packets arrive out of order

Delayed Acknowledgement Because of delayed ACKs, an ACK is often observed for every other segment SeqNo=0 10 bytes SeqNo=10 10 bytes SeqNo=20 10 bytes SeqNo=30 10 bytes SeqNo=40 10 bytes SeqNo=50 10 bytes SeqNo=60 10 bytes SeqNo=70 10 bytes SeqNo=80 10 bytes A B Max. Delay for an ACK ACK 20 ACK 40 ACK 50 ACK 70 ACK 90

Observing Nagle’s Rule This is the output of typing 7 characters : Time 16.401963: Argon  Tenet: Push, SeqNo 1:2(1), AckNo 2 Time 16.481929: Tenet  Argon: Push, SeqNo 2:3(1) , AckNo 2 Time 16.482154: Argon  Tenet: Push, SeqNo 2:3(1) , AckNo 3 Time 16.559447: Tenet  Argon: Push, SeqNo 3:4(1), AckNo 3 Time 16.559684: Argon  Tenet: Push, SeqNo 3:4(1), AckNo 4 Time 16.640508: Tenet  Argon: Push, SeqNo 4:5(1) AckNo 4 Time 16.640761: Argon  Tenet: Push, SeqNo 4:8(4) AckNo 5 Time 16.728402: Tenet  Argon: Push, SeqNo 5:9(4) AckNo 8

Observing Nagle’s Rule Observation: Transmission of segments follows a different pattern, i.e., there are only two segments per character typed Delayed acknowledgment does not kick in at Argon The reason is that there is always data at Argon ready to sent when the ACK arrives Why is Argon not sending the data (typed character) as soon as it is available?

Observing Nagle’s Rule Observations: Argon never has multiple unacknowledged segments outstanding There are fewer transmissions than there are characters. This is due to Nagle’s Rule: 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) Goal of Nagle’s Rule: Reduce the amount of small segments. The algorithm can be disabled.

Nagle’s Rule Only one 1-byte segment can be in transmission (Here: Since no data is sent from B to A, we also see delayed ACKs) Typed characters A SeqNo=1, 4 byte SeqNo=0, 1 byte SeqNo=5, 5 byte B ACK 1 ACK 5 ACK 10 Delayed ACK Delayed ACK Delayed ACK

TCP Flow Control

TCP Flow Control TCP uses a version of the sliding window flow control, where Sending acknowledgements is separated from setting the window size at sender Acknowledgements do not automatically increase the window size During connection establishment, both ends of a TCP connection set the initial size of the sliding window

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

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

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

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

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

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

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

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

Sliding Window: Example

TCP Error Control

Error Control in TCP 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) Retransmission mechanism is part of congestion control algorithm Here: How to set the timeout value of the retransmission timer?

TCP 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

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

Round-Trip Time Measurements Retransmission timer is set to Retransmission Timeout (RTO) value. RTO is calculated based on the RTT measurements. The RTT measurements are smoothed by the following estimators srtt and rttvar: srttn+1 = a RTT + (1- a ) srttn rttvarn+1 = b ( | RTT - srttn | ) + (1- b ) rttvarn RTOn+1 = srttn+1 + 4 rttvarn+1 Gains are set to a =1/4 and b =1/8 If RTO is less than 1 second, it is rounded up to 1 second

Round-Trip Time Measurements Initial value: Value of RTO before first RTT measurement: RTO = 1 sec For the first RTT measurement srtt1 = RTT rttvar1 = RTT / 2 RTO1 = srtt1 + 4 rttvar1

Karn’s Algorithm 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: RTOn+1 = min ( 2 RTOn, 64) (exponential backoff)

Exponential Backoff Scenario: File transfer between two machines. Disconnect cable. 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.

Managing the RTO timer Recommended implementation has one timer per connection (Others may have one RTO timer for each segment) Start RTO timer, when a segment is transmitted and timer is not running (Timer is set to RTO value) Restart RTO timer, if ACK is received for new data Stop RTO timer, when all data is acknowledged When timer expires, retransmit first unacknowledged segment Use Karn’s algorithm and restart RTO timer RFC 6298: 5. Managing the RTO Timer