Chapter 5 TCP Sequence Numbers & TCP Transmission Control

Slides:



Advertisements
Similar presentations
CSCI-1680 Transport Layer II Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti Rodrigo Fonseca.
Advertisements

Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
1 Computer Networks: A Systems Approach, 5e Larry L. Peterson and Bruce S. Davie Chapter 5 End-to-End Protocols Copyright © 2010, Elsevier Inc. All rights.
Slide Set 13: TCP. In this set.... TCP Connection Termination TCP State Transition Diagram Flow Control How does TCP control its sliding window ?
CS 6401 Transport Control Protocol Outline TCP objectives revisited TCP basics New algorithms for RTO calculation.
Computer Networks Chapter 5: End-to-End Protocols
Transport Layer3-1 TCP. Transport Layer3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection.
Data Communications and Computer Networks Chapter 3 CS 3830 Lecture 16 Omar Meqdadi Department of Computer Science and Software Engineering University.
1 Chapter 3 Transport Layer. 2 Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4.
1 Transport Layer Lecture 9 Imran Ahmed University of Management & Technology.
1 Chapter 5 End-to-End Protocols Outline 5.1 UDP 5.2 TCP 5.3 Remote Procedure Call.
1 CS492B Project #2 TCP Tutorial # Jin Hyun Ju.
Transport Layer3-1 Summary of Reliable Data Transfer Checksums help us detect errors ACKs and NAKs help us deal with errors If ACK/NAK has errors sender.
Week 9 TCP9-1 Week 9 TCP 3 outline r 3.5 Connection-oriented transport: TCP m segment structure m reliable data transfer m flow control m connection management.
CSE Computer Networks Prof. Aaron Striegel Department of Computer Science & Engineering University of Notre Dame Lecture 14 – February 23, 2010.
Computer Networks: TCP Congestion Control 1 TCP Congestion Control Lecture material taken from “Computer Networks A Systems Approach”, Fourth Edition,Peterson.
Fundamentals of Computer Networks ECE 478/578 Lecture #21: TCP Window Mechanism Instructor: Loukas Lazos Dept of Electrical and Computer Engineering University.
TCP Details: Roadmap Data Flow Timeout/Retransmission
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
Computer Networks: TCP Congestion Control 1 TCP Congestion Control Lecture material taken from “Computer Networks A Systems Approach”, Third Ed.,Peterson.
Transport Layer Transport Layer: TCP. Transport Layer 3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional.
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
Announcement Project 2 out –Much harder than project 1, start early! Homework 2 due next Tu.
1 TCP latency modeling. 2 Q: How long does it take to receive an object from a Web server after sending a request? r TCP connection establishment r data.
The Future r Let’s look at the homework r The next test is coming the 19 th (just before turkey day!) r Monday will finish TCP canned slides r Wednesday.
Transport Layer3-1 Data Communication and Networks Lecture 7 Transport Protocols: TCP October 21, 2004.
Advanced Computer Networks: TCP Congestion Control 1 TCP Congestion Control Lecture material taken from “Computer Networks A Systems Approach”, Fourth.
Spring 2002CS 4611 Reliable Byte-Stream (TCP) Outline Connection Establishment/Termination Sliding Window Revisited Flow Control Adaptive Timeout.
1 #6 in Mid-Term  Most answered:  many users thru the same bottleneck -> increased queueing delay -> increased e2e latency  Possible reasons behind.
Network LayerII-1 RSC Part III: Transport Layer 3. TCP Redes y Servicios de Comunicaciones Universidad Carlos III de Madrid These slides are, mainly, part.
Transport Layer1 Reliable Transfer Ram Dantu (compiled from various text books)
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.
2: Transport Layer 21 Transport Layer 2. 2: Transport Layer 22 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data.
1 Lecture 14 High-speed TCP connections Wraparound Keeping the pipeline full Estimating RTT Fairness of TCP congestion control Internet resource allocation.
1 End-to-End Protocols (UDP, TCP, Connection Management)
Copyright © Lopamudra Roychoudhuri
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:
September 26 th, 2013 CS1652 The slides are adapted from the publisher’s material All material copyright J.F Kurose and K.W. Ross, All Rights.
ECE 4110 – Internetwork Programming
TCP. TCP ACK generation [RFC 1122, RFC 2581] Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already.
TCP continued. Discussion – TCP Throughput TCP will most likely generate the saw tooth type of traffic. – A rough estimate is that the congestion window.
Transport Layer: Sliding Window Reliability
Transport Layer3-1 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles.
Transport Layer3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009.
Transport Layer3-1 Transport Layer If you are going through Hell Keep going.
TCP - Part II.
Chapter 3 outline 3.1 Transport-layer services
DMET 602: Networks and Media Lab
CS 1652 Jack Lange University of Pittsburgh
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 full duplex data:
Introduction to Networks
Transport Control Protocol
CS1652 TCP Jack Lange University of Pittsburgh
Review: UDP demultiplexing TCP demultiplexing Multiplexing?
Chapter 5 TCP Sliding Window
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.
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
CS4470 Computer Networking Protocols
Transport Control Protocol
Chapter 3 outline 3.1 Transport-layer services
Transmission Control Protocol (TCP) Part II Neil Tang 11/21/2008
State Transition Diagram
Advanced Computer Networks
CSS432 End-to-End Protocols Textbook Ch5.1 – 5.2
The University of Adelaide, School of Computer Science
Chapter 3 Transport Layer
TCP: Transmission Control Protocol Part II : Protocol Mechanisms
Presentation transcript:

Chapter 5 TCP Sequence Numbers & TCP Transmission Control Networking CS 3470, Section 1

Sequence Number SequenceNum field contains the sequence number for the first byte of data carried in segment Important for ??

Sequence Number SequenceNum field contains the sequence number for the first byte of data carried in segment Important for Detecting dropped packets Detecting out of order packets Flow control

simple telnet scenario TCP seq. #’s and ACKs Seq. #’s: byte stream “number” of first byte in segment’s data ACKs: seq # of next byte expected from other side cumulative ACK Q: how receiver handles out-of-order segments A: TCP spec doesn’t say, - up to implementer Host A Host B User types ‘C’ Seq=42, ACK=79, data = ‘C’ host ACKs receipt of ‘C’, echoes back ‘C’ Seq=79, ACK=43, data = ‘C’ host ACKs receipt of echoed ‘C’ Seq=43, ACK=80 time simple telnet scenario

Protecting against Wraparound Relevance of the 32-bit sequence number space The sequence number used on a given connection might wraparound A byte with sequence number x could be sent at one time, and then at a later time another byte with the same sequence number x could be sent

Protecting against Wraparound Packets cannot survive in the Internet for longer than the TCP Maximum Segment Lifetime (MSL), which is 120 sec We need to make sure that the sequence number does not wrap around within a 120-second period of time Depends on how fast data can be transmitted over the Internet

Protecting against Wraparound How many bytes of transferred data does the 32-bit sequence number represent?

Protecting against Wraparound How many bytes of transferred data does the 32-bit sequence number represent? 232 bytes are represented 4 GB of data can be sent!

Protecting against Wraparound Time until 32-bit sequence number space wraps around. TCP extension is used to extend sequence number space

Figuring out Wraparound Time 232 B / bandwidth (in Bytes) How long for wraparound on 2.5Gbps network (OC-48)? Convert bandwidth to Bytes 2.5 Gbps / 8 = 0.3125 GBps * 109 = 312,500,000 Bps 232 B / 312,500,000 Bps = 14 sec (Can also use 230 instead of 109)

Keeping the Pipe Full 16-bit AdvertisedWindow field must be big enough to allow the sender to keep the pipe full If the receiver has enough buffer space The window needs to be opened far enough to allow a full delay × bandwidth product’s worth of data Assuming an RTT of 100 ms (typical cross- country connection in US)

Required window size for 100-ms RTT. Keeping the Pipe Full Required window size for 100-ms RTT. Uh oh – 16 bit field only allows us to advertise a window of 64KB (216 = 65536 B = 64KB) TCP extension is used to extend AdvertisedWindow

Triggering Transmission How does TCP decide to transmit a segment? TCP supports a byte stream abstraction Application programs write bytes into streams It is up to TCP to decide that it has enough bytes to send a segment

Triggering Transmission TCP has three mechanism to trigger the transmission of a segment 1) TCP maintains a variable MSS (maximum segment size) and sends a segment as soon as it has collected MSS bytes from the sending process MSS is usually set to the size of the largest segment TCP can send without causing local IP to fragment. MSS: MTU of directly connected network – (TCP header + and IP header)

Triggering Transmission 2) Sending process has explicitly asked TCP to send it TCP supports push operation 3) When a timer fires Resulting segment contains as many bytes as are currently buffered for transmission

Silly Window Syndrome Of course, we can’t ignore flow control. Suppose the TCP sender is stopped for awhile (AdvertisedWindow = 0) Now suppose TCP sender receives an ACK that opens the window up to half of MSS Should the sender transmit?

Silly Window Syndrome The strategy of aggressively taking advantage of any available window leads to silly window syndrome Once smaller segment size is introduced into TCP segment system, it will stay around indefinitely

Nagle’s Algorithm If there is data to send but the window is open less than MSS, then we may want to wait some amount of time before sending the available data If we wait too long, then we hurt interactive applications If we don’t wait long enough, then we risk sending a bunch of tiny packets and falling into the silly window syndrome The solution is to introduce a timer and to transmit when the timer expires

Nagle’s Algorithm We could use a clock-based timer, for example one that fires every 100 ms Nagle introduced an elegant self-clocking solution Key Idea As long as TCP has any data in flight, the sender will eventually receive an ACK This ACK can be treated like a timer firing, triggering the transmission of more data

Nagle’s Algorithm When the application produces data to send if both the available data and the window ≥ MSS send a full segment else /* window < MSS */ if there is unACKed data in flight buffer the new data until an ACK arrives else send all the new data now

TCP Retransmission (Timeouts) How should TCP set its timeout value? Too short will unnecessarily retransmit segments Too long will introduce unnecessary delay

Adaptive Retransmission Q: how to set TCP timeout value? longer than RTT but RTT varies too short: premature timeout unnecessary retransmissions too long: slow reaction to segment loss Q: how to estimate RTT? SampleRTT: measured time from segment transmission until ACK receipt ignore retransmissions SampleRTT will vary, want estimated RTT “smoother” average several recent measurements, not just current SampleRTT

Adaptive Retransmission Original Algorithm Measure SampleRTT for each segment/ ACK pair Compute weighted average of RTT EstRTT = α x EstRTT + (1 - α )x SampleRTT α between 0.8 and 0.9 (typically 0.875) Set timeout based on EstRTT TimeOut = 2 x EstRTT

Adaptive Retransmission Problem ACK does not really acknowledge a transmission It actually acknowledges the receipt of data When a segment is retransmitted and then an ACK arrives at the sender It is impossible to decide if this ACK should be associated with the first or the second transmission for calculating RTTs

Adaptive Retransmission Problem Associating the ACK with (a) original transmission versus (b) retransmission To which transmission does the ACK belong?

Karn/Partridge Algorithm Whenever TCP retransmits a segment, it does not take sample of RTT Double timeout after each retransmission Exponential backoff

Karn/Partridge Algorithm Karn-Partridge algorithm was an improvement over the original approach, but it does not eliminate congestion We need to understand how timeout is related to congestion If you timeout too soon, you may unnecessarily retransmit a segment which adds load to the network

Karn/Partridge Algorithm Main problem with the original computation is that it does not take variance of Sample RTTs into consideration. If the variance among Sample RTTs is small Then the Estimated RTT can be better trusted Otherwise The EstimatedRTT may be very wrong

Karn/Partridge Algorithm Jacobson/Karels proposed a new scheme for TCP retransmission Takes variance (deviation term) into account

Jacobson/Karels Algorithm Difference = SampleRTT − EstimatedRTT EstimatedRTT = EstimatedRTT + ( × Difference) Deviation = Deviation + (|Difference| − Deviation) TimeOut = EstimatedRTT + 4 × Deviation When the variance is small TimeOut is close to EstimatedRTT When the variance is large Deviation term dominates the TimeOut calculation  is between 0 and 1

TCP: retransmission scenarios Host A Seq=92, 8 bytes data ACK=100 loss timeout lost ACK scenario Host B X time Host A Host B Seq=92 timeout Seq=92, 8 bytes data Seq=100, 20 bytes data ACK=100 ACK=120 Seq=92, 8 bytes data Seq=92 timeout ACK=120 time premature timeout

TCP retransmission scenarios (more) Host A Seq=92, 8 bytes data ACK=100 loss timeout Cumulative ACK scenario Host B X Seq=100, 20 bytes data ACK=120 time

TCP ACK generation How quickly should the receiver send an ACK? If ACKs are cumulative, it makes sense that the receiver would not send an ACK for every single packet received

TCP ACK generation [RFC 1122, RFC 2581] Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. # . Gap detected Arrival of segment that partially or completely fills gap TCP Receiver action Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq. # of next expected byte Immediately send ACK, provided that segment starts at lower end of gap

Fast Retransmit Time-out period often relatively long: long delay before resending lost packet Detect lost segments via duplicate ACKs. Sender often sends many segments back-to- back If segment is lost, there will likely be many duplicate ACKs. If sender receives 3 ACKs for the same data, it supposes that segment after ACKed data was lost: fast retransmit: resend segment before timer expires

TCP Extensions Timestamp inserted into the header Help measure RTT Detect which ACKs are for what transmissions Timestamp used to help prevent sequence number wraparound AdvertisedWindow can measure larger units than 1 byte Left-shift scaling factor Selective (SACKs) for out of order segments