CSC 8560 Computer Networks: TCP

Similar documents
CSC 4900 Computer Networks: TCP

CSC 4900 Computer Networks: TCP

Chapter 3- parte B outline

Chapter 3 Transport Layer

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

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

Lecture 8. TCP/IP Transport Layer (2)

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

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

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

CC451 Computer Networks

Chapter III: Transport Layer

Chapter 3 Transport Layer

Chapter III: Transport Layer

Chapter 3 Transport Layer

CNT 6885 Network Review on Transport Layer

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

Computer Networking: A Top Down Approach

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

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

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

Chapter 3 Transport Layer

LECTURE 3 - TRANSPORT LAYER

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

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

Computer Networking Introduction

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

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

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

Chapter 3 Transport Layer

10 minutes survey (anonymous)

rdt3.0: channels with errors and loss

Transport Layer: outline

Chapter III: Transport Layer

Computer Networking Introduction

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

CSC 401 Data and Computer Communications Networks

Fall 2012: FCM 708 Bridge Foundation I

Principles of congestion control

Chapter 3 Transport Layer

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

Transport Layer: Outline

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

CSC 401 Data and Computer Communications Networks

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

CSE 4213: Computer Networks II

CSCI Topics: Internet Programming Fall 2008

Chapter 3 Transport Layer

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

Mid Term Exam Results

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

Chapter 3 Transport Layer

Computer Communication Networks Midterm Review

Detecting half-open connections. Observed TCP problems

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

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

CSC358 Week 5. Adapted from slides by J.F. Kurose and K. W. Ross. All material copyright J.F Kurose and K.W. Ross, All Rights Reserved

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

CSCE 463/612 Networks and Distributed Processing Spring 2017

Application. Transport. Network. Link. Physical

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

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

Master Course Computer Networks IN2097

CSCD 330 Network Programming

Chapter 3 Transport Layer

CS321: Computer Networks Congestion Control in TCP

Chapter 3 Transport Layer

Lecture 15: Transport Layer Congestion Control

Chapter 6 Transport Layer

RSC Part III: Transport Layer 3. TCP

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

Flow and Congestion Control (Hosts)

Chapter 3 Transport Layer

Lecture 5. Transport Layer. Transport Layer 1-1

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

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

Master Course Computer Networks IN2097

Lecture 12: Transport Layer TCP again

CSCI Topics: Internet Programming Fall 2008

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

CSCI Topics: Internet Programming Fall 2008

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

Transport Protocols and TCP

Chapter 3 Transport Layer

Pipelined protocols: overview

internet technologies and standards

internet technologies and standards

Chapter 3 Transport Layer

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

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

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

CSCD 330 Network Programming Winter 2015

Chapter 3 Transport Layer

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

Transmission Control Protocol

Transmission Control Protocol. ITS 413 Internet Technologies and Applications

CS Lecture 1 Review of Basic Protocols

Transport protocols. Transport Layer 3-1

Chapter 3 Transport Layer

Transcription:

CSC 8560 Computer Networks: TCP Professor Henry Carter Fall 2017

Project 2: mymusic You will be building an application that allows you to synchronize your music across machines. The details of which are on the course website. You must work as a pair. You will both receive the same grade, so work hard. Make sure your design is extensible. Future projects will possibly build on this infrastructure. 2

Last Time Discussed a variety of algorithms that can give us guarantees of reliable delivery. What were they? How do they differ? Finite State Machines (FSMs) are a powerful means of representing protocols. 3

Review: Go-Back-N vs Selective Repeat 4

Review: Selective repeat: dilemma Example: seq # s: 0, 1, 2, 3 window size=3 receiver sees no difference in two scenarios! incorrectly passes duplicate data as new in (a) Q: what relationship between seq # size and window size? 5

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control 6

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 point-to-point: one sender, one receiver reliable, in-order byte steam: no message boundaries pipelined: TCP congestion and flow control set window size full duplex data: bi-directional data flow in same connection MSS: maximum segment size connection-oriented: handshaking (exchange of control msgs) init s sender, receiver state before data exchange flow controlled: sender will not overwhelm receiver 7

TCP segment structure 8

TCP seq. # s and ACKs Seq. # s: byte stream number of first byte in segment s data ACKs: seq # of next byte expected from other side cumulative ACK Q: how receiver handles out-of-order segments A: TCP spec doesn t say, - up to implementor 9

TCP Sequence Numbers, Acks 10

TCP Round Trip Time and Timeout Q: how to set TCP timeout value? longer than RTT but RTT varies too short: premature timeout unnecessary retransmissions Q: how to estimate RTT? SampleRTT: measured time from segment transmission until ACK receipt ignore retransmissions SampleRTT will vary, want estimated RTT smoother average several recent measurements, not just current SampleRTT too long: slow reaction to segment loss 11

TCP Round Trip Time and Timeout EstimatedRTT = (1- a)*estimatedrtt + a*samplertt Exponential weighted moving average influence of past sample decreases exponentially fast typical value: α = 0.125 12

Example RTT estimation: 13

TCP Round Trip Time and Timeout Setting the timeout EstimtedRTT plus safety margin large variation in EstimatedRTT -> larger safety margin first estimate of how much SampleRTT deviates from EstimatedRTT: Then set timeout interval: DevRTT = (1-b)*DevRTT + b* SampleRTT-EstimatedRTT (typically, b = 0.25) TimeoutInterval = EstimatedRTT + 4*DevRTT 14

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control 15

TCP reliable data transfer TCP creates rdt service on top of IP s unreliable service Pipelined segments Cumulative acks Single retransmission timer TCP uses single retransmission timer Retransmissions are triggered by: timeout events duplicate acks Initially consider simplified TCP sender: ignore duplicate acks ignore flow control, congestion control 16

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

TCP sender (simplified) 18

TCP: retransmission scenarios 19

TCP retransmission scenarios (more) 20

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 ACKed Arrival of in-order segment with expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. #. Gap detected TCP Receiver action Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq. # of next expected byte Arrival of segment that partially or completely fills gap Immediate send ACK, provided that segment starts at lower end of gap 21

Fast Retransmit Time-out period often relatively long: long delay before resending lost packet Detect lost segments via duplicate ACKs. If sender receives 3 duplicate ACKs for the same data, it supposes that segment after ACKed data was lost: fast retransmit: resend segment before timer expires Sender often sends many segments back-to-back If segment is lost, there will likely be many duplicate ACKs. 22

Fast Retransmit 23

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control 24

TCP Flow Control flow control receiver controls sender, so sender won t overflow receiver s buffer by transmitting too much, too fast 25

TCP Flow control: how it works Receiver advertises free buffer space by including rwnd value in TCP header of receiver-to-sender segments RcvBuffer size set via socket options (typical default is 4096 bytes) many operating systems autoadjust RcvBuffer sender limits amount of unacked ( inflight ) data to receiver s rwnd value guarantees receive buffer will not overflow 26

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control 27

TCP Connection Management Before exchanging data, sender/receiver handshake : agree to establish connection (each knowing the other willing to establish connection) agree on connection parameters 28

Agreeing to Establish a Connection Q: Will 2-way handshake always work in network? variable delays retransmitted messages (e.g. req_conn(x)) due to message loss message reordering can t see other side 29

Agreeing to Establish a Connection 30

TCP 3-Way Handshake 31

TCP 3-Way Handshake: FSM 32

TCP: Closing a Connection Client, Server each close their side of the connection Send TCP segment with FIN bit = 1 Respond to received FIN with FIN, ACK 33

TCP Connection Management (cont.) 34

SYN Flooding Classic Internet attack sends a huge number of SYN packets to a host, but never responds with the third handshake message. In so doing, an adversary forces a receiver to dedicate a huge amount of resources to bogus requests. And therefore makes those resources unavailable to legitimate users. There are ways to prevent this (SYN Cookies), but a surprising number of systems are still vulnerable. 35

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control 36

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

Causes/costs of congestion: Scenario 1 two senders, two receivers output link capacity: R no retransmission one router, infinite buffers 38

Causes/costs of congestion: Scenario 2 one router, finite buffers sender retransmission of timed-out packet application-layer input = application-layer output: λin = λout transport-layer input includes retransmissions: λin λin 39

Causes/costs of congestion: Scenario 2 Idealization: perfect knowledge sender sends only when router buffers available 40

Causes/costs of congestion: Scenario 2 Idealization: known loss packets can be lost, dropped at router due to full buffers sender only resends if packet known to be lost 41

Causes/costs of congestion: Scenario 2 Realistic: duplicates packets can be lost, dropped at router due to full buffers sender times out prematurely, sending two copies, both of which are delivered 42

Causes/costs of congestion: Scenario 2 Realistic: duplicates packets can be lost, dropped at router due to full buffers sender times out prematurely, sending two copies, both of which are delivered Costs of congestion: more work (retrans) for given goodput unneeded retransmissions: link carries multiple copies of pkt decreasing goodput 43

Causes/costs of congestion: Scenario 3 Scenario: four senders, multihop paths, timeout/retransmit Q: What happens as λin and λin increase? A: as red λin increases, all arriving blue pkts at upper queue are dropped, blue throughput 0 44

Causes/costs of congestion: Scenario 3 Another cost of congestion: when packet dropped, any upstream transmission capacity used for that packet was wasted! 45

Approaches towards congestion control two broad approaches towards congestion control: Network-Assisted congestion control routers provide feedback to end systems single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM) explicit rate for sender to send at End-end congestion control no explicit feedback from network congestion inferred from endsystem observed loss, delay approach taken by TCP 46

Case study: ATM ABR congestion control ABR: available bit rate: elastic service if sender s path underloaded : sender should use available bandwidth if sender s path congested: sender throttled to minimum guaranteed rate RM (resource management) cells: sent by sender, interspersed with data cells bits in RM cell set by switches ( networkassisted ) NI bit: no increase in rate (mild congestion) CI bit: congestion indication RM cells returned to sender by receiver, with bits intact 47

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

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control 49

TCP Congestion Control Additive Increase, Multiplicative Decrease (AIMD) approach: sender increases transmission rate (window size), probing for usable bandwidth, until loss occurs additive increase: increase cwnd by 1 MSS every RTT until loss detected multiplicative decrease: cut cwnd in half after loss 50

TCP Congestion Control: Details sender limits transmission: cwnd is dynamic, function of perceived network congestion TCP sending rate: roughly: send cwnd bytes, wait RTT for ACKS, send more bytes 51

TCP Slow Start When connection begins, increase rate exponentially until first loss event: initially cwnd = 1 MSS double cwnd every RTT done by incrementing cwnd for every ACK received Summary: initial rate is slow but ramps up exponentially fast 52

TCP: detecting, reacting to loss loss indicated by timeout: cwnd set to 1 MSS; window then grows exponentially (as in slow start) to threshold, then grows linearly loss indicated by 3 duplicate ACKs: TCP RENO dup ACKs indicate network capable of delivering some segments cwnd is cut in half window then grows linearly TCP Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks) 53

TCP: Switching from Slow Start to CA Q: when should the exponential increase switch to linear? A: when cwnd gets to 1/2 of its value before timeout Implementation variable ssthresh on loss event, ssthresh is set to 1/2 of cwnd just before loss event 54

Summary: TCP Congestion Control 55

TCP throughput avg. TCP throughput as function of window size, RTT? ignore slow start, assume always data to send W: window size (measured in bytes) where loss occurs avg. window size (# in-flight bytes) is ¾ W avg. thruput is 3/4W per RTT 56

Fine... but WHY? This saw-toothed pattern is normal TCP behavior. Is that good or bad? Are there lost opportunities? 57

TCP Futures: TCP over long, fat pipes example: 1500 byte segments, 100ms RTT, want 10 Gbps throughput requires W = 83,333 in-flight segments throughput in terms of segment loss probability, L [Mathis 1997]: to achieve 10 Gbps throughput, need a loss rate of L = 2 10-10 a very small loss rate! new versions of TCP for high-speed 58

TCP Fairness Fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K 59

Why is TCP fair? two competing sessions: additive increase gives slope of 1, as throughout increases multiplicative decrease decreases throughput proportionally 60

Fairness (more) Fairness and UDP multimedia apps often do not use TCP do not want rate throttled by congestion control instead use UDP: send audio/video at constant rate, tolerate packet loss Fairness, parallel TCP connections application can open multiple parallel connections web browsers do this e.g., link of rate R with 9 existing connections: new app asks for 1 TCP, gets rate R/10 new app asks for 11 TCPs, gets > R/2 61

Chapter 3: Summary principles behind transport layer services: multiplexing, demultiplexing reliable data transfer flow control congestion control instantiation, implementation in the Internet UDP TCP Next: leaving the network edge (application, transport layers) into the network core 62

Next Time... Textbook Chapter 4.1-4.4 Remember, you need to read it BEFORE you come to class! Homework: Project #2 assigned! Both Project #2 and HW #2 due after fall break 63