TCP and Congestion Control

Slides:



Advertisements
Similar presentations
Congestion Control and Fairness Models Nick Feamster CS 4251 Computer Networking II Spring 2008.
Advertisements

Congestion Control Reading: Sections
CS144 Review Session 4 April 25, 2008 Ben Nham
1 EE 122:TCP Congestion Control Ion Stoica TAs: Junda Liu, DK Moon, David Zats (Materials with thanks to Vern Paxson,
Congestion Control Reading: Sections
Congestion Control Jennifer Rexford Advanced Computer Networks Tuesdays/Thursdays 1:30pm-2:50pm.
1 TCP Congestion Control. 2 TCP Segment Structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement.
Congestion Control Created by M Bateman, A Ruddle & C Allison As part of the TCP View project.
TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014.
CS640: Introduction to Computer Networks Mozafar Bag-Mohammadi Lecture 3 TCP Congestion Control.
Computer Networking Lecture 17 – TCP & Congestion Control Dejian Ye, Liu Xin.
Introduction 1 Lecture 14 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
School of Information Technologies TCP Congestion Control NETS3303/3603 Week 9.
Congestion Control Reading: Sections COS 461: Computer Networks Spring 2009 (MW 1:30-2:50 in CS 105) Mike Freedman Teaching Assistants: Wyatt Lloyd.
Chapter 3 Transport Layer slides are modified from J. Kurose & K. Ross CPE 400 / 600 Computer Communication Networks Lecture 12.
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.
Congestion Control Reading: Sections COS 461: Computer Networks Spring 2011 Mike Freedman
15-744: Computer Networking L-10 Congestion Control.
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.
Computer Networking Lecture 16 – TCP & Congestion Control Copyright ©, Carnegie Mellon 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.
Data Communication and Networks
EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
L13: Sharing in network systems Dina Katabi Spring Some slides are from lectures by Nick Mckeown, Ion Stoica, Frans.
TCP Congestion Control
Congestion Control Michael Freedman COS 461: Computer Networks
TCP: flow and congestion control. Flow Control Flow Control is a technique for speed-matching of transmitter and receiver. Flow control ensures that a.
Lect3..ppt - 09/12/04 CIS 4100 Systems Performance and Evaluation Lecture 3 by Zornitza Genova Prodanoff.
Courtesy: Nick McKeown, Stanford 1 TCP Congestion Control Tahir Azim.
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 Layer 4 2: Transport Layer 4.
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)
Principles of Congestion Control Congestion: informally: “too many sources sending too much data too fast for network to handle” different from flow control!
Chapter 12 Transmission Control Protocol (TCP)
1 Transport Layer Lecture 10 Imran Ahmed University of Management & Technology.
CS640: Introduction to Computer Networks Aditya Akella Lecture 15 TCP – III Reliability and Implementation Issues.
Computer Networking Lecture 18 – More TCP & Congestion Control.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
CS640: Introduction to Computer Networks Aditya Akella Lecture 15 TCP – III Reliability and Implementation Issues.
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.
By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.
Winter 2008CS244a Handout 71 CS244a: An Introduction to Computer Networks Handout 7: Congestion Control Nick McKeown Professor of Electrical Engineering.
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 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Congestion Control 0.
CS640: Introduction to Computer Networks Aditya Akella Lecture 15 TCP – II - Connection Set-up and Congestion Control.
CS640: Introduction to Computer Networks Aditya Akella Lecture 15 TCP Congestion Control.
@Yuan Xue A special acknowledge goes to J.F Kurose and K.W. Ross Some of the slides used in this lecture are adapted from their.
1 Flow & Congestion Control Some slides are from lectures by Nick Mckeown, Ion Stoica, Frans Kaashoek, Hari Balakrishnan, and Sam Madden Prof. Dina Katabi.
Computer Networking Lecture 8 – TCP & Congestion Control.
Lecture 17 – TCP & Congestion Control
Topics discussed in this section:
Chapter 3 outline 3.1 transport-layer services
Chapter 3 outline 3.1 Transport-layer services
TCP Congestion Control
TCP Congestion 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 Congestion Control
Lecture 19 – TCP Performance
So far, On the networking side, we looked at mechanisms to links hosts using direct linked networks and then forming a network of these networks. We introduced.
Chapter 6 TCP Congestion Control
TCP Congestion Control
TCP Congestion Control
TCP Overview.
Transport Layer: Congestion Control
Chapter 3 outline 3.1 Transport-layer services
Congestion Michael Freedman COS 461: Computer Networks
Presentation transcript:

TCP and Congestion Control Nick Feamster Computer Networking I Spring 2013

Sequence Numbers How large do sequence numbers need to be? E.g. Must be able to detect wrap-around Depends on sender/receiver window size E.g. Max seq = 7, send win=recv win=7 If pkts 0..6 are sent succesfully and all acks lost Receiver expects 7,0..5, sender retransmits old 0..6!!! Max sequence must be ≥ send window + recv window Xxx picture

Sequence Numbers 32 Bits, Unsigned  for bytes not packets! Circular Comparison Why So Big? For sliding window, must have |Sequence Space| > |Sending Window| + |Receiving Window| No problem Also, want to guard against stray packets With IP, packets have maximum lifetime of 120s Sequence number would wrap around in this time at 286MB/s =~ 2.3Gbit/s (hmm!) Max a b a < b Max b a b < a

TCP Flow Control TCP is a sliding window protocol For window size n, can send up to n bytes without receiving an acknowledgement When the data is acknowledged then the window slides forward Each packet advertises a window size Indicates number of bytes the receiver has space for Original TCP always sent entire window But receiver buffer space != available net. capacity! Congestion control now limits this window = min(receiver window, congestion window)

Window Flow Control: Send Side Sent but not acked Not yet sent Sent and acked Next to be sent Lecture 17: TCP & Congestion Control

Window Flow Control: Send Side Packet Sent Packet Received Source Port Dest. Port Source Port Dest. Port Sequence Number Sequence Number Acknowledgment Acknowledgment HL/Flags Window HL/Flags Window D. Checksum Urgent Pointer D. Checksum Urgent Pointer Options… Options... App write acknowledged sent to be sent outside window Lecture 17: TCP & Congestion Control

Window Flow Control: Receive Side What should receiver do? New Receive buffer Acked but not delivered to user Not yet acked window

Internet Pipes? How should you control the faucet? Goals Too fast – sink overflows Too slow – what happens? Goals Fill the bucket as quickly as possible Avoid overflowing the sink Solution – watch the sink

The Problem of Congestion What is congestion? Load is higher than capacity What do IP routers do? Drop the excess packets Why is this bad? Wasted bandwidth for retransmissions “congestion collapse” Goodput Increase in load that results in a decrease in useful work done. Load

Congestion Different sources compete for resources inside network 10 Mbps 1.5 Mbps 100 Mbps Different sources compete for resources inside network Why is it a problem? Sources are unaware of current state of resource Sources are unaware of each other Manifestations: Lost packets (buffer overflow at routers) Long delays (queuing in router buffers) Can result in throughput less than bottleneck link (1.5Mbps for the above topology)  a.k.a. congestion collapse

No Problem Under Circuit Switching Source establishes connection to destination Nodes reserve resources for the connection Circuit rejected if the resources aren’t available Cannot have more than the network can handle

Congestion is Unavoidable Two packets arrive at the same time The node can only transmit one … and either buffer or drop the other If many packets arrive in short period of time The node cannot keep up with the arriving traffic … and the buffer may eventually overflow

The Problem of Congestion What is congestion? Load is higher than capacity What do IP routers do? Drop the excess packets Why is this bad? Wasted bandwidth for retransmissions “congestion collapse” Goodput Increase in load that results in a decrease in useful work done. Load

Congestion Collapse Definition: Increase in network load results in decrease of useful work done Many possible causes Spurious retransmissions of packets still in flight Classical congestion collapse How can this happen with packet conservation? RTT increases! Solution: better timers and TCP congestion control Undelivered packets Packets consume resources and are dropped elsewhere in network Solution: congestion control for ALL traffic

Congestion Control and Avoidance A mechanism that: Uses network resources efficiently Preserves fair network resource allocation Prevents or avoids collapse Congestion collapse is not just a theory Has been frequently observed in many networks

Congestion Control Approaches Two broad approaches 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 Problem: makes routers complicated

Example: TCP Congestion Control Very simple mechanisms in network FIFO scheduling with shared buffer pool Feedback through packet drops TCP interprets packet drops as signs of congestion and slows down This is an assumption: packet drops are not a sign of congestion in all networks E.g. wireless networks Periodically probes the network to check whether more bandwidth has become available.

Inferring From Implicit Feedback ? What does the end host see? What can the end host change?

Where Congestion Happens: Links Simple resource allocation: FIFO queue & drop-tail Access to the bandwidth: first-in first-out queue Packets transmitted in the order they arrive Access to the buffer space: drop-tail queuing If the queue is full, drop the incoming packet

How it Looks to the End Host Packet delay Packet experiences high delay Packet loss Packet gets dropped along the way How does TCP sender learn this? Delay Round-trip time estimate Loss Timeout Duplicate acknowledgments

What Can the End Host Do? Upon detecting congestion Decrease the sending rate (e.g., divide in half) End host does its part to alleviate the congestion But, what if conditions change? Suppose there is more bandwidth available Would be a shame to stay at a low sending rate Upon not detecting congestion Increase the sending rate, a little at a time And see if the packets are successfully delivered

TCP Congestion Window Each TCP sender maintains a congestion window Maximum number of bytes to have in transit I.e., number of bytes still awaiting acknowledgments Adapting the congestion window Decrease upon losing a packet: backing off Increase upon success: optimistically exploring Always struggling to find the right transfer rate Both good and bad Pro: avoids having explicit feedback from network Con: under-shooting and over-shooting the rate

Additive Increase, Multiplicative Decrease How much to increase and decrease? Increase linearly, decrease multiplicatively A necessary condition for stability of TCP Consequences of over-sized window are much worse than having an under-sized window Over-sized window: packets dropped and retransmitted Under-sized window: somewhat lower throughput Multiplicative decrease On loss of packet, divide congestion window in half Additive increase On success for last window of data, increase linearly

Leads to the TCP “Sawtooth” Window Loss halved t

Practical Details Congestion window Increasing the congestion window Represented in bytes, not in packets (Why?) Packets have MSS (Maximum Segment Size) bytes Increasing the congestion window Increase by MSS on success for last window of data Decreasing the congestion window Never drop congestion window below 1 MSS

Receiver Window vs. Congestion Window Flow control Keep a fast sender from overwhelming a slow receiver Congestion control Keep a set of senders from overloading the network Different concepts, but similar mechanisms TCP flow control: receiver window TCP congestion control: congestion window TCP window: min{congestion window, receiver window}

How Should a New Flow Start Need to start with a small CWND to avoid overloading the network. Window But, could take a long time to get started! t

“Slow Start” Phase Start with a small congestion window Initially, CWND is 1 Max Segment Size (MSS) So, initial sending rate is MSS/RTT That could be pretty wasteful Might be much less than the actual bandwidth Linear increase takes a long time to accelerate Slow-start phase (really “fast start”) Sender starts at a slow rate (hence the name) … but increases the rate exponentially … until the first loss event

Double CWND per round-trip time Slow Start in Action Double CWND per round-trip time 1 2 4 8 Src D D A A D D D D D A A A A A Dest

Slow Start and the TCP Sawtooth Window Loss t Exponential “slow start” Why is it called slow-start? Because TCP originally had no congestion control mechanism. The source would just start by sending a whole receiver window’s worth of data.

Two Kinds of Loss in TCP Timeout Triple duplicate ACK Packet n is lost and detected via a timeout E.g., because all packets in flight were lost After the timeout, blasting away for the entire CWND … would trigger a very large burst in traffic So, better to start over with a low CWND Triple duplicate ACK Packet n is lost, but packets n+1, n+2, etc. arrive Receiver sends duplicate acknowledgments … and the sender retransmits packet n quickly Do a multiplicative decrease and keep going

Repeating Slow Start After Timeout Window timeout Slow start in operation until it reaches half of previous cwnd. t Slow-start restart: Go back to CWND of 1, but take advantage of knowing the previous value of CWND.

Repeating Slow Start After Idle Period Suppose a TCP connection goes idle for a while E.g., Telnet session where you don’t type for an hour Eventually, the network conditions change Maybe many more flows are traversing the link E.g., maybe everybody has come back from lunch! Dangerous to start transmitting at the old rate Previously-idle TCP sender might blast the network … causing excessive congestion and packet loss So, some TCP implementations repeat slow start Slow-start restart after an idle period

TCP Achieves Some Notion of Fairness Effective utilization is not the only goal We also want to be fair to the various flows … but what the heck does that mean? Simple definition: equal shares of the bandwidth N flows that each get 1/N of the bandwidth? But, what if the flows traverse different paths? E.g., bandwidth shared in proportion to the RTT

What About Cheating? Some folks are more fair than others Running multiple TCP connections in parallel Modifying the TCP implementation in the OS Use the User Datagram Protocol What is the impact Good guys slow down to make room for you You get an unfair share of the bandwidth Possible solutions? Routers detect cheating and drop excess packets? Peer pressure? ???