Transmission Control Protocol. ITS 413 Internet Technologies and Applications

Similar documents
CS321: Computer Networks Congestion Control in TCP

ITS323: Introduction to Data Communications

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

Congestion / Flow Control in 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

Congestion Control. Daniel Zappala. CS 460 Computer Networking Brigham Young University

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

Chapter III: Transport Layer

TCP Congestion Control

TCP Congestion Control

ECE 333: Introduction to Communication Networks Fall 2001

Multiple unconnected networks

Lecture 4: Congestion Control

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

Computer Networking Introduction

CNT 6885 Network Review on Transport Layer

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

Chapter 3- parte B outline

COMP/ELEC 429/556 Introduction to Computer Networks

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

CS 5520/ECE 5590NA: Network Architecture I Spring Lecture 13: UDP and TCP

CS519: Computer Networks. Lecture 5, Part 4: Mar 29, 2004 Transport: TCP congestion control

TCP Review. Carey Williamson Department of Computer Science University of Calgary Winter 2018

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

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

User Datagram Protocol

Lecture 8. TCP/IP Transport Layer (2)

CSCD 330 Network Programming Winter 2015

Congestion Control In The Internet Part 2: How it is implemented in TCP. JY Le Boudec 2014

Chapter 3 Transport Layer

Congestion Control In The Internet Part 2: How it is implemented in TCP. JY Le Boudec 2014

TCP congestion control:

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

CSCI Topics: Internet Programming Fall 2008

Congestion Control In The Internet Part 2: How it is implemented in TCP. JY Le Boudec 2015

Fall 2012: FCM 708 Bridge Foundation I

Lecture 3: The Transport Layer: UDP and TCP

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

image 3.8 KB Figure 1.6: Example Web Page

The Transport Layer Congestion control in TCP

Congestion control in TCP

Transport Protocols. Raj Jain. Washington University in St. Louis

Chapter 3 Transport Layer

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

Computer Communication Networks Midterm Review

TCP: Transmission Control Protocol UDP: User Datagram Protocol TCP - 1

Fast Retransmit. Problem: coarsegrain. timeouts lead to idle periods Fast retransmit: use duplicate ACKs to trigger retransmission

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

CSCD 330 Network Programming

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

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

User Datagram Protocol (UDP):

cs/ee 143 Communication Networks

CS457 Transport Protocols. CS 457 Fall 2014

Flow and Congestion Control (Hosts)

UNIT IV -- TRANSPORT LAYER

ADVANCED COMPUTER NETWORKS

TCP so far Computer Networking Outline. How Was TCP Able to Evolve

TCP based Receiver Assistant Congestion Control

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

Congestion Control End Hosts. CSE 561 Lecture 7, Spring David Wetherall. How fast should the sender transmit data?

CSC 4900 Computer Networks: TCP

Chapter 7. The Transport Layer

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

Two approaches to Flow Control. Cranking up to speed. Sliding windows in action

Answers to Sample Questions on Transport Layer

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

Topics. TCP sliding window protocol TCP PUSH flag TCP slow start Bulk data throughput

Transport protocols. Transport Layer 3-1

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

9th Slide Set Computer Networks

Outline. CS5984 Mobile Computing

Chapter 24. Transport-Layer Protocols

Transport Protocols and TCP

TCP Performance. EE 122: Intro to Communication Networks. Fall 2006 (MW 4-5:30 in Donner 155) Vern Paxson TAs: Dilip Antony Joseph and Sukun Kim

Chapter 3 Transport Layer

Recap. TCP connection setup/teardown Sliding window, flow control Retransmission timeouts Fairness, max-min fairness AIMD achieves max-min fairness

05 Transmission Control Protocol (TCP)

Overview. TCP congestion control Computer Networking. TCP modern loss recovery. TCP modeling. TCP Congestion Control AIMD

Mid Term Exam Results

CSC 8560 Computer Networks: TCP

Sequence Number. Acknowledgment Number. Data

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

Congestion Control In The Internet Part 2: How it is implemented in TCP. JY Le Boudec 2015

CS 356: Introduction to Computer Networks. Lecture 16: Transmission Control Protocol (TCP) Chap. 5.2, 6.3. Xiaowei Yang

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

Flow and Congestion Control

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

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

TSIN02 - Internetworking

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

CC451 Computer Networks

CS4700/CS5700 Fundamentals of Computer Networks

Transport Protocols & TCP TCP

Introduction to Networks and the Internet

Chapter III: Transport Layer

Detecting half-open connections. Observed TCP problems

Outline Computer Networking. TCP slow start. TCP modeling. TCP details AIMD. Congestion Avoidance. Lecture 18 TCP Performance Peter Steenkiste

CS3600 SYSTEMS AND NETWORKS

Transcription:

Transmission Control Protocol ITS 413 Internet Technologies and Applications

Contents Overview of TCP (Review) TCP and Congestion Control The Causes of Congestion Approaches to Congestion Control TCP Congestion Control TCP Performance Issues Window Size RTT Estimation Fairness ITS 413 - Transmission Control Protocol 2

Overview of TCP

Transmission Control Protocol The most commonly used transport protocol today Almost all Internet applications that require reliability use TCP Web browsing, email, file sharing, instant messaging, file transfer, database access, proprietary business applications, some multimedia applications (at least for control purposes), TCP provides a reliable, stream-oriented transport service: Stream of bits (or bytes) flow between end-points Stream is unstructured Connection-oriented data transfer Set up a connection before sending data Buffered transfer Applications generate any sized messages TCP may buffer messages until large datagram is formed Option to force (push) the transmission Full duplex connection Once the connection is setup, data can be sent in both directions Reliability Positive acknowledgement with retransmission ITS 413 - Transmission Control Protocol 4

TCP Segment Header contains 20 bytes, plus optional fields Optional fields must be padded out to multiple of 4 bytes 20 bytes ITS 413 - Transmission Control Protocol 5

TCP Segment Fields Source/Destination port: 16 bit port number of the source/destination Sequence number of the first data byte in this segment Unless the SYN flag is set, in which case the sequence number is the Initial Sequence Number (ISN) Acknowledgement number: sequence number of the next data byte TCP expects to receive Header Length: Size of header (measured in 4 bytes) Reserved for future use Flags see next slide Window contains the number of bytes the receiver is willing to accept (for flow control) Checksum for detecting errors in the TCP segment Urgent pointer points to the sequence number of the last byte of urgent data in the segment Options: such as maximum segment size, window scaling, selective acknowledgement, ITS 413 - Transmission Control Protocol 6

TCP Segment Flags Flags (1 bit each, if 1 the flag is true or on): CWR: Congestion Window Reduced ECE: Explicit Congestion Notification Echo CWR and ECE are used on a special congestion control mechanism we do not cover this in ITS 323 URG: segment carries urgent data, use the urgent pointer field; receiver should notify application program of urgent data as soon as possible ACK: segment carries ACK, use the ACK field PSH: push function RST: reset the connection SYN: synchronise the sequence numbers FIN: no more data from sender Note There is only one type of TCP packet However the purpose of that packet may differ depending on the flags set If SYN flag is set, we may call it a SYN packet or TCP SYN If the ACK flag is set, we may call it a ACK packet If the packet carries data, we may call it a DATA packet If the packet carries data and the ACK flag is set, it is both a DATA and ACK packet ITS 413 - Transmission Control Protocol 7

Main TCP Features Connection Management Aim: Initialise parameters for data transfer Setup a connection before sending data Teardown a connection when finished Reliability Aim: ensure all data is deliver intact, in-order to receiver Sequence numbers Re-transmission schemes Basic (retransmit after timeout), Fast Retransmit (retransmit after receiving 3 duplicate ACKs) Flow Control Aim: ensure the sender does not overflow the receiver Receiver indicates free space in buffer in Advertised Window of ACK Sender cannot send more than the Advertised Window Congestion Control Aim: ensure the sender does not overflow the network (routers) ITS 413 - Transmission Control Protocol 8

The Causes of Congestion

What is Congestion? Congestion occurs when the number of packets being transmitted through the network approaches the packet handling capacity of the network What is the packet handling capacity of a network? What happens when capacity is approached? Congestion control aims to keep number of packets below a level at which performance falls off dramatically How to keep number of packets below level? Congestion is caused by too many sources trying to send data at too high a rate In IP networks, this typically results in routers dropping packets For TCP, lost packets (and larger delay) result in retransmissions Retransmission cause more congestion, and more packet losses, and more retransmissions, Congestion control aims to reduce the rate at which sources send ITS 413 - Transmission Control Protocol 10

Congestion Scenario 1 Two senders (and receivers); a router with infinite buffers Router outgoing link has capacity R Host A sends packets to router at rate λ in bytes per sec; so does Host B Router has infinite buffer space to store packets when input rate exceeds output rate λ out is throughput for a connection ITS 413 - Transmission Control Protocol 11

Congestion Scenario 1 Plot of throughput (λ out ) and delay for each connection While sending rate is less than output capacity at router, each connection achieves full sending rate in throughput When sending rate is greater than output capacity at router, each connection is limited to half of router output capacity However, as sending rate approaches output capacity, delay rises significantly (packets must wait in router buffer) ITS 413 - Transmission Control Protocol 12

Congestion Scenario 2 Two senders (and receivers); a router with finite buffers If buffer is full and new packets arrive, packets will be dropped/lost Lost packets leads to retransmissions by the source hosts λ in is the offered load: original sending rate + retransmission rate ITS 413 - Transmission Control Protocol 13

Congestion Scenario 2 Lets assume source retransmits only when a packet is known to be lost Offered load (λ in ): original sent + retransmissions If every second packet is lost (due to buffer at router being full): For every 2 original packets, 1 retransmitted packet; Offered load is 3 packets 2 packets successfully received at destination ITS 413 - Transmission Control Protocol 14

Congestion Scenario 2 Lets assume a sender times out too early and retransmits a packet even though the original packet was sent by the router to destination The output link from the router will be used to send the original and retransmitted packet But the retransmitted packet will be ignored (discarded) by the destination ITS 413 - Transmission Control Protocol 15

Congestion Scenario 3 ITS 413 - Transmission Control Protocol 16

Congestion Scenario 3 Throughput can go to 0 with large amount of traffic Network spends all the time sending unneeded/wasted packets ITS 413 - Transmission Control Protocol 17

Costs of Congestion Large queuing delays are experienced as the sending rate nears the output link capacity at a router Sender must perform retransmissions in order to compensate for dropped (lost) packets due to buffer overflow Router may send unneeded copies of packets if sender retransmits due to large delays (but not lost packets) With multiple routers in a path, if a packet is dropped by a router, all links leading up to that router have been wasted ITS 413 - Transmission Control Protocol 18

Approaches to Congestion Control

Approaches to Congestion Control End-to-end Congestion Control: Transport Layer Network layer provides no feedback on congestion in network End systems (source/destination hosts) infer congestion based on detected events such as packet loss and/or delay Network Assisted Congestion Control: Network Layer Network devices (mainly routers) provide explicit feedback to the source host about congestion Routers may provide direct feedback to source Feedback from routers may be provided via the destination host Feedback may be: Backpressure: router A tells previous router B to slow down; router B tells previous router C to slow down; and so on Explicit signalling: routers or destination host send special packets to source informing it of congestion and/or indicate the appropriate rate ITS 413 - Transmission Control Protocol 20

Network Assisted Congestion Control Feedback may come direct from routers, or via the destination (receiver) ATM is an example network technology using Network Assisted Congestion Control ITS 413 - Transmission Control Protocol 21

TCP Congestion Control

TCP Congestion Control TCP sender limits the rate at which it sends based on perceived network congestion How does TCP sender limit its sending rate? How does TCP sender perceive there is network congestion? How does TCP sender respond to congestion? TCP congestion control algorithm ITS 413 - Transmission Control Protocol 23

Limiting the TCP Sending Rate Amount of bytes TCP sender can send is limited by Advertised Window from Flow Control Outstanding Bytes Advertised Window In fact, TCP sender also maintains Congestion Window: Outstanding Bytes min (Advertised Window, Congestion Window) When an ACK is received, more bytes can be sent by TCP sender Assume the Advertised Window is very large (buffer at receiver is very large) Sending rate Congestion Window/RTT By adjusting the Congestion Window, TCP sender can adjust its sending rate ITS 413 - Transmission Control Protocol 24

Perceiving Network Congestion TCP sender assumes a loss indicates increased network congestion A loss: TCP sender times out: has not received ACK within timeout period TCP sender receives 3 duplicate ACKs Is this a valid assumption? Most packet losses occur at routers, i.e. congestion However, in some networks (e.g. wireless), packets may be lost due to link errors, not congestion TCP sender assumes arrival of ACKs indicates decreased network congestion The faster the arrival rate of ACKs, the large decrease in congestion assumed ITS 413 - Transmission Control Protocol 25

TCP Congestion Control Algorithm Three main components: 1. Additive Increase, Multiplicative Decrease (AIMD) 2. Slow tart (SS) 3. Reaction to Loss Events Terminology Maximum Segment Size (MSS): determined or assumed by TCP sender for network path; measured in bytes Congestion Window (cwnd): measured in bytes Round Trip Time (RTT): time from sending a segment, until corresponding ACK is received We will assume: TCP receiver sends an ACK for every segment received ITS 413 - Transmission Control Protocol 26

AIMD Additive Increase If no congestion detected, then TCP sender assumes there is available (unused) capacity in the network; hence increases its sending rate However, TCP slowly increases its sending rate TCP sender aims to increase Congestion Window by 1 x MSS every RTT One approach: For every new ACK received, increase Congestion Window (cwnd) by: cwnd new = cwnd old + MSS * MSS / cwnd old Additive Increase phase is also called Congestion Avoidance Multiplicative Decrease If congestion detected, then TCP sender decreases its sending rate TCP sender aims to half the Congestion Window for each loss For each loss detected: cwnd new = cwnd old /2 cwnd is not decreased to less than 1 MSS (This is not entirely accurate see Reaction to Loss Events) 27

AIMD Example Loss events (timeout or 3 duplicate ACKs) ITS 413 - Transmission Control Protocol 28

Slow Start Phase At start of a TCP connection, the TCP sender sends at a slow rate By default: cwnd = MSS E.g. approximate sending rate for MSS = 1000 bytes, RTT = 200ms is 40kb/s If large capacity is available for the connection, using additive increase (congestion avoidance) will be too slow Therefore Slow Start phase involves very fast increase of Congestion Window Cwnd is increased exponentially For every ACK received in Slow Start phase, increase cwnd by 1 MSS cwnd new = cwnd old + MSS Slow Start phase is continued until a loss event (then multiplicative decrease) or Congestion Window reaches a threshold (ssthresh) value (then additive increase) ITS 413 - Transmission Control Protocol 29

AIMD and Slow Start: Window Size 30000 Window [bytes] 25000 20000 15000 10000 Additive Increase/ Congestion Avoidance Advertised Window (awnd) Slow Start Threshold (ssthresh) Slow Start 5000 0 0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 Time [msec] MSS = 1000 B; RTT=100ms; ssthresh=16000 B; Advertised Window = 24000 B Window = min (Congestion Window, Advertised Window) ITS 413 - Transmission Control Protocol 30

AIMD and Slow Start: Sending Rate 2500 2000 Sending Rate [kb/s] 1500 1000 500 0 0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 Time [msec] Assumes Sending Rate = Window / RTT ITS 413 - Transmission Control Protocol 31

Reaction to Loss Events Upon a loss, Multiplicative Decrease halves the current congestion window The next action then depends on type of loss event: Loss detected by 3 rd Duplicate ACK Slow start threshold is halved ssthresh new = ssthresh old /2 Congestion window set to slow start threshold cwnd new = ssthresh TCP enters Additive Increase (or Congestion Avoidance) phase Loss detected by a timeout Slow start threshold is halved ssthresh new = ssthresh old /2 Congestion window set to initial value of 1 MSS cwnd new = MSS TCP enters Slow Start phase ITS 413 - Transmission Control Protocol 32

Reaction to Loss Events 25000 20000 Loss (3 rd Dup Ack) Loss (Timeout) Window [bytes] 15000 10000 5000 ssthresh 0 0 200 400 600 800 1000 1200 1400 1600 1800 2000 2200 2400 2600 Time [msec] ITS 413 - Transmission Control Protocol 33

Reaction to Loss Events Why? TCP assumes a loss indicates congestion in the network (and therefore slows down) Loss due to 3 rd Duplicate ACK Some TCP segments are being delivered (since some ACKs are coming back) TCP assumes small level of congestion, therefore immediately enters Congestion Avoidance phase Loss due to Timeout Most TCP segments were lost (since not even duplicate ACKs are received) TCP assumes heavy congestion, therefore go back to start (of Slow Start) with very slow sending rate ITS 413 - Transmission Control Protocol 34

TCP Congestion Control in Practice TCP Congestion Control algorithm works well in networks were losses are mainly due to congestion Note that with a congested network, the throughput of TCP connection can be severely limited In networks with losses due to errors on links, TCP Congestion Control has problems Example: a wireless link may lose segments due to poor link quality TCP slows down (thinking it is congestion) when it should maintain its sending rate Several variants of TCP have been developed specifically for wireless links In high-speed networks (>10Gb/s), TCP may perform poorly even with very few link packet losses ITS 413 - Transmission Control Protocol 35

TCP Versions and Options TCP RFC 793 (1981) Reliability (sequence numbers), Flow control (receiver window), Connection management TCP Tahoe (1988) Adds Slow Start, Congestion Avoidance, Fast Retransmit TCP Reno (1990) Adds Fast Recovery TCP NewReno (1995) Only halves congestion window once Other Options: Selective Acknowledgement (SACK) TCP Vegas Some Operating Systems implement their own options/variants ITS 413 - Transmission Control Protocol 36

TCP Fairness

Example: TCP Fairness ITS 413 - Transmission Control Protocol 38

Example: TCP Fairness ITS 413 - Transmission Control Protocol 39

TCP Fairness If TCP is fair, with N TCP connections using a R bps link Each TCP connection should achieve R/N bps Does TCP achieve fairness? In ideal conditions, yes. If all TCP connections have same RTT and same sized segments, with no other traffic, fairness is achieved In practice: If RTT of connections vary, connections with small RTT are able to higher proportion of bandwidth than connections with large RTT If other non-tcp data is also present (such as multimedia using UDP), then TCP connections receive unfair treatment Applications can use multiple TCP connections: each TCP connection gets fair treatment, but the application using multiple connections gets more bandwidth than application using single connection ITS 413 - Transmission Control Protocol 40

Example: TCP Fairness ITS 413 - Transmission Control Protocol 41

TCP and The Internet IP does not include any built-in congestion control mechanisms If every host sent IP datagrams as fast as possible, the Internet would not work The Internet relies on TCP mechanisms to avoid collapse TCP comprises about 90% of all traffic on the Internet As a means for congestion control, TCP has been very successful But If hosts/applications choose not to follow TCP s congestion control rules, then congestion can become a major problem in the Internet Challenges: Web browsers opening many TCP connections at once. Growth of multimedia applications that use UDP. Growth of P2P applications using multiple connections and/or UDP. ITS 413 - Transmission Control Protocol 42