CC451 Computer Networks

Similar documents
Lecture 8. TCP/IP Transport Layer (2)

CNT 6885 Network Review on Transport Layer

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

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

Chapter 3- parte B outline

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

Transport Layer: outline

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

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

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

Chapter 3 Transport Layer

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

Chapter 3 Transport Layer

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

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

Transport Layer: Outline

Chapter 3 Transport Layer

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

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

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

Chapter 3 Transport Layer

CSE 4213: Computer Networks II

Chapter III: Transport Layer

CSC 8560 Computer Networks: TCP

10 minutes survey (anonymous)

Chapter 6 Transport Layer

Chapter 3 Transport Layer

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

Master Course Computer Networks IN2097

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

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

RSC Part III: Transport Layer 3. TCP

Application. Transport. Network. Link. Physical

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Computer Networking Introduction

CS Lecture 1 Review of Basic Protocols

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

Chapter 3 Transport Layer

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

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

Chapter III: Transport Layer

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

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

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

Flow and Congestion Control (Hosts)

CSC 401 Data and Computer Communications Networks

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

CSC 4900 Computer Networks: TCP

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

Chapter 3 Transport Layer

Chapter 3: Transport Layer. Chapter 3 Transport Layer. Chapter 3 outline. Transport services and protocols

CSCI Topics: Internet Programming Fall 2008

Chapter III: Transport Layer

Foundations of Telematics

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

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

CSC 4900 Computer Networks: TCP

Transmission Control Protocol

CSCD 330 Network Programming

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Master Course Computer Networks IN2097

Fall 2012: FCM 708 Bridge Foundation I

Computer Networking Introduction

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

Lecture 5. Transport Layer. Transport Layer 1-1

Chapter 3 Transport Layer

CSCD 330 Network Programming Winter 2015

CSCE 463/612 Networks and Distributed Processing Spring 2017

CSCI Topics: Internet Programming Fall 2008

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

Chapter 3 Transport Layer

Chapter 3: Transport Layer

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

Computer Networking: A Top Down Approach

LECTURE 3 - TRANSPORT LAYER

rdt3.0: channels with errors and loss

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

Transport Protocols and TCP

The Transport Layer: TCP & Reliable Data Transfer

Mid Term Exam Results

Computer Communication Networks Midterm Review

TCP : Fundamentals of Computer Networks Bill Nace

Chapter 3: Transport Layer. Chapter 3 Transport Layer. Transport layer. Position of transport layer. Transport layer.

Chapter 3 Transport Layer

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

Distributed Systems. 5. Transport Protocols

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

Distributed Systems. 5. Transport Protocols. Werner Nutt

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

Our goals: understand d principles. behind transport layer protocols in the. Internet: layer services:

Chapter 3: Transport Layer. Chapter 3 Transport Layer. Chapter 3 outline. Transport services and protocols

CSCI Topics: Internet Programming Fall 2008

Transport protocols. Transport Layer 3-1

Principles of congestion control

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

Chapter 3 Transport Layer

Transcription:

CC451 Computer Networks Lecture 6 Transport Layer (cont d) Transport Layer 3-1

Chapter 3 Transport Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we d like people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Computer Networking: A Top Down Approach 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007. Thanks and enjoy! JFK/KWR All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights Reserved Transport Layer 3-2

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 Transport Layer 3-3

Questions (Review) Explain how Stop-and-wait Automatic Repeat Request (ARQ) works? Sliding window techniques ARQ (i.e., Go-back-N and Selective-repeat) work? Discuss link utilization when using different ARQ techniques Which sliding window technique for flow/error control makes more efficient use of network bandwidth? Why? Transport Layer 3-4

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 socket door point-to-point: one sender, one receiver reliable, in-order byte steam: no message boundaries pipelined: TCP congestion and flow control set window size send & receive buffers application writes data TCP send buffer segment application reads data TCP receive buffer socket door 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 Transport Layer 3-5

TCP segment structure URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum (as in UDP) 32 bits source port # dest port # head len sequence number acknowledgement number not used U A P R S F checksum Receive window Urg data pnter Options (variable length) application data (variable length) counting by bytes of data (not segments!) # bytes rcvr willing to accept Transport Layer 3-6

TCP seq. # s and ACKs Seq. # s: ACKs: byte stream number of first byte in segment s data 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 User types C host ACKs receipt of echoed C Host A Host B simple telnet scenario host ACKs receipt of C, echoes back C time Transport Layer 3-7

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 too long: slow reaction to segment loss 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 Set timeout = average + safe margin Transport Layer 3-8

RTT (milliseconds) TCP Round Trip Time and Timeout EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT Exponential weighted moving average influence of past sample decreases exponentially fast typical value: = 0.125 RTT: gaia.cs.umass.edu to fantasia.eurecom.fr 350 300 250 200 150 100 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) SampleRTT Estimated RTT Transport Layer 3-9

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: DevRTT = (1- )*DevRTT + * SampleRTT-EstimatedRTT (typically, = 0.25) Then set timeout interval: TimeoutInterval = EstimatedRTT + 4*DevRTT Transport Layer 3-10

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 Transport Layer 3-11

TCP reliable data transfer TCP creates rdt service on top of IP s unreliable service Pipelined segments Cumulative ACKs TCP uses single retransmission timer Retransmissions are triggered by: timeout events duplicate ACKs Transport Layer 3-12

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 Transport Layer 3-13

Seq=92 timeout timeout Seq=92 timeout TCP: retransmission scenarios Host A Host B Host A Host B X loss Sendbase = 100 SendBase = 120 SendBase = 100 time lost ACK scenario SendBase = 120 time premature timeout Transport Layer 3-14

timeout TCP retransmission scenarios (more) Host A Host B X loss SendBase = 120 time Cumulative ACK scenario Transport Layer 3-15

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

timeout Host A Host B X Packets time Resending a segment after triple duplicate ACK 1 2 3 4 5 2 Acknowledgements (waiting seq#) 2 2 2 2 Transport Layer 3-17

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 Transport Layer 3-18

TCP Flow Control receive side of TCP connection has a receive buffer: flow control sender won t overflow receiver s buffer by transmitting too much, too fast app process may be slow at reading from buffer speed-matching service: matching the send rate to the receiving app s drain rate Transport Layer 3-19

TCP Flow control: how it works (Suppose TCP receiver discards out-of-order segments) spare room in buffer = RcvWindow = RcvBuffer-[LastByteRcvd - LastByteRead] Rcvr advertises spare room by including value of RcvWindow in segments Sender limits unacked data to RcvWindow guarantees receive buffer doesn t overflow Transport Layer 3-20

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 Transport Layer 3-21

TCP Connection Management Recall: TCP sender, receiver establish connection before exchanging data segments initialize TCP variables: seq. #s buffers, flow control info (e.g. RcvWindow) client: connection initiator Socket clientsocket = new Socket("hostname","port number"); server: contacted by client Socket connectionsocket = welcomesocket.accept(); Three way handshake: Step 1: client host sends TCP SYN segment to server specifies initial seq # no data Step 2: server host receives SYN, replies with SYNACK segment server allocates buffers specifies server initial seq. # Step 3: client receives SYNACK, replies with ACK segment, which may contain data Transport Layer 3-22

timed wait TCP Connection Management (cont.) Closing a connection: client closes socket: clientsocket.close(); close client server Step 1: client end system sends TCP FIN control segment to server close Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN. closed Transport Layer 3-23

timed wait TCP Connection Management (cont.) Step 3: client receives FIN, replies with ACK. Enters timed wait - will respond with ACK to received FINs closing client server closing Step 4: server, receives ACK. Connection closed. Note: with small modification, can handle simultaneous FINs. closed closed Transport Layer 3-24

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 Transport Layer 3-25

Principles of Congestion Control Congestion: informally: too many sources sending too much data too fast for network to handle different from flow control! manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) highly important problem! Transport Layer 3-26

Causes/costs of congestion: scenario 1 two senders, two receivers Host A l in : original data l out one router, infinite buffers Host B unlimited shared output link buffers no retransmission large delays when congested maximum achievable throughput Transport Layer 3-27

Causes/costs of congestion: scenario 2 one router, finite buffers sender retransmission of lost packet Host A l in : original data l' in : original data, plus retransmitted data l out Host B finite shared output link buffers Transport Layer 3-28

Causes/costs of congestion: scenario 2 always: l = l (goodput) in out perfect retransmission only when loss: l > l in out retransmission of delayed (not lost) packet makes l in (than perfect case) for same l out larger R/2 R/2 R/2 R/3 l out l out l out R/4 l in R/2 l in R/2 l in R/2 a. b. c. costs of congestion: more work (retrans) for given goodput unneeded retransmissions: link carries multiple copies of pkt Transport Layer 3-29

Causes/costs of congestion: scenario 3 four senders multihop paths timeout/retransmit Q: what happens as l in and increase? l in Host A l in : original data l' in : original data, plus retransmitted data finite shared output link buffers l out Host B Transport Layer 3-30

Causes/costs of congestion: scenario 3 H o s t A l o u t H o s t B Another cost of congestion: when packet dropped, any upstream transmission capacity used for that packet was wasted! Transport Layer 3-31

Approaches towards congestion control Two broad approaches towards congestion control: End-end congestion control: no explicit feedback from network congestion inferred from end-system observed loss, delay approach taken by TCP Network-assisted congestion control: routers provide feedback to end systems single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM) explicit rate sender should send at Transport Layer 3-32

Goals of congestion control Throughput: Maximize goodput (i.e., data delivery) the total number of bits end-end Fairness: Give different sessions equal share. Max-min fairness Maximize the minimum rate session. Single link: Capacity R sessions m Each sessions: R/m Transport Layer 3-33

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 Transport Layer 3-34

TCP Congestion Control: details sender limits transmission: LastByteSent-LastByteAcked Roughly, rate = CongWin RTT CongWin Bytes/sec CongWin is dynamic, function of perceived network congestion How does sender perceive congestion? loss event = timeout or 3 duplicate ACKs TCP sender reduces rate (CongWin) after loss event three mechanisms: AIMD slow start conservative after timeout events Transport Layer 3-35

congestion window size TCP congestion control: additive increase, multiplicative decrease (AIMD) Approach: increase transmission rate (window size), probing for usable bandwidth, until loss occurs additive increase: increase CongWin by 1 MSS every RTT until loss detected multiplicative decrease: cut CongWin in half after loss 24 Kbytes congestion window Saw tooth behavior: probing for bandwidth 16 Kbytes 8 Kbytes time time Transport Layer 3-36

TCP Slow Start What is the goal? getting to equilibrium gradually but quickly Implements the multiplicative increase (MI) algorithm When connection begins, increase rate exponentially fast until network congested (i.e., first loss event) When connection begins, CongWin = 1 MSS Example: MSS = 500 bytes & RTT = 200 msec initial rate = 20 kbps Available bandwidth may be >> MSS/RTT desirable to quickly ramp up to respectable rate Transport Layer 3-37

RTT TCP Slow Start (more) When connection begins, increase rate exponentially until first loss event: double CongWin every RTT Host A Host B done by incrementing CongWin for every ACK received Summary: initial rate is slow but ramps up exponentially fast time Transport Layer 3-38

Refinement: inferring loss After 3 dup ACKs: CongWin is cut in half window then grows linearly But after timeout event: CongWin instead set to 1 MSS; window then grows exponentially to a threshold, then grows linearly Philosophy: 3 dup ACKs indicates network capable of delivering some segments timeout indicates a more alarming congestion scenario Transport Layer 3-39

Refinement Q: When should the exponential increase switch to linear? A: When CongWin gets to 1/2 of its value before timeout. Implementation: Variable Threshold At loss event, Threshold is set to 1/2 of CongWin just before loss event Transport Layer 3-40

Summary: TCP Congestion Control When CongWin is below Threshold, sender in slow-start phase, window grows exponentially. When CongWin is above Threshold, sender is in congestion-avoidance phase, window grows linearly. When a triple duplicate ACK occurs, Threshold set to CongWin/2 and CongWin set to Threshold. When timeout occurs, Threshold set to CongWin/2 and CongWin is set to 1 MSS. Transport Layer 3-41

TCP throughput What s the average throughout of TCP as a function of window size of maximum segment size (MSS) in bytes and RTT? Ignore slow start Let w be the window size when loss occurs. When window is w of MSS, throughput is throughput = w MSS RTT Bytes/sec Just after loss, window drops to W/2, throughput to (w MSS)/2RTT. Average throughout: 0.75(w MSS)/RTT Transport Layer 3-42

Example Client receives 1500 byte segments from a web server knowing the average RTT equals 100ms and data throughput is 10 Gbps Calculate the required window size. How long does it take to receive an object from a Web server after sending a request? Answer: Required window size W = RTT throughput / MSS = 83,333 segments The total time (T) will include: TCP connection establishment data transfer delay T = RTT + MSS/throughput RTT = 100ms Transport Layer 3-43

TCP Fairness Fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K TCP connection 1 TCP connection 2 bottleneck router capacity R Transport Layer 3-44

Why is TCP fair? Two competing sessions: Additive increase gives slope of 1, as throughout increases multiplicative decrease decreases throughput proportionally R equal bandwidth share loss: decrease window by factor of 2 congestion avoidance: additive increase loss: decrease window by factor of 2 congestion avoidance: additive increase Connection 1 throughput R Transport Layer 3-45

Fairness (more) Fairness and UDP Multimedia apps often do not use TCP do not want rate throttled by congestion control Instead use UDP: pump audio/video at constant rate, tolerate packet loss Fairness and parallel TCP connections nothing prevents app from opening parallel connections between 2 hosts. Web browsers do this Transport Layer 3-46

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