CS4700/CS5700 Fundamentals of Computer Networks

Similar documents
COMP/ELEC 429/556 Introduction to Computer Networks

CS4700/CS5700 Fundaments of Computer Networks

Outline Computer Networking. Functionality Split. Transport Protocols

CS457 Transport Protocols. CS 457 Fall 2014

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

UDP, TCP, IP multicast

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

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

User Datagram Protocol (UDP):

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

CS3600 SYSTEMS AND NETWORKS

ECE 650 Systems Programming & Engineering. Spring 2018

User Datagram Protocol

Transport Layer Marcos Vieira

TCP and Congestion Control (Day 1) Yoshifumi Nishida Sony Computer Science Labs, Inc. Today's Lecture

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP 23.1

The Transmission Control Protocol (TCP)

Transport Layer: outline

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

The Transport Layer: TCP & Reliable Data Transfer

Connection-oriented (virtual circuit) Reliable Transfer Buffered Transfer Unstructured Stream Full Duplex Point-to-point Connection End-to-end service

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

7. TCP 최양희서울대학교컴퓨터공학부

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

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

Functionality Split Computer Networking. Transport Protocols. Overview. Multiplexing & Demultiplexing

TCP Service Model. Today s Lecture. TCP Support for Reliable Delivery. EE 122:TCP, Connection Setup, Reliability

Networking Technologies and Applications

TSIN02 - Internetworking

CSC 4900 Computer Networks: TCP

TCP. CSU CS557, Spring 2018 Instructor: Lorenzo De Carli (Slides by Christos Papadopoulos, remixed by Lorenzo De Carli)

Transport Layer: Outline

05 Transmission Control Protocol (TCP)

TSIN02 - Internetworking

Introduction to Networking. Operating Systems In Depth XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Good Ideas So Far Computer Networking. Outline. Sequence Numbers (reminder) TCP flow control. Congestion sources and collapse

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

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

Lecture 3: The Transport Layer: UDP and TCP

CS 716: Introduction to communication networks th class; 7 th Oct Instructor: Sridhar Iyer IIT Bombay

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

Chapter 24. Transport-Layer Protocols

CS4700/CS5700 Fundamentals of Computer Networks

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

Reliable Transport I: Concepts and TCP Protocol

CSCD 330 Network Programming

CE693 Advanced Computer Networks

TCP/IP Networking. Part 4: Network and Transport Layer Protocols

NWEN 243. Networked Applications. Layer 4 TCP and UDP

Lecture 8. TCP/IP Transport Layer (2)

Page 1. Goals for Today" Discussion" Example: Reliable File Transfer" CS162 Operating Systems and Systems Programming Lecture 11

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

Chapter 3- parte B outline

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

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

10 minutes survey (anonymous)

ECE697AA Lecture 3. Today s lecture

CSC 401 Data and Computer Communications Networks

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

Transport Layer. -UDP (User Datagram Protocol) -TCP (Transport Control Protocol)

Intro to LAN/WAN. Transport Layer

CS3600 SYSTEMS AND NETWORKS

EE 122: Transport Protocols. Kevin Lai October 16, 2002

Introduction to Networks and the Internet

Different Layers Lecture 20

Lecture 5: Flow Control. CSE 123: Computer Networks Alex C. Snoeren

TCP Basics : Computer Networking. Overview. What s Different From Link Layers? Introduction to TCP. TCP reliability Assigned reading

Applied Networks & Security

CSCE 463/612 Networks and Distributed Processing Spring 2017

TSIN02 - Internetworking

TSIN02 - Internetworking

Multiple unconnected networks

UNIT IV -- TRANSPORT LAYER

Kent State University

Transport Layer Protocols TCP

Chapter 3 Transport Layer

Computer Networking Introduction

Transport Protocols and TCP

Reliable Transport I: Concepts and TCP Protocol

CSE 4213: Computer Networks II

Outline. Internet. Router. Network Model. Internet Protocol (IP) Design Principles

EE 122: Transport Protocols: UDP and TCP

Lecture 5. Transport Layer. Transport Layer 1-1

Internet Layers. Physical Layer. Application. Application. Transport. Transport. Network. Network. Network. Network. Link. Link. Link.

Announcements Computer Networking. What was hard. Midterm. Lecture 16 Transport Protocols. Avg: 62 Med: 67 STD: 13.

CS4700/CS5700 Fundaments of Computer Networks

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

OSI Transport Layer. objectives

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

NT1210 Introduction to Networking. Unit 10

Chapter 3 Transport Layer

Sequence Number. Acknowledgment Number. Data

Page 1. Goals for Today" Placing Network Functionality" Basic Observation" CS162 Operating Systems and Systems Programming Lecture 15

Internet and Intranet Protocols and Applications

Unit 2.

OSI Transport Layer. Network Fundamentals Chapter 4. Version Cisco Systems, Inc. All rights reserved. Cisco Public 1

Application. Transport. Network. Link. Physical

Goals for Today s Lecture

Transcription:

CS4700/CS5700 Fundamentals of Computer Networks Lecture 14: TCP Slides used with permissions from Edward W. Knightly, T. S. Eugene Ng, Ion Stoica, Hui Zhang Alan Mislove amislove at ccs.neu.edu Northeastern 1 University

What Layers are Needed in a Basic Telephone Network? Supports a single application: Telephone An end host is a telephone Each telephone makes only one voice stream Even with call-waiting and 3-way calling Application Layer Network Layer (Data) Link Layer Telephone Telephone numbering, signaling, routing TDMA Alan Mislove amislove at ccs.neu.edu Northeastern 2 University

Is this Enough for a Datagram Computer Network? Supports many applications Each end host is usually a general purpose computer Each end host can be generating many data streams simultaneously In theory, each data stream can be identified as a different Protocol in the IP header for demultiplexing At most 256 streams Insert Transport Layer to create an interface for different applications Provide (de)multiplexing Provide value-added functions Application Layer Transport Layer Network Layer (Data) Link Layer telnet, ftp, email TCP, UDP IP 802.3, 802.11 Alan Mislove amislove at ccs.neu.edu Northeastern 3 University

E.g. Using Transport Layer Port Number to (De) multiplex traffic Application telnet HTTP ssh ports p1 p2 p1 p2 p3 p1 p2 TCP Transport IP A B C In TCP, a data stream is identified by a set of numbers: (Source Address, Destination Address, Source Port, Destination Port) Alan Mislove amislove at ccs.neu.edu Northeastern 4 University

Transport Layer in Internet Purpose 1: (De)multiplexing of data streams to different application processes Purpose 2: Provide value-added services that many applications want Recall network layer in Internet provides a Best-effort service only, transport layer can add value to that Application may want reliability, etc No need to reinvent the wheel each time you write a new application Alan Mislove amislove at ccs.neu.edu Northeastern 5 University

Transport Protocols Concern only End Hosts, not Routers Lowest level end-to-end protocol. Header generated by sender is interpreted only by the destination Routers view transport header as part of the payload Adds functionality to the best-effort packet delivery IP service. Make up for the shortcomings of the core network 5 Transport IP Datalink Physical IP 2 2 1 1 router 5 Transport IP Datalink Physical Alan Mislove amislove at ccs.neu.edu Northeastern 6 University

(Possible) Transport Protocol Functions Alan Mislove amislove at ccs.neu.edu Northeastern 7 University

(Possible) Transport Protocol Functions Multiplexing/demultiplexing for multiple applications. Port abstraction Alan Mislove amislove at ccs.neu.edu Northeastern 7 University

(Possible) Transport Protocol Functions Multiplexing/demultiplexing for multiple applications. Port abstraction Connection establishment. Logical end-to-end connection Connection state to optimize performance Alan Mislove amislove at ccs.neu.edu Northeastern 7 University

(Possible) Transport Protocol Functions Multiplexing/demultiplexing for multiple applications. Port abstraction Connection establishment. Logical end-to-end connection Connection state to optimize performance Error control. Hide unreliability of the network layer from applications Many types of errors: corruption, loss, duplication, reordering. Alan Mislove amislove at ccs.neu.edu Northeastern 7 University

(Possible) Transport Protocol Functions Multiplexing/demultiplexing for multiple applications. Port abstraction Connection establishment. Logical end-to-end connection Connection state to optimize performance Error control. Hide unreliability of the network layer from applications Many types of errors: corruption, loss, duplication, reordering. End-to-end flow control. Avoid flooding the receiver Alan Mislove amislove at ccs.neu.edu Northeastern 7 University

(Possible) Transport Protocol Functions Multiplexing/demultiplexing for multiple applications. Port abstraction Connection establishment. Logical end-to-end connection Connection state to optimize performance Error control. Hide unreliability of the network layer from applications Many types of errors: corruption, loss, duplication, reordering. End-to-end flow control. Avoid flooding the receiver Congestion control. Avoid flooding the network Alan Mislove amislove at ccs.neu.edu Northeastern 7 University

(Possible) Transport Protocol Functions Multiplexing/demultiplexing for multiple applications. Port abstraction Connection establishment. Logical end-to-end connection Connection state to optimize performance Error control. Hide unreliability of the network layer from applications Many types of errors: corruption, loss, duplication, reordering. End-to-end flow control. Avoid flooding the receiver Congestion control. Avoid flooding the network More. Alan Mislove amislove at ccs.neu.edu Northeastern 7 University

User Datagram Protocol (UDP) Connectionless datagram Socket: SOCK_DGRAM Port number used for (de)multiplexing port numbers = connection/application endpoint Adds end-to-end reliability through optional checksum protects against data corruption errors between source and destination (links, switches/routers, bus) does not protect against packet loss, duplication or reordering 0 16 32 Source Port Length Dest. Port Checksum Alan Mislove amislove at ccs.neu.edu Northeastern 8 University

Using UDP Custom protocols/applications can be implemented on top of UDP use the port addressing provided by UDP implement own reliability, flow control, ordering, congestion control as it sees fit Examples: remote procedure call Multimedia streaming (real time protocol) distributed computing communication libraries Alan Mislove amislove at ccs.neu.edu Northeastern 9 University

Transmission Control Protocol (TCP) 0 16 32 Source Port Dest. Port Sequence Number Acknowledgment Number HL/Flags Advertised Win. Checksum Urgent Pointer Options.. Alan Mislove amislove at ccs.neu.edu Northeastern 10 University

Transmission Control Protocol (TCP) Reliable bidirectional in-order byte stream Socket: SOCK_STREAM 0 16 32 Source Port Dest. Port Sequence Number Acknowledgment Number HL/Flags Advertised Win. Checksum Urgent Pointer Options.. Alan Mislove amislove at ccs.neu.edu Northeastern 10 University

Transmission Control Protocol (TCP) Reliable bidirectional in-order byte stream Socket: SOCK_STREAM Connections established & torn down 0 16 32 Source Port Dest. Port Sequence Number Acknowledgment Number HL/Flags Advertised Win. Checksum Urgent Pointer Options.. Alan Mislove amislove at ccs.neu.edu Northeastern 10 University

Transmission Control Protocol (TCP) Reliable bidirectional in-order byte stream Socket: SOCK_STREAM Connections established & torn down Multiplexing/ demultiplexing Ports at both ends 0 16 32 Source Port Dest. Port Sequence Number Acknowledgment Number HL/Flags Checksum Advertised Win. Urgent Pointer Options.. Alan Mislove amislove at ccs.neu.edu Northeastern 10 University

Transmission Control Protocol (TCP) Reliable bidirectional in-order byte stream Socket: SOCK_STREAM Connections established & torn down Multiplexing/ demultiplexing Ports at both ends Error control Users see correct, ordered byte sequences 0 16 32 Source Port Dest. Port Sequence Number Acknowledgment Number HL/Flags Advertised Win. Checksum Urgent Pointer Options.. Alan Mislove amislove at ccs.neu.edu Northeastern 10 University

Transmission Control Protocol (TCP) Reliable bidirectional in-order byte stream Socket: SOCK_STREAM Connections established & torn down Multiplexing/ demultiplexing Ports at both ends Error control Users see correct, ordered byte sequences End-end flow control Avoid overwhelming machines at each end 0 16 32 Source Port Dest. Port Sequence Number Acknowledgment Number HL/Flags Checksum Options.. Advertised Win. Urgent Pointer Alan Mislove amislove at ccs.neu.edu Northeastern 10 University

Transmission Control Protocol (TCP) Reliable bidirectional in-order byte stream Socket: SOCK_STREAM Connections established & torn down Multiplexing/ demultiplexing Ports at both ends Error control Users see correct, ordered byte sequences End-end flow control Avoid overwhelming machines at each end Congestion avoidance Avoid creating traffic jams within network 0 16 32 Source Port Dest. Port Sequence Number Acknowledgment Number HL/Flags Checksum Options.. Advertised Win. Urgent Pointer Alan Mislove amislove at ccs.neu.edu Northeastern 10 University

High Level TCP Features Sliding window protocol Use sequence numbers Bi-directional Each host can be a receiver and a sender simultaneously For clarity, we will usually discuss only one direction Alan Mislove amislove at ccs.neu.edu Northeastern 11 University

Connection Setup Why need connection setup? Mainly to agree on starting sequence numbers Starting sequence number is randomly chosen Reason, to reduce the chance that sequence numbers of old and new connections from overlapping Alan Mislove amislove at ccs.neu.edu Northeastern 12 University

Important TCP Flags SYN: Synchronize Used when setting up connection FIN: Finish Used when tearing down connection ACK Acknowledging received data Alan Mislove amislove at ccs.neu.edu Northeastern 13 University

Establishing Connection Client SYN: SeqC ACK: SeqC+1 SYN: SeqS Server ACK: SeqS+1 Three-Way Handshake Each side notifies other of starting sequence number it will use for sending Each side acknowledges other s sequence number SYN-ACK: Acknowledge sequence number + 1 Can combine second SYN with first ACK Alan Mislove amislove at ccs.neu.edu Northeastern 14 University

TCP State Diagram: Connection Setup passive OPEN CLOSED CLOSE active OPEN Snd SYN LISTEN CLOSE delete TCB SYN RCVD rcv SYN snd SYN ACK rcv ACK of SYN rcv SYN snd ACK SEND snd SYN Rcv SYN, ACK Snd ACK SYN SENT CLOSE Send FIN ESTAB Alan Mislove amislove at ccs.neu.edu Northeastern 15 University

TCP State Diagram: Connection Setup passive OPEN CLOSED Client CLOSE active OPEN Snd SYN LISTEN CLOSE delete TCB SYN RCVD rcv SYN snd SYN ACK rcv ACK of SYN rcv SYN snd ACK SEND snd SYN Rcv SYN, ACK Snd ACK SYN SENT CLOSE Send FIN ESTAB Alan Mislove amislove at ccs.neu.edu Northeastern 15 University

TCP State Diagram: Connection Setup CLOSED Server passive OPEN Client CLOSE active OPEN Snd SYN LISTEN CLOSE delete TCB SYN RCVD rcv SYN snd SYN ACK rcv ACK of SYN rcv SYN snd ACK SEND snd SYN Rcv SYN, ACK Snd ACK SYN SENT CLOSE Send FIN ESTAB Alan Mislove amislove at ccs.neu.edu Northeastern 15 University

Tearing Down Connection Either Side Can Initiate Tear Down Send FIN signal I m not going to send any more data Other Side Can Continue Sending Data Half open connection Must continue to acknowledge Acknowledging FIN Acknowledge last sequence number + 1 A FIN, SeqA ACK, SeqA+1 ACK Data FIN, SeqB ACK, SeqB+1 B Alan Mislove amislove at ccs.neu.edu Northeastern 16 University

State Diagram: Connection Tear-down CLOSE send FIN FIN WAIT-1 ACK FIN WAIT-2 CLOSE send FIN rcv FIN snd ACK rcv FIN+ACK snd ACK ESTAB CLOSING rcv FIN send ACK CLOSE WAIT CLOSE snd FIN LAST-ACK rcv ACK of FIN rcv ACK of FIN rcv FIN snd ACK TIME WAIT Timeout=2 MSL CLOSED Alan Mislove amislove at ccs.neu.edu Northeastern 17 University

State Diagram: Connection Tear-down CLOSE send FIN FIN WAIT-1 ACK FIN WAIT-2 Active Close CLOSE send FIN rcv FIN snd ACK rcv FIN+ACK snd ACK ESTAB CLOSING rcv FIN send ACK CLOSE WAIT CLOSE snd FIN LAST-ACK rcv ACK of FIN rcv ACK of FIN rcv FIN snd ACK TIME WAIT Timeout=2 MSL CLOSED Alan Mislove amislove at ccs.neu.edu Northeastern 17 University

State Diagram: Connection Tear-down CLOSE send FIN FIN WAIT-1 ACK FIN WAIT-2 Active Close CLOSE send FIN rcv FIN snd ACK rcv FIN+ACK snd ACK ESTAB CLOSING rcv FIN send ACK Passive Close CLOSE WAIT CLOSE snd FIN LAST-ACK rcv ACK of FIN rcv ACK of FIN rcv FIN snd ACK TIME WAIT Timeout=2 MSL CLOSED Alan Mislove amislove at ccs.neu.edu Northeastern 17 University

Sequence Number Space Each byte in byte stream is numbered. 32 bit value Wraps around Initial values selected at start up time TCP breaks up the byte stream in packets ( segments ) Packet size is limited to the Maximum Segment Size Set to prevent packet fragmentation Each segment has a sequence number. Indicates where it fits in the byte stream 13450 14950 16050 17550 segment 8 segment 9 segment 10 Alan Mislove amislove at ccs.neu.edu Northeastern 18 University

Sequence Numbers 32 Bits, Unsigned Why So Big? For sliding window, must have Sequence Space > 2* Sending Window 2^32 > 2 * 2^16. No problem Also, want to guard against stray packets With IP, assume packets have maximum segment lifetime (MSL) of 120s i.e. can linger in network for upto 120s Sequence number would wrap around in this time at 286Mbps Alan Mislove amislove at ccs.neu.edu Northeastern 19 University

Error Control Alan Mislove amislove at ccs.neu.edu Northeastern 20 University

Error Control Checksum (mostly) guarantees end-end data integrity. Alan Mislove amislove at ccs.neu.edu Northeastern 20 University

Error Control Checksum (mostly) guarantees end-end data integrity. Sequence numbers detect packet sequencing problems: Duplicate: ignore Reordered: reorder or drop Lost: retransmit Alan Mislove amislove at ccs.neu.edu Northeastern 20 University

Error Control Checksum (mostly) guarantees end-end data integrity. Sequence numbers detect packet sequencing problems: Duplicate: ignore Reordered: reorder or drop Lost: retransmit Lost segments detected by sender. Use time out to detect lack of acknowledgment Need estimate of the roundtrip time to set timeout Alan Mislove amislove at ccs.neu.edu Northeastern 20 University

Error Control Checksum (mostly) guarantees end-end data integrity. Sequence numbers detect packet sequencing problems: Duplicate: ignore Reordered: reorder or drop Lost: retransmit Lost segments detected by sender. Use time out to detect lack of acknowledgment Need estimate of the roundtrip time to set timeout Retransmission requires that sender keep copy of the data. Alan Mislove amislove at ccs.neu.edu Northeastern 20 University

Bidirectional Communication Send seq 2000 Ack seq 2001 Send seq 42000 Ack seq 42001 Each Side of Connection can Send and Receive What this Means Maintain different sequence numbers for each direction Single segment can contain new data for one direction, plus acknowledgement for other But some contain only data & others only acknowledgement Alan Mislove amislove at ccs.neu.edu Northeastern 21 University

TCP Flow Control Sliding window protocol For window size n, can send up to n bytes without receiving an acknowledgement When the data are acknowledged then the window slides forward Window size determines How much unacknowledged data can the sender sends But there is more detail Alan Mislove amislove at ccs.neu.edu Northeastern 22 University

Complication! TCP receiver can delete acknowledged data only after the data has been delivered to the application So, depending on how fast the application is reading the data, the receiver s window size may change!!! Alan Mislove amislove at ccs.neu.edu Northeastern 23 University

Solution Receiver tells sender what is the current window size in every packet it transmits to the sender Sender uses this current window size instead of a fixed value Window size (also called Advertised window) is continuously changing Can go to zero! Sender not allowed to send anything! Alan Mislove amislove at ccs.neu.edu Northeastern 24 University

Window Flow Control: Receive Side Receive buffer Acked but not delivered to user Not yet acked window Alan Mislove amislove at ccs.neu.edu Northeastern 25 University

Window Flow Control: Send Side window Sent and acked Sent but not acked Not yet sent Next to be sent Alan Mislove amislove at ccs.neu.edu Northeastern 26 University

Window Flow Control: Send Side window Sent and acked Sent but not acked Not yet sent Next to be sent Must retain for possible retransmission Alan Mislove amislove at ccs.neu.edu Northeastern 26 University

Window Flow Control: Send Side Packet Sent Source Port Dest. Port Sequence Number Acknowledgment HL/Flags Window D. Checksum Urgent Pointer Options.. Packet Received Source Port Dest. Port Sequence Number Acknowledgment HL/Flags Window D. Checksum Urgent Pointer Options.. App write acknowledged sent to be sent outside window Alan Mislove amislove at ccs.neu.edu Northeastern 27 University

Ongoing Communication Bidirectional Communication Each side acts as sender & receiver Every message contains acknowledgement of received sequence Even if no new data have been received Every message advertises window size Size of its receiving window Every message contains sent sequence number Even if no new data being sent When Does Sender Actually Send Message? When sending buffer contains at least max. segment size (- header sizes) bytes When application tells it Set PUSH flag for last segment sent When timer expires Alan Mislove amislove at ccs.neu.edu Northeastern 28 University

TCP Must Operates Over Any Internet Path Retransmission time-out should be set based on round-trip delay But round-trip delay different for each path! Must estimate RTT dynamically Alan Mislove amislove at ccs.neu.edu Northeastern 29 University

Setting Retransmission Timeout (RTO) Initial Send Initial Send RTO Retry RTO Ack Retry Ack Detect dropped packet RTO too short Time between sending & resending segment Challenge Too long: Add latency to communication when packets dropped Too short: Send too many duplicate packets General principle: Must be > 1 Round Trip Time (RTT) Alan Mislove amislove at ccs.neu.edu Northeastern 30 University

Round-trip Time Estimation Every Data/Ack pair gives new RTT estimate Data Sample Ack Alan Mislove amislove at ccs.neu.edu Northeastern 31 University

Original TCP Round-trip Estimator Round trip times estimated as a moving average: New RTT = α (old RTT) + (1 - α) (new sample) Recommended value for α: 0.8-0.9 0.875 for most TCP s Retransmit timer set to β RTT, where β = 2 Want to be somewhat conservative about retransmitting Alan Mislove amislove at ccs.neu.edu Northeastern 32 University

A RTT Sample Ambiguity B Sample RTT Original transmission RTO X retransmission ACK Ignore sample for segment that has been retransmitted Alan Mislove amislove at ccs.neu.edu Northeastern 33 University

A RTT Sample Ambiguity B A B Sample RTT Original transmission RTO X retransmission Sample RTT Original transmission RTO ACK retransmission ACK Ignore sample for segment that has been retransmitted Alan Mislove amislove at ccs.neu.edu Northeastern 33 University

What is Congestion? The load placed on the network is higher than the capacity of the network Not surprising: independent senders place load on network Results in packet loss: routers have no choice Can only buffer finite amount of data End-to-end protocol will typically react, e.g. TCP Alan Mislove amislove at ccs.neu.edu Northeastern 34 University

Why is Congestion Bad? Wasted bandwidth: retransmission of dropped packets Poor user service : unpredictable delay, low user goodput Increased load can even result in lower network goodput Switched nets: packet losses create lots of retransmissions Broadcast Ethernet: high demand -> many collisions Goodput congestion collapse Load Alan Mislove amislove at ccs.neu.edu Northeastern 35 University

Sending Rate of Sliding Window Protocol Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Window size = 64KB Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Window size = 64KB Network round-trip delay is 1 second Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Window size = 64KB Network round-trip delay is 1 second Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Window size = 64KB Network round-trip delay is 1 second What s the expected sending rate? Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Window size = 64KB Network round-trip delay is 1 second What s the expected sending rate? 64KB/second Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Window size = 64KB Network round-trip delay is 1 second What s the expected sending rate? 64KB/second Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Window size = 64KB Network round-trip delay is 1 second What s the expected sending rate? 64KB/second What if a network link is only 64KB/second but there are 1000 people who are transferring files over that link using the sliding window protocol? Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

Sending Rate of Sliding Window Protocol Suppose A uses a sliding window protocol to transmit a large data file to B Window size = 64KB Network round-trip delay is 1 second What s the expected sending rate? 64KB/second What if a network link is only 64KB/second but there are 1000 people who are transferring files over that link using the sliding window protocol? Packet losses, timeouts, retransmissions, more packet losses nothing useful gets through, congestion collapse! Alan Mislove amislove at ccs.neu.edu Northeastern 36 University

TCP Window Flow Control Packet Sent Source Port Dest. Port Sequence Number Acknowledgment HL/Flags Window D. Checksum Urgent Pointer Options.. Packet Received Source Port Dest. Port Sequence Number Acknowledgment HL/Flags Window D. Checksum Urgent Pointer Options.. App write acknowledged sent to be sent outside window Alan Mislove amislove at ccs.neu.edu Northeastern 37 University

TCP Flow Control Alone Is Not Enough We have talked about how TCP s advertised window is used for flow control To keep sender sending faster than the receiver can handle If the receiver is sufficiently fast, then the advertised window will be maximized at all time But clearly, this will lead to congestion collapse as the previous example if there are too many senders or network is too slow Key 1: Window size determines sending rate Key 2: Window size must be dynamically adjusted to prevent congestion collapse Alan Mislove amislove at ccs.neu.edu Northeastern 38 University

How Fast to Send? What s at Stake? Send too slow: link sits idle wastes time Goodput safe operating point Send too fast: link is kept busy but... queue builds up in router buffer (delay) overflow buffers in routers (loss) Many retransmissions, many losses Network goodput goes down Load Alan Mislove amislove at ccs.neu.edu Northeastern 39 University

Abstract View A Sending Host Buffer in bottleneck Router B Receiving Host We ignore internal structure of network and model it as having a single bottleneck link Alan Mislove amislove at ccs.neu.edu Northeastern 40 University

Three Congestion Control Problems Adjusting to bottleneck bandwidth Adjusting to variations in bandwidth Sharing bandwidth between flows Alan Mislove amislove at ccs.neu.edu Northeastern 41 University