Flow Control.

Slides:



Advertisements
Similar presentations
2: Transport Layer 31 Transport Layer 3. 2: Transport Layer 32 TCP Flow Control receiver: explicitly informs sender of (dynamically changing) amount of.
Advertisements

3-1 TCP Protocol r point-to-point: m one sender, one receiver r reliable, in-order byte steam: m no “message boundaries” r pipelined: m TCP congestion.
1 TCP Congestion Control. 2 TCP Segment Structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement.
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.
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.
Transport Layer1 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r reliable, in-order byte steam: m no “message boundaries” r pipelined: m TCP congestion.
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.
Introduction 1 Lecture 14 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
Chapter 3 Transport Layer slides are modified from J. Kurose & K. Ross CPE 400 / 600 Computer Communication Networks Lecture 12.
Announcement Project 2 finally ready on Tlab Homework 2 due next Mon tonight –Will be graded and sent back before Tu. class Midterm next Th. in class –Review.
Transport Layer 3-1 Fast Retransmit r time-out period often relatively long: m long delay before resending lost packet r detect lost segments via duplicate.
Transport Layer3-1 Congestion Control. Transport Layer3-2 Principles of Congestion Control Congestion: r informally: “too many sources sending too much.
1 Congestion Control 2 Principles of Congestion Control Congestion: r informally: “too many sources sending too much data too fast for network to handle”
10/7/ /9/2003 TCP and Congestion Control October 7-9, 2003.
Transport Layer3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach Featuring the Internet, 2 nd edition. Jim Kurose, Keith Ross Addison-Wesley,
1 Congestion Control. Transport Layer3-2 Principles of Congestion Control Congestion: r informally: “too many sources sending too much data too fast for.
Transport Layer Transport Layer: TCP. Transport Layer 3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional.
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.
1 Flow Control 2 TCP Flow Control receiver: explicitly informs sender of (dynamically changing) amount of free buffer space  RcvWindow field in TCP.
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.
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.
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.
Data Communication and Networks
Transport Layer Congestion control. Transport Layer 3-2 Approaches towards congestion control End-to-end congestion control: r no explicit feedback.
EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009.
1 Congestion Control 2 Principles of Congestion Control Congestion: r informally: “too many sources sending too much data too fast for network to handle”
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 point-to-point:
Lecture 17 Congestion Control; AIMD; TCP Reno 10/31/2013
3: Transport Layer3b-1 Principles of Congestion Control Congestion: r informally: “too many sources sending too much data too fast for network to handle”
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 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles.
Transport Layer1 Flow and Congestion Control 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.
Principles of Congestion Control Congestion: informally: “too many sources sending too much data too fast for network to handle” different from flow control!
17-1 Last time □ UDP socket programming ♦ DatagramSocket, DatagramPacket □ TCP ♦ Sequence numbers, ACKs ♦ RTT, DevRTT, timeout calculations ♦ Reliable.
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009.
1 Transport Layer Lecture 10 Imran Ahmed University of Management & Technology.
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.
1 John Magee 20 February 2014 CS 280: Transport Layer: Congestion Control Concepts, TCP Congestion Control Most slides adapted from Kurose and Ross, Computer.
CS-1652 The slides are adapted from the publisher’s material All material copyright J.F Kurose and K.W. Ross, All Rights Reserved Jack Lange.
Advance Computer Networks Lecture#09 & 10 Instructor: Engr. Muhammad Mateen Yaqoob.
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.
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.
Transport Layer session 1 TELE3118: Network Technologies Week 11: Transport Layer TCP Some slides have been taken from: r Computer Networking:
Chapter 3 outline 3.1 Transport-layer services
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 full duplex data:
Approaches towards congestion control
Chapter 3 outline 3.1 transport-layer services
Chapter 6 TCP Congestion Control
CS-1652 Jack Lange University of Pittsburgh
Chapter 3 outline 3.1 Transport-layer services
CS1652 TCP Jack Lange University of Pittsburgh
Review: UDP demultiplexing TCP demultiplexing Multiplexing?
Chapter 3-3 TCP Congestion CTL *
TCP.
Flow and Congestion Control
TCP Review.
Congestion Control.
October 1st, 2013 CS-1652 Jack Lange University of Pittsburgh
TCP 3: Transport Layer.
TCP Overview.
Chapter 3 outline 3.1 Transport-layer services
CS-1652 Congestion Control Jack Lange University of Pittsburgh
Transport Layer: Congestion Control
Chapter 3 outline 3.1 Transport-layer services
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 point-to-point:
October 4th, 2011 CS-1652 Jack Lange University of Pittsburgh
Presentation transcript:

Flow Control

TCP Flow Control flow control receiver: explicitly informs sender of (dynamically changing) amount of free buffer space RcvWindow field in TCP segment sender: keeps the amount of transmitted, unACKed data less than most recently received RcvWindow sender won’t overrun receiver’s buffers by transmitting too much, too fast RcvBuffer = size or TCP Receive Buffer RcvWindow = amount of spare room in Buffer receiver buffering

TCP Flow Control: How it Works source port # dest port # sequence number acknowledgement number head len not used U A P R S F rcvr window size checksum ptr urgent data spare room in buffer = RcvWindow Options (variable length) application data (variable length) 3 3

TCP: setting timeouts

TCP Round Trip Time and Timeout Q: how to set TCP timeout value? longer than RTT note: RTT will vary 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, cumulatively ACKed segments SampleRTT will vary, want estimated RTT “smoother” use several recent measurements, not just current SampleRTT

Set timeout = average + safe margin High-level Idea Set timeout = average + safe margin 6

Estimating Round Trip Time SampleRTT: measured time from segment transmission until ACK receipt SampleRTT will vary, want a “smoother” estimated RTT use 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.125 7

TimeoutInterval = EstimatedRTT + 4*DevRTT Setting Timeout Problem: using the average of SampleRTT will generate many timeouts due to network variations Solution: EstimtedRTT plus “safety margin” large variation in EstimatedRTT -> larger safety margin RTT freq. DevRTT = (1-)*DevRTT + *|SampleRTT-EstimatedRTT| (typically,  = 0.25) Then set timeout interval: TimeoutInterval = EstimatedRTT + 4*DevRTT 8

An Example TCP Session

TCP Round Trip Time and Timeout EstimatedRTT = (1-x)*EstimatedRTT + x*SampleRTT Exponential weighted moving average influence of given sample decreases exponentially fast typical value of x: 0.1 Setting the timeout EstimtedRTT plus “safety margin” large variation in EstimatedRTT -> larger safety margin Timeout = EstimatedRTT + 4*Deviation Deviation = (1-x)*Deviation + x*|SampleRTT-EstimatedRTT|

Fast retransmit

Fast Retransmit Timeout 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: resend segment before timer expires 12 12

Triple Duplicate Ack 1 2 3 4 5 6 7 4 4 4 2 3 4 Packets Acknowledgements (waiting seq#) 4 4 4 2 3 4 13 13

Fast Retransmit: if (y > SendBase) { … SendBase = y event: ACK received, with ACK field value of y if (y > SendBase) { … SendBase = y if (there are currently not-yet-acknowledged segments) start timer } else { increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) { resend segment with sequence number y a duplicate ACK for already ACKed segment fast retransmit 14 14

Congestion Control

Principles of Congestion Control informally: “too many sources sending too much data too fast for network to handle” manifestations: lost packets (buffer overflow at routers) long delays (queuing in router buffers) a highly important problem!

Causes/costs of congestion: scenario 1 two senders, two receivers one router, infinite buffers no retransmission

Causes/costs of congestion: scenario 1 Throughput increases with load Maximum total load C (Each session C/2) Large delays when congested The load is stochastic

Causes/costs of congestion: scenario 2 one router, finite buffers sender retransmission of lost packet

Causes/costs of congestion: scenario 2 l in out = always: (goodput) Like to maximize goodput! “perfect” retransmission: retransmit only when loss: Actual retransmission of delayed (not lost) packet makes larger (than perfect case) for same l in out > l in l out

Causes/costs of congestion: scenario 2 out out out ’in ’in “costs” of congestion: more work (retrans) for given “goodput” unneeded retransmissions: link carries (and delivers) multiple copies of pkt

Causes/costs of congestion: scenario 3 four senders multihop paths timeout/retransmit l in Q: what happens as and increase ? l in

Causes/costs of congestion: scenario 3 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

Goals of congestion control Throughput: Maximize goodput the total number of bits end-end Fairness: Give different sessions “equal” share. Max-min fairness Maximize the minimum rate session. Single link: Capacity R sessions m Each sessions: R/m

Max-min fairness Model: Graph G(V,e) and sessions s1 … sm For each session si a rate ri is selected. The rates are a Max-Min fair allocation: The allocation is maximal No ri can be simply increased Increasing allocation ri requires reducing Some session j rj ≤ ri Maximize minimum rate session.

Max-min fairness: Algorithm Model: Graph G(V,e) and sessions s1 … sm Algorithmic view: For each link compute its fair share f(e). Capacity / # session select minimal fair share link. Each session passing on it, allocate f(e). Subtract the capacities and delete sessions continue recessively. Fluid view.

Max-min fairness Example Throughput versus fairness.

Case study: ATM ABR congestion control ABR: available bit rate: “elastic service” if sender’s path “underloaded”: sender can use available bandwidth if sender’s path congested: sender lowers rate a minimum guaranteed rate Aim: coordinate increase/decrease rate avoid loss!

Case study: ATM ABR congestion control RM (resource management) cells: sent by sender, in between data cells one out of every 32 cells. RM cells returned to sender by receiver Each router modifies the RM cell Info in RM cell set by switches “network-assisted” 2 bit info. NI bit: no increase in rate (mild congestion) CI bit: congestion indication (lower rate)

Case study: ATM ABR congestion control two-byte ER (explicit rate) field in RM cell congested switch may lower ER value in cell sender’ send rate thus minimum supportable rate on path EFCI bit in data cells: set to 1 in congested switch if data cell preceding RM cell has EFCI set, sender sets CI bit in returned RM cell

Case study: ATM ABR congestion control How does the router selects its action: selects a rate Set congestion bits Vendor dependent functionality Advantages: fast response accurate response Disadvantages: network level design Increase router tasks (load). Interoperability issues.

End to end control

End to end feedback Abstraction: Alarm flag. observable at the end stations

Simple Abstraction

Simple Abstraction

Simple feedback model Every RTT receive feedback High Congestion Decrease rate Low congestion Increase rate Variable rate controls the sending rate.

Multiplicative Update Congestion: Rate = Rate/2 No Congestion: Rate= Rate *2 Performance Fast response Un-fair: Ratios unchanged

Additive Update Congestion: No Congestion: Performance Fairness: Rate = Rate -1 No Congestion: Rate= Rate +1 Performance Slow response Fairness: Divides spare BW equally Difference remains unchanged

AIMD Scheme Additive Increase Multiplicative Decrease Performance: Fairness: ratios improves Multiplicative Decrease Fairness: ratio unchanged Fast response Performance: Congestion - Fairness overflow

AIMD: Two users, One link Fairness Rate of User 2 BW limit Rate of User 1

TCP Congestion Control Closed-loop, end-to-end, window-based congestion control Designed by Van Jacobson in late 1980s, based on the AIMD alg. of Dah-Ming Chu and Raj Jain Works well so far: the bandwidth of the Internet has increased by more than 200,000 times Many versions TCP/Tahoe: this is a less optimized version TCP/Reno: many OSs today implement Reno type congestion control TCP/Vegas: not currently used For more details: see TCP/IP illustrated; or read http://lxr.linux.no/source/net/ipv4/tcp_input.c for linux implementation 42 42

TCP/Reno Congestion Detection Detect congestion in two cases and react differently: 3 dup ACKs timeout event Philosophy: 3 dup ACKs indicates network capable of delivering some segments timeout is “more alarming” 43

Basic Structure Two “phases” Important variables: slow-start: MI congestion avoidance: AIMD Important variables: cwnd: congestion window size ssthresh: threshold between the slow-start phase and the congestion avoidance phase 44

Visualization of the Two Phases 45

Slow Start: MI What is the goal? Implements the MI algorithm getting to equilibrium gradually but quickly Implements the MI algorithm double cwnd every RTT until network congested  get a rough estimate of the optimal of cwnd 46

Slow-start Initially: cwnd = 1; ssthresh = infinite (e.g., 64K); For each newly ACKed segment: if (cwnd < ssthresh) /* slow start*/ cwnd = cwnd + 1; segment 1 cwnd = 1 ACK for segment 1 cwnd = 2 segment 2 segment 3 ACK for segments 2 + 3 cwnd = 4 segment 4 segment 5 segment 6 segment 7 cwnd = 6 cwnd = 8 47

Startup Behavior with Slow-start See [Jac89] 48

TCP/Reno Congestion Avoidance Maintains equilibrium and reacts around equilibrium Implements the AIMD algorithm increases window by 1 per round-trip time (how?) cuts window size to half when detecting congestion by 3DUP to 1 if timeout if already timeout, doubles timeout 49 49

TCP/Reno Congestion Avoidance Initially: cwnd = 1; ssthresh = infinite (e.g., 64K); For each newly ACKed segment: if (cwnd < ssthresh) /* slow start*/ cwnd = cwnd + 1; else /* congestion avoidance; cwnd increases (approx.) by 1 per RTT */ cwnd += 1/cwnd; Triple-duplicate ACKs: /* multiplicative decrease */ cwnd = ssthresh = cwnd/2; Timeout: ssthresh = cwnd/2; (if already timed out, double timeout value; this is called exponential backoff) 50 50

TCP/Reno: Big Picture cwnd TD TD TD TO Time slow start congestion ssthresh ssthresh ssthresh ssthresh Time slow start congestion avoidance congestion avoidance congestion avoidance slow start congestion avoidance TD: Triple duplicate acknowledgements TO: Timeout 51 51

A Session Question: when cwnd is cut to half, why sending rate is not? 52 52

TCP/Reno Queueing Dynamics Consider congestion avoidance only cwnd filling buffer TD bottleneck bandwidth ssthresh draining buffer Time congestion avoidance There is a filling and draining of buffer process for each TCP flow. 53 53

TCP Tahoe Congestion Avoidance /* slowstart is over */ /* Congwin > threshold */ Until (timeout) { /* loss event */ every ACK: Congwin += 1/Congwin } threshold = Congwin/2 Congwin = 1 perform slowstart TCP Taheo

TCP Reno Fast retransmit: Fast recovery: Single packet drop: great! After receiving 3 duplicate ACK Resend first packet in window. Try to avoid waiting for timeout Fast recovery: After retransmission do not enter slowstart. Threshold = Congwin/2 Congwin = 3 + Congwin/2 Each duplicate ACK received Congwin++ After new ACK Congwin = Threshold return to congestion avoidance Single packet drop: great!

TCP Congestion Window Trace

TCP Vegas: Idea: track the RTT Implementation: Try to avoid packet loss latency increases: lower rate latency very low: increase rate Implementation: sample_RTT: current RTT Base_RTT: min. over sample_RTT Expected = Congwin / Base_RTT Actual = number of packets sent / sample_RTT  =Expected - Actual

TCP Vegas  = Expected - Actual Congestion Avoidance: Slowstart two parameters:  and , < If ( < ) Congwin = Congwin +1 If ( > ) Congwin = Congwin -1 Otherwise no change Note: Once per RTT Slowstart parameter  If ( > ) then move to congestion avoidance Timeout: same as TCP Taheo

TCP Dynamics: Rate Actual Sending rate: TCP Reno with NO Fast Retransmit or Recovery Sending rate: Congwin*MSS / RTT Assume fixed RTT W W/2 Actual Sending rate: between W*MSS / RTT and (1/2) W*MSS / RTT Average (3/4) W*MSS / RTT

TCP Dynamics: Loss Loss rate (TCP Reno) Consider a cycle No Fast Retransmit or Recovery Consider a cycle W W/2 Total packet sent: about (3/8) W2 MSS/RTT = O(W2) One packet loss Loss Probability: p=O(1/W2) or W=O(1/p)

TCP latency modeling Notation, assumptions: Q: How long does it take to receive an object from a Web server after sending a request? TCP connection establishment data transfer delay Notation, assumptions: Assume one link between client and server of rate R Assume: fixed congestion window, W segments S: MSS (bits) O: object size (bits) no retransmissions no loss, no corruption

TCP latency modeling Optimal Setting: Time = O/R Two cases to consider: WS/R > RTT + S/R: ACK for first segment in window returns before window’s worth of data sent WS/R < RTT + S/R: wait for ACK after sending window’s worth of data sent

TCP latency Modeling K:= O/WS Case 2: latency = 2RTT + O/R + (K-1)[S/R + RTT - WS/R]

TCP Latency Modeling: Slow Start Now suppose window grows according to slow start. Will show that the latency of one object of size O is: where P is the number of times TCP stalls at server: - where Q is the number of times the server would stall if the object were of infinite size. - and K is the number of windows that cover the object.

TCP Latency Modeling: Slow Start (cont.) Example: O/S = 15 segments K = 4 windows Q = 2 P = min{K-1,Q} = 2 Server stalls P=2 times.

TCP Latency Modeling: Slow Start (cont.)