Lecture 8. TCP/IP Transport Layer (2)

Similar documents
CC451 Computer Networks

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581

CNT 6885 Network Review on Transport Layer

32 bits. source port # dest port # sequence number acknowledgement number not used. checksum. Options (variable length)

Correcting mistakes. TCP: Overview RFCs: 793, 1122, 1323, 2018, TCP seq. # s and ACKs. GBN in action. TCP segment structure

Chapter 3- parte B outline

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

Lecture 08: The Transport Layer (Part 2) The Transport Layer Protocol (TCP) Dr. Anis Koubaa

Transport Layer: outline

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

Go-Back-N. Pipelining: increased utilization. Pipelined protocols. GBN: sender extended FSM

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, Development of reliable protocol Sliding window protocols

Transport Layer: Outline

CSE 4213: Computer Networks II

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, steam: r Development of reliable protocol r Sliding window protocols

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

CSC 8560 Computer Networks: TCP

Chapter III: Transport Layer

Lecture 11. Transport Layer (cont d) Transport Layer 1

Master Course Computer Networks IN2097

10 minutes survey (anonymous)

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 9

Chapter 3 Transport Layer

CS Lecture 1 Review of Basic Protocols

Flow and Congestion Control (Hosts)

Chapter 3 outline. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management

TCP. TCP: Overview. TCP Segment Structure. Maximum Segment Size (MSS) Computer Networks 10/19/2009. CSC 257/457 - Fall

TCP: Overview RFCs: 793,1122,1323, 2018, 2581

CSC 4900 Computer Networks: TCP

Foundations of Telematics

TCP (Part 2) Session 10 INST 346 Technologies, Infrastructure and Architecture

By Ossi Mokryn, Based also on slides from: the Computer Networking: A Top Down Approach Featuring the Internet by Kurose and Ross

Chapter 3 Transport Layer

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

Department of Computer and IT Engineering University of Kurdistan. Transport Layer. By: Dr. Alireza Abdollahpouri

Computer Networking Introduction

Chapter 3 Transport Layer

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

RSC Part III: Transport Layer 3. TCP

Course on Computer Communication and Networks. Lecture 5 Chapter 3; Transport Layer, Part B

TCP reliable data transfer. Chapter 3 outline. TCP sender events: TCP sender (simplified) TCP: retransmission scenarios. TCP: retransmission scenarios

COMP 431 Internet Services & Protocols. Transport Layer Protocols & Services Outline. The Transport Layer Reliable data delivery & flow control in TCP

Chapter 3 Transport Layer

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

Chapter III: Transport Layer

CSCI Topics: Internet Programming Fall 2008

Chapter 3 Transport Layer

Fall 2012: FCM 708 Bridge Foundation I

Chapter 3 Transport Layer

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 10

CSCD 330 Network Programming

Chapter 6 Transport Layer

The Transport Layer Reliable data delivery & flow control in TCP. Transport Layer Protocols & Services Outline

Chapter 3 Transport Layer

Chapter 3 Transport Layer

CSCE 463/612 Networks and Distributed Processing Spring 2017

CSC 401 Data and Computer Communications Networks

CS450 Introduc0on to Networking Lecture 14 TCP. Phu Phung Feb 13, 2015

The Transport Layer Reliable data delivery & flow control in TCP. Transport Layer Protocols & Services Outline

Chapter III: Transport Layer

Master Course Computer Networks IN2097

Computer Networking: A Top Down Approach

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Data Communications & Networks. Session 9 Main Theme Network Congestion Causes, Effects, Controls, and TCP Applications. Dr. Jean-Claude Franchitti

Computer Networking Introduction

Application. Transport. Network. Link. Physical

Lecture 5. Transport Layer. Transport Layer 1-1

Chapter 3 Transport Layer

LECTURE 3 - TRANSPORT LAYER

Chapter 3 Transport Layer

Chapter 3: Transport Layer

Transmission Control Protocol

The Transport Layer: TCP & Reliable Data Transfer

CSCI Topics: Internet Programming Fall 2008

CS 43: Computer Networks. 19: TCP Flow and Congestion Control October 31, Nov 2, 2018

Chapter 3 outline. TDTS06 Computer networks. Principles of Reliable data transfer. Reliable data transfer: getting started

CSC 4900 Computer Networks: TCP

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

Transport Protocols and TCP

CSCD 330 Network Programming Winter 2015

TCP : Fundamentals of Computer Networks Bill Nace

rdt3.0: channels with errors and loss

Congestion Control. Principles of Congestion Control. Network-assisted Congestion Control: ATM. Congestion Control. Computer Networks 10/21/2009

Principles of congestion control

Computer Communication Networks Midterm Review

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Distributed Systems. 5. Transport Protocols

Distributed Systems. 5. Transport Protocols. Werner Nutt

Lecture 3 The Transport Control Protocol (TCP) Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

Our goals: understand d principles. behind transport layer protocols in the. Internet: layer services:

Chapter 3: Transport Layer. Chapter 3 Transport Layer. Transport layer. Position of transport layer. Transport layer.

Congestion Control. Principles of Congestion Control. Network assisted congestion. Asynchronous Transfer Mode. Computer Networks 10/23/2013

TCP. 1 Administrivia. Tom Kelliher, CS 325. Apr. 2, Announcements. Assignment. Read From Last Time

Chapter 3 Transport Layer

Computer Networks. 3.Transport Layer. Transport Layer - 1

Transport protocols. Transport Layer 3-1

Chapter 3: Transport Layer. Chapter 3 Transport Layer. Chapter 3 outline. Transport services and protocols

Transcription:

Lecture 8 TCP/IP Transport Layer (2)

Outline (Transport Layer) Principles behind transport layer services: multiplexing/demultiplexing principles of reliable data transfer learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport segment structure reliable data transfer flow control round trip time and time out connection management principles of congestion control and TCP congestion control

TCP: Overview point-to-point: one sender, one receiver reliable, in-order byte steam pipelined: TCP congestion and flow control set window size send & receive buffers socket door application writes data TCP send buffer full duplex data: bi-directional data flow in same connection MSS: maximum segment size connection-oriented: handshaking (exchange of control msgs) init s sender, receiver state before data exchange flow controlled: sender will not overwhelm receiver segment application reads data TCP receive buffer socket door

TCP Segment Structure URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum (as in UDP) 32 bits source port # dest port # head len sequence number acknowledgement number not used UAP R S F checksum Receive window Urg data pnter Options (variable length) application data (variable length) counting by bytes of data (not segments!) # bytes rcvr willing to accept

TCP Sequence Numbers and ACKs Sequence numbers: byte stream number of first byte in segment s data ACKs: sequence number 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 implementor User types C host ACKs receipt of echoed C Host A Host B Seq=42, ACK=79, data = C Seq=79, ACK=43, data = C Seq=43, ACK=80 simple telnet scenario host ACKs receipt of C, echoes back C time

Outline (Transport Layer) Principles behind transport layer services: multiplexing/demultiplexing principles of reliable data transfer learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport segment structure reliable data transfer flow control round trip time and time out connection management principles of congestion control and TCP congestion control

TCP Reliable Data Transfer TCP creates rdt service on top of IP s unreliable service Pipelined segments Cumulative acknowledgements (ACKs) TCP uses single retransmission timer Retransmissions are triggered by: timeout events duplicate ACKs Initially consider simplified TCP sender: ignore duplicate ACKs ignore flow control, congestion control

TCP Sender Events data rcvd from app: Create segment with sequence number sequence number is byte-stream number of first data byte in segment start timer if not already running (think of timer as for oldest unacked segment) timeout: retransmit segment that caused timeout restart timer Ack rcvd: If acknowledges previously unacked segments update what is known to be ACKed start timer if there are outstanding segments expiration interval: TimeOutInterval

TCP Sender (simplified)

TCP ACK Generation Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Arrival of in-order segment with 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

TCP: Retransmission Scenarios Host A Host B Host A Host B Seq=92, 8 bytes data Seq=92, 8 bytes data Seq=100, 20 bytes data ACK=120 ACK=100 Seq=92 timeout ACK=100 X timeout loss Seq=92, 8 bytes data Seq=92, 8 bytes data ACK=100 Seq=92 timeout Seq=100 timeout ACK=100 SendBase = 100 time lost ACK scenario Sendbase=100 SendBase= 120 time premature timeout

TCP: Retransmission Scenarios Host A Host B Seq=92, 8 bytes data SendBase = 120 timeout Seq=100, 20 bytes data X loss ACK=120 ACK=100 time Cumulative ACK scenario

Outline (Transport Layer) Principles behind transport layer services: multiplexing/demultiplexing principles of reliable data transfer learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport segment structure reliable data transfer flow control round trip time and time out connection management principles of congestion control and TCP congestion control

TCP Flow Control receive side of TCP connection has a receive buffer: flow control sender won t overflow receiver s buffer by transmitting too much, too fast application process may be slow at reading from buffer speed-matching service: matching the send rate to the receiving applications drain rate

TCP Flow Control: How It Works (Suppose TCP receiver discards out-of-order segments) spare room in buffer RcvWindow = RcvBuffer- [LastByteRcvd - LastByteRead] Receiver advertises spare room by including value of RcvWindow in segments Sender limits unacked data to RcvWindow guarantees receive buffer doesn t overflow

Outline (Transport Layer) Principles behind transport layer services: multiplexing/demultiplexing principles of reliable data transfer learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport segment structure reliable data transfer flow control round trip time and time out connection management principles of congestion control and TCP congestion control

TCP Round Trip Time and Timeout 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 EstimatedRTT = (1- α)*estimatedrtt + α*samplertt Exponential weighted moving average influence of past sample decreases exponentially fast typical value: α = 0.1

TCP Round Trip Time and Timeout Setting the timeout EstimtedRTT plus safety margin large variation in EstimatedRTT -> larger safety margin first estimate how much SampleRTT deviates from EstimatedRTT: DevRTT = (1-β)*DevRTT +β* SampleRTT-EstimatedRTT (typically, β = 0.25) Then set timeout interval: TimeoutInterval = EstimatedRTT + 4*DevRTT If the SampleRTT values have little fluctuation, then Deviation is small and Timeout is hardly more than EstimatedRTT; if there is a lot of fluctuation, Deviation will be large and Timeout will be much larger than EstimatedRTT.

Outline (Transport Layer) Principles behind transport layer services: multiplexing/demultiplexing principles of reliable data transfer learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport segment structure reliable data transfer flow control round trip time and time out connection management principles of congestion control and TCP congestion control

TCP Connection Management TCP sender, receiver establish connection before exchanging data segments. Three way handshake: Step 1: client host sends TCP SYN segment to server specifies initial sequence number (client_isn) no data, SYN bit 1 Step 2: server host receives SYN, replies with SYNACK segment, no data server allocates buffers specifies server initial sequence number (server_isn) ACK field client_isn+1 Step 3: client receives SYNACK, replies with ACK segment, which may contain data ACK field server_isn +1 SYN bit 0

TCP Connection Management Closing a connection: Step 1: client end system sends TCP FIN control segment to server Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN. Step 3: client receives FIN, replies with ACK. close client FIN ACK FIN server close Enters timed wait - will respond with ACK to received FINs Step 4: server, receives ACK. Connection closed. timed wait closed ACK

TCP Connection Management TCP server lifecycle TCP client lifecycle

Outline (Transport Layer) Principles behind transport layer services: multiplexing/demultiplexing principles of reliable data transfer learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport segment structure reliable data transfer flow control round trip time and time out connection management principles of congestion control and TCP congestion control

Principles of Congestion Control Congestion: informally: too many sources sending too much data too fast for network to handle different from flow control! manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) a top-10 problem!

Causes/Costs of Congestion: Scenario 1 two senders, two receivers Host A λ in : original data λ out one router, infinite buffers Host B unlimited shared output link buffers no retransmission large delays when congested maximum achievable throughput

Causes/Costs of Congestion: Scenario 2 one router, finite buffers sender retransmission of lost packet Host A λ in : original data λ out λ' in : original data, plus retransmitted data Host B finite shared output link buffers

Causes/Costs of Congestion: Scenario 2 λ in λ out always: = (goodput) perfect retransmission only when loss: retransmission of delayed (not lost) packet makes larger (than perfect case) for same λ out λ in > λ out λ in R/2 R/2 R/2 R/3 λ out λ out λ out R/4 λ in R/2 λ in R/2 0.6R λ in R/2 a. costs of congestion: b. c. more work (retrans) for given goodput unneeded retransmissions: link carries multiple copies of pkt

Causes/Costs of Congestion: Scenario 3 four senders multihop paths timeout/retransmit Q: what happens as and increase? λ in λ in Host A λ in : original data λ out Host B λ' in : original data, plus retransmitted data finite shared output link buffers Host D R4 R1 R2 Host C R3

Causes/Costs of Congestion: Scenario 3 H o s t A λ o u t H o s t B Another cost of congestion: when packet dropped, any upstream transmission capacity used for that packet was wasted!

Approaches Towards Congestion Control Two broad approaches towards congestion control: End-end congestion control: no explicit feedback from network congestion inferred from end-system observed loss, delay approach taken by TCP Network-assisted congestion control: routers provide feedback to end systems single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM) explicit rate sender should send at

TCP Congestion Control end-end control (no network assistance) two more variables in addition to other variables introduced in flow control CongWin: is dynamic, function of perceived network congestion, i.e. a constraint on how much traffic a host can send into a connection. Threshold: is a level used to adjust CongWin. sender limits transmission: LastByteSent-LastByteAcked min(congwin, RcvWin) Roughly, rate = CongWin RTT Bytes/sec How does sender perceive congestion? loss event = timeout or 3 duplicate acks TCP sender reduces rate (CongWin) after loss event three mechanisms: slow start AIMD conservative after timeout events

TCP Slow Start When connection begins, CongWin = 1 MSS Example: MSS = 500 bytes & RTT = 200 msec initial rate = 20 kbps available bandwidth may be >> MSS/RTT desirable to quickly ramp up to respectable rate When connection begins, increase rate exponentially until first loss event: double CongWin every RTT done by incrementing CongWin for every ACK received After 3 dup ACKs: indicates network capable of delivering some segments CongWin is cut in half window then grows linearly But after timeout event: timeout before 3 dup ACKs is more alarming CongWin instead set to 1 MSS; window then grows exponentially to a threshold, then grows linearly RTT Host A Host B one segment two segments four segments time

Summary: TCP Congestion Control When CongWin is below Threshold, sender in slow-start phase, window grows exponentially. When CongWin is above Threshold, sender is in congestion-avoidance phase, window grows linearly. When a triple duplicate ACK occurs, Threshold set to CongWin/2 and CongWin set to Threshold. When timeout occurs, Threshold set to CongWin/2 and CongWin is set to 1 MSS.

TCP AIMD multiplicative decrease: cut CongWin in half after loss event additive increase: increase CongWin by 1 MSS every RTT in the absence of loss events: probing 24 Kbytes congestion window 16 Kbytes 8 Kbytes time

TCP Throughput What s the average throughout of TCP as a function of window size and RTT? Ignore slow start Let W be the window size when loss occurs. When window is W, throughput is W*MSS/RTT Just after loss, window drops to W/2, throughput to W*MSS/2RTT. This process repeats itself over and over again. As the throughput increases linearly between the two extreme values, we have: average throughout: 0.75 W*MSS/RTT

TCP Fairness Fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K Why is TCP fair? Two competing sessions: Additive increase gives slope of 1, as throughout increases multiplicative decrease decreases throughput proportionally R Connection 2 throughput TCP connection 1 TCP connection 2 C Connection 1 throughput R bottleneck Router capacity R equal bandwidth share A loss: decrease window by factor of 2 Dcongestion avoidance: additive increase loss: decrease window by factor of 2 B congestion avoidance: additive increase

Delay Modeling Q: How long does it take to receive an object from a Web server after sending a request (i.e. after initiates a TCP connection)? Ignoring congestion, delay is influenced by: TCP connection establishment data transmission delay slow start Notation, assumptions: Assume one link between client and server of rate R S: MSS (bits) O: object size (bits) no retransmissions (no loss, no corruption) Window size: First assume: fixed congestion window, W segments Then dynamic window, modeling slow start

Fixed Congestion Window (1) First case: W=4 WS/R > RTT + S/R: ACK for first segment in window returns before window s worth of data sent delay = 2RTT + O/R

Fixed Congestion Window (2) Second case: W=2 WS/R < RTT + S/R: wait for ACK after sending window s worth of data sent delay = 2RTT + O/R + (K-1)[S/R + RTT - WS/R]

TCP Delay Modeling: Slow Start (1) Now suppose window grows according to slow start Will show that the delay for one object is: Latency O S P = 2RTT + + P RTT (2 1) R + R where P is the number of times TCP idles at server: S R P = min{ Q, K 1} - where Q is the number of times the server idles if the object were of infinite size. - and K is the number of windows that cover the object.

TCP Delay Modeling: Slow Start (2) Delay components: 2 RTT for connection estab and request O/R to transmit object time server idles due to slow start Server idles: P = min{k-1,q} times Example: O/S = 15 segments K = 4 windows Q = 2 P = min{k-1,q} = 2 Server idles P=2 times

S R TCP Delay Modeling (3) + RTT = time from when server starts to send segment until server receives acknowledgement initiate TCP connection k S 2 1 = time to transmit the kth window R S R + k S 2 1 + RTT = idle time after the kth window R request object RTT first window = S/R second window = 2S/R third window = 4S/R delay = O R + 2RTT + P p= 1 idletime p fourth window = 8S/R = = O R O R + 2RTT + 2RTT + P k = 1 [ S R + P[ RTT + + RTT S R 2 ] (2 k 1 P S R ] 1) S R object delivered time at client time at server complete transmission

TCP Delay Modeling (3) + = + = = + + + = + + + = 1) ( log 1)} ( log : min{ } 1 2 : min{ } / 2 2 2 : min{ } 2 2 2 : min{ 2 2 1 1 0 1 1 0 S O S O k k S O k S O k O S S S k K k k k Λ Λ How do we calculate K? K = number of windows that cover object

Reading Material Chapter 3 text3 (Kurose) Chapter 6 text2 (Tanenbaum)