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

Similar documents
Transport Layer and Data Center TCP

Transport Layer Protocols

Outline. TCP connection setup/data transfer Computer Networking. TCP Reliability. Congestion sources and collapse. Congestion control basics

Computer Networks. Chapter 5 Transport Protocols

TCP in Wireless Mobile Networks

TCP over Multi-hop Wireless Networks * Overview of Transmission Control Protocol / Internet Protocol (TCP/IP) Internet Protocol (IP)

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

Computer Networks UDP and TCP

15-441: Computer Networks Homework 2 Solution

Chapter 5. Transport layer protocols

COMP 3331/9331: Computer Networks and Applications. Lab Exercise 3: TCP and UDP (Solutions)

First Midterm for ECE374 03/09/12 Solution!!

La couche transport dans l'internet (la suite TCP/IP)

First Midterm for ECE374 03/24/11 Solution!!

TCP/IP Optimization for Wide Area Storage Networks. Dr. Joseph L White Juniper Networks

Computer Networks - CS132/EECS148 - Spring

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

Final for ECE374 05/06/13 Solution!!

SIP: Session Initiation Protocol

CSE331: Introduction to Networks and Security. Lecture 9 Fall 2006

Improving the Performance of TCP Using Window Adjustment Procedure and Bandwidth Estimation

A Survey on Congestion Control Mechanisms for Performance Improvement of TCP

CSE 473 Introduction to Computer Networks. Exam 2 Solutions. Your name: 10/31/2013

Lecture 15: Congestion Control. CSE 123: Computer Networks Stefan Savage

Lecture Objectives. Lecture 07 Mobile Networks: TCP in Wireless Networks. Agenda. TCP Flow Control. Flow Control Can Limit Throughput (1)

Higher Layer Protocols: UDP, TCP, ATM, MPLS

Data Communications & Networks. Session 6 Main Theme Reliable Data Transfer. Dr. Jean-Claude Franchitti

B-2 Analyzing TCP/IP Networks with Wireshark. Ray Tompkins Founder of Gearbit

Indian Institute of Technology Kharagpur. TCP/IP Part I. Prof Indranil Sengupta Computer Science and Engineering Indian Institute of Technology

TCP over Wireless Networks

[Prof. Rupesh G Vaishnav] Page 1

Computer Networks. Data Link Layer

Access Control: Firewalls (1)

Visualizations and Correlations in Troubleshooting

Transport Layer. Chapter 3.4. Think about

q Connection establishment (if connection-oriented) q Data transfer q Connection release (if conn-oriented) q Addressing the transport user

Midterm Exam CMPSCI 453: Computer Networks Fall 2011 Prof. Jim Kurose

Architecture and Performance of the Internet

Mobile Communications Chapter 9: Mobile Transport Layer

Ethernet. Ethernet. Network Devices

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

TCP and Wireless Networks Classical Approaches Optimizations TCP for 2.5G/3G Systems. Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme

IP - The Internet Protocol

Prefix AggregaNon. Company X and Company Y connect to the same ISP, and they are assigned the prefixes:

La couche transport dans l'internet (la suite TCP/IP)

Transport Protocols and Distributed Applications

Network Layer: Network Layer and IP Protocol

Simulation-Based Comparisons of Solutions for TCP Packet Reordering in Wireless Network

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

EITF25 Internet Techniques and Applications L5: Wide Area Networks (WAN) Stefan Höst

Transport layer protocols for ad hoc networks

Data Communication & Networks G

TCP/IP Networking for Wireless Systems. Integrated Communication Systems Group Ilmenau University of Technology

IP address format: Dotted decimal notation:

Data Networks Summer 2007 Homework #3

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

Chapter 3. TCP/IP Networks. 3.1 Internet Protocol version 4 (IPv4)

Chapter 6 Congestion Control and Resource Allocation

Congestions and Control Mechanisms n Wired and Wireless Networks

CMPE 150 Winter 2009

1. The subnet must prevent additional packets from entering the congested region until those already present can be processed.

Pig Laboratory. Additional documentation for the laboratory. Exercises and Rules. Tstat Data

TCP Flow Control. TCP Receiver Window. Sliding Window. Computer Networks. Lecture 30: Flow Control, Reliable Delivery

Chapter 11. User Datagram Protocol (UDP)

First Midterm for ECE374 02/25/15 Solution!!

TCP Adaptation for MPI on Long-and-Fat Networks

Stop And Wait. ACK received; transmit frame 2 CS 455 3

How do I get to

This sequence diagram was generated with EventStudio System Designer (

Transport Layer Services Mul9plexing/Demul9plexing. Transport Layer Services

Answer: that dprop equals dtrans. seconds. a) d prop. b) d trans

Networking part 3: the transport layer

Computer Networks Homework 1

TCP Westwood for Wireless

TCP for Wireless Networks

Parallel TCP Data Transfers: A Practical Model and its Application

Transport layer issues in ad hoc wireless networks Dmitrij Lagutin,

2 TCP-like Design. Answer

TCP/IP Over Lossy Links - TCP SACK without Congestion Control

Congestion Control Review Computer Networking. Resource Management Approaches. Traffic and Resource Management. What is congestion control?

PART III. OPS-based wide area networks

Analytic Models for the Latency and Steady-State Throughput of TCP Tahoe, Reno and SACK

SELECTIVE-TCP FOR WIRED/WIRELESS NETWORKS

Homework 2 assignment for ECE374 Posted: 02/21/14 Due: 02/28/14

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Networking Overview. (as usual, thanks to Dave Wagner and Vern Paxson)

Protocols and Architecture. Protocol Architecture.

Active Queue Management (AQM) based Internet Congestion Control

High Speed Internet Access Using Satellite-Based DVB Networks

A Survey: High Speed TCP Variants in Wireless Networks

Improved Digital Media Delivery with Telestream HyperLaunch

TCP in Wireless Networks

Introduction. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross

An enhanced TCP mechanism Fast-TCP in IP networks with wireless links

A packet-reordering solution to wireless losses in transmission control protocol

Internet Protocols. Background CHAPTER

Low-rate TCP-targeted Denial of Service Attack Defense

Sources: Chapter 6 from. Computer Networking: A Top-Down Approach Featuring the Internet, by Kurose and Ross

Voice over IP. Demonstration 1: VoIP Protocols. Network Environment

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Transcription:

Chapter 3: Transport Layer Our goals: understand d principles i learn about transport t behind transport layer protocols in the layer services: Internet: multiplexing/ demultiplexing reliable data transfer flow control congestion control UDP: connectionless transport, unreliable delivery of segments TCP: connection-oriented transport, reliable delivery of byte stream Transport Layer (SSL) 3-1 1

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt UDP 3.4 Principles of reliable data transfer (my slides for Section 3.4 do not follow Kurose & Ross) 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 (SSL) 3-2 2

Transport services and protocols provide logical communication between app processes on different hosts transport protocol runs in end systems (primarily) send side: breaks app messages into segments, passes to network layer rcv side: reassembles segments into messages, passes to app layer application transport network data link physical application transport network data link physical Transport Layer (SSL) 3-3 3

Internet transport-layer protocols unreliable, unordered datagram delivery by UDP no-frills extension of besteffort IP reliable, in-order byte delivery by TCP connection setup flow control congestion control services not available: delay guarantees bandwidth guarantees application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical application transport network data link physical Transport Layer (SSL) 3-4 4

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt 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 (SSL) 3-5 5

Multiplexing/demultiplexing Demultiplexing at rcv host: deliver received segments to correct sockets socket process/thread Multiplexing at send host: gather data from multiple sockets, encapsulate data with header (later used for demultiplexing) application P3 P1 P1 application P2 P4 application transport network link transport network link transport network link physical physical host 1 host 2 host 3 physical Transport Layer (SSL) 3-6 6

How demultiplexing works host receives IP datagrams 32 bits It uses IP addresses in layer- 3 header & port numbers in layer-4 header to direct segment to appropriate socket source port # dest port # other header fields application data (message) TCP/UDP segment format Transport Layer (SSL) 3-7 7

Connectionless onless demultiplexing UDP socket identified by two-tuple: (dest IP address, dest port number) When host receives UDP segment: directs UDP segment to socket with destination port number IP datagrams from different sources directed to same UDP socket Transport Layer (SSL) 3-8 8

Connection-oriented or ented demux Server has welcome and connection sockets welcome socket is identified by server s IP address and a port number TCP connection socket identified d by 4-tuple: source IP address source port number dest IP address dest port number Server may support many simultaneous TCP connection sockets with clients: each connection socket and the welcome socket have the same port number in server host receiving host uses all four values to direct segment to appropriate connection socket Transport Layer (SSL) 3-9 9

Connection-oriented demux (cont) P1 P4 P2 P1P3 SP: 5775 DP: 80 S-IP: B D-IP:C client IP: A SP: 9157 SP: 9157 DP: 80 DP: 80 server S-IP: A S-IP: B IP: C D-IP:C D-IP:C Client IP:B Transport Layer (SSL) 3-10 10

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt 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 (SSL) 3-11 11

UDP: User Datagram Protocol [RFC 768] best effort service, UDP segments (aka datagrams) may be: lost delivered out of order to appl connectionless: no handshaking ng between UDP sender, receiver each UDP segment handled independently of others Length, in bytes of UDP segment including header 32 bits source port # dest. port # length checksum Application data (message) UDP segment format Transport Layer (SSL) 3-12 12

UDP (more) suitable for interactive streaming multimedia applications loss tolerant min rate required other UDP uses, e.g. DNS SNMP DHCP reliable transfer over UDP? add reliability in application layer application-specific p error recovery Advantages of UDP no congestion control: UDP can blast away as fast as desired d small segment header no connection establishment (which can add delay) simple: no connection state at sender, receiver Transport Layer (SSL) 3-13 13

Internet checksum Sender: treat segment as a sequence of 16-bit i t integers (with checksum field initialized to zero) add integers using 1 s complement arithmetic and take 1 s complement of the sum put result as checksum value into UDP checksum field detail: pseudoheader consisting of protocol no., IP addresses, segment length field (again) included in checksum calculation Receiver: compute 1 s complement sum of received segment (checksum field included) check if computed sum equals sixteen 1 s: NO - error detected YES - no error detected But maybe errors nonetheless? More later. Transport Layer (SSL) 3-14 14

Internet Checksum Example Notes In ones complement arithmetic, a negative integer -x is represented as the complement of x,, i.e., each bit of x is inverted When adding numbers, a carryout from the most significant bit needs to be added to the result Example: add two 16-bit integers 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 wraparound sum checksum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 Transport Layer (SSL) 3-15 15

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt UDP 3.4 Principles of reliable data transfer (my slides do not follow Kurose & Ross) 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 (SSL) 3-16 16

Principles of Reliable data transfer important in application, transport, link layers top-10 list of important networking topics! Transport Layer (SSL) 3-17 17

Principles of Reliable data transfer important in app., transport, link layers top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Transport Layer (SSL) 3-18 18

Principles of Reliable data transfer important in app., transport, link layers top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Transport Layer (SSL) 3-19 19

Channel Abstractions Lossy FIFO channel delivers a subsequence in FIFO order example: delivery service provided by a physical link Lossy, reordering, duplicative i (LRD) channel example: delivery service provided d by IP or by UDP protocol Transport Layer (SSL) 3-20 20

Stop-and-wait ARQ (automatic repeat request) Error-free operation Sender Time Receiver ack ack Transport Layer (SSL) 3-21 21

Stop-and-wait ARQ Retransmission after timeout Recovery from loss of frame timeoutt retransmission Sender Error Time Receiver ack Transport Layer (SSL) 3-22 22

Stop-and-wait ARQ Retransmission i after timeout to recover from loss of ack Receiver gets duplicate frame Sequence number needed in frame Sender Receiver timeout Error retransmission Time Transport Layer (SSL) 3-23 23

Stop-and-wait ARQ Sequence number also needed d in ack timeout retransmission Sender thinks this is an ack for frame 1 Sender 0 0 1 0 Time Receiver ack ack Error Transport Layer (SSL) 3-24 24

Stop-and-wait ARQ Operation with 1-bit sequence numbers in frames and acks Discard timeout timeout Sender 0 0 1 1 ACK 0 ACK 0 Time Receiver Error Transport Layer (SSL) 3-25 25

Alternating-Bit Protocol Sender P1 (initial state = 1a) Receiver P2 (initial state = 1a) -D1 accept data 1a 1b +A1 -D0 +A0 +A1 timeout 4b 4a 2a 2b timeout -D1 +A0 3b Sender and Receiver specified by communicating finite-state machines Notation for arc labels -m send message m +m receive message m if it is waiting to be received 3a accept data 1b -A1 +D1 1a msgs in transit -A1 +D0 -D0 4b 2a deliver data deliver data 4a 2b +D1 -A0 +D0 3a 3b -A0 Protocol state space is infinite Transport Layer (SSL) 3-26 26

Alternating-Bit ng t Protocol (cont.) Assertion: If Sender and Receiver communicate via lossy FIFO channels, the alternating-bit protocol provides reliable in-order data delivery. Assumption: A frame is retransmitted infinitely many times if it is lost infinitely many times. Note: A real protocol is typically designed d to retransmit a fixed number of times (say k). Transport Layer (SSL) 3-27 27

Stop-and-wait ARQ performance analysis T f Sender 2τ + T A + T P Time Receiver ack T A τ T P τ Transport Layer (SSL) 3-28 28

P = probability transmission is unsuccessful b = Prob[success after i transmissions] for i = 1,2,... i i 1 bi = P P 1 (1 ) Average number of transmissions per frame i 1 Nf = ibi = i P P i= 1 i= 1 = (1 P) i= 1 i P i 1 (1 ) d i d = (1 P ) P = (1 P ) P dp dp i= 1 i= 0 d 1 1 = (1 P) = (1 P) dp 1 P (1 P) 1 = = N 1 P f 2 i Transport Layer (SSL) 3-29 29

Timeout duration T >2τ +T A +T P Each unsuccessful transmission uses T f + T Each successful transmission i uses T f + 2τ + T A + T P Average time per frame (N f 1)(T f +T) + (T f + 2τ + T A + T P ) Max. utilization (throughput) of stop-and-wait U = T f P ( T + T ) + T + 2τ + T + T 1 P f f A P Transport Layer (SSL) 3-30 30

Effect of propagation delay & transmission time Assume P = 0, T A = 0, T P = 0 Note: U τ = = T f = T f T f + 2τ 1 1 + 2τ T f = 1 1 + 2a (upper bound) distance propagation speed fram e length transm ission rate where a = τ T f Transport Layer (SSL) 3-31 31

Performance of AB protocol AB protocol works, but performance degrades for channels with large delay-bandwidth product example: 1 Gbps link, 15 ms prop. p delay, 1KByte packet T transmit = 8Kbits 10**9 bits/sec = 8 microsec U = 8 microsec 30008 microsec = 0.00027 the protocol limits use of available bandwidth Transport Layer (SSL) 3-32 32

Pipelined protocols Pipelining: i sender allows multiple, l in-flight, yet-tobe-acknowledged packets range of sequence numbers must be increased buffering at sender and/or receiver Pipelined protocols: (i) concurrent logical channels (used in ARPANET), ),(ii) sliding window protocol Transport Layer (SSL) 3-33 33

Sliding Window Protocol Consider an infinite array, Source, at the sender, and an infinite it array, Sink, at tthe receiver. P1 Sender Source: send window 0 1 2 a 1 a s 1 s acknowledged unacknowledged Sink: next expected received r + RW 1 P2 Receiver 0 1 2 r delivered receive window RW receive window size SW send window size (s - a SW) Transport Layer (SSL) 3-34 34

Sliding Windows in Action Data unit r has just been received by P2 Receive window slides forward P2 sends cumulative ack with sequence number it expects to receive next (r+3) P1 Sender Source: send window 0 1 2 a 1 a s 1 s acknowledged unacknowledged r+3 Sink: P2 0 1 2 r Receiver delivered next expected r + RW 1 receive window Transport Layer (SSL) 3-35 35

Sliding Windows in Action P1 has just received cumulative ack with r+3 as next expected sequence number Send window slides forward Source: send window P1 Sender 0 1 2 a 1 a s 1 s acknowledged P2 Receiver Sink: 0 1 2 r delivered next expected r + RW 1 receive window Transport Layer (SSL) 3-36 36

Sliding Window protocol Functions provided error control (reliable delivery) in-order delivery flow and congestion control (by varying send window size) TCP uses cumulative acks (needed for correctness) Other kinds of acks (to improve performance) selective nack selective ack (TCP SACK) bit-vector representing entire state of receive window (in addition to first sequence number of window) Transport Layer (SSL) 3-37 37

P1 Sender Sliding Windows for Lossy FIFO Channels A small number of bits in packet header for sequence number Necessary and sufficient condition for correct operation: SW + RW MaxSeqNum Necessity: Source: 0 1 2 a 1 a acknowledged send window unacknowledged RW receive window size SW send window size P2 Receiver Sink: 0 1 2 delivered next expected receive window Transport Layer (SSL) 3-38 38

Sliding Windows for Lossy FIFO Channels Sufficiency can only be demonstrated by using a formal method to prove that the protocol provides reliable in-order delivery. See Shankar and Lam, ACM TOPLAS, Vol. 14, No. 3, July 1992. Interesting special cases SW = RW = 1 alternating-bit protocol SW = 7, RW = 1 out-of-order arrivals not accepted, e.g., HDLC SW = RW Transport Layer (SSL) 3-39 39

Sliding Windows for LRD Channels Assumption: Packetshavebounded lifetime L Be careful how fast sequence numbers are consumed (i.e., by arrival of data to be sent into network) (send rate) L < MaxSeqNum TCP 32-bit sequence numbers counts bytes assumes that datagrams will be discarded by IP if too old Transport Layer (SSL) 3-40 40

Sliding Window Protocol Performance Analysis Go to slide 3-46 Assumptions ack transmission time is negligible, T A = 0 receiver processing time is negligible, g T P = 0 send window size is W T f T f time WT f 2τ ACK..... 2τ WT f... (a) WT f >2τ + T f (b) WT f <2τ + T f Transport Layer (SSL) 3-41 41

Performance for Error-Free Channels Maximum utilization U = 1 WT f > 2τ +T f WT f WT f 2τ +T f T f + 2τ Define a = τ/t f U = 1 W > 2a+ 1 W 1+ 2a W 2a+ 1 W=1 is special case of alternating-bit protocol Transport Layer (SSL) 3-42 42

Performance Analysis for Error- Prone Channels Define N f = Average number of transmissions per frame Maximum utilization U = 1 W > 2a+1 N f W/ N f 1+ 2a W 2a+1 To determine N f for two cases f f Selective repeat (optimistic performance) Go-back-N (pessimistic performance) Transport Layer (SSL) 3-43 43

Performance Analysis of Error-Prone Channels P = probability a transmission is unsuccessful Selective repeat (-> upper bound on U) N f = 1 1 P 1 P W> 2a+ 1 U = W(1 P) W 2a+ 1 1+ 2a Go-back-N (-> lowerboundonu) on Each lost frame requires the retransmission of N frames where 1 N W Transport Layer (SSL) 3-44 44

Go-back-N (cont.) With probability (1 P)P i, a frame requires 1+iN transmissions to succeed, for i=0,1,... N = (1 + in) (1 P) P f i= 0 i = (1 P ) P + NP(1 P ) i P i i= 0 i= 0 d = 1 + NP(1 P) P dp i = 0 d 1 = 1 + NP (1 P ) dp 1 P 1 = 1 + NP(1 P) (1 ) 2 P NP = 1 + 1 P i i 1 Transport Layer (SSL) 3-45 45

What is N? For WT > 2 τ + T f NT N N f f Go to slide 3-41 f f T + 1+ 2a Case (a) 2τ Go-back-N (cont.) From previous slide N f NP = 1+ 1 P (1 + 2 a) P 1 P + P + 2aP 1 + 2aP = 1 + 1 P = 1 P = 1 P For WT 2τ + T Case (b) f N = W N f f WP 1 P + WP = 1+ = 1 P 1 P Transport Layer (SSL) 3-46 46

Go-back-N (cont.) Recall (from slide 3-43) U = 1 W > 2a+1 N f W/ N f W 2a+1 1+ 2a From previous slide N N f f 1+ 2aP = 1 P 1 P + WP = 1 P Maximum utilization U 1 P W > 2a+ 1 1 + 2aP = W(1 P) W 2a+ 1 ( (1+ 2 a )(1 P+ WP) Transport Layer (SSL) 3-47 47

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt 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 (SSL) 3-48 48

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 connection-oriented handshaking initializes sender, receiver state before data exchange point-to-point two sender-receiver pairs bi-directional data flows in same connection MSS: maximum segment size less than MTU of directly connected network socket door application writes data TCP send buffer reliable, in-order byte steam service no message boundaries send and receive buffers pipelined send window size determined by TCP congestion and flow control segment application reads data TCP receive buffer Transport Layer (SSL) 3-49 socket door 49

TCP segment structure P1 P2 Send Receive Receive Send URG: urgent data (generally not used) ACK # count in valid 32-bit words 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 # sequence number head len acknowledgement number not used UAP R S F checksum Receive window Urg data pnter Options (variable length) application data (variable length) count by bytes of data (not segments) # bytes rcvr willing to accept Control info for both forward and reverse data transfers Transport Layer (SSL) 3-50 50

TCP seq. # s and ACKs Seq. # sequence number of first byte in segment s data ACK seq # of next byte expected from other side cumulative ACK Q: how receiver handles out-of-order segments? 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 (SSL) 3-51 51

TCP Round Trip Time and Timeout Q: how to set TCP timeout value? longer than RTT but RTT varies, may be too short or too long 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 Transport Layer (SSL) 3-52 52

TCP Round Trip Time and Timeout EstimatedRTT = (1- α)*estimatedrtt + α*samplertt Exponentially weighted moving average influence of past sample decreases exponentially fast typical value: α = 0.125 Transport Layer (SSL) 3-53 53

Example RTT estimation: RTT: gaia.cs.umass.edu to fantasia.eurecom.fr 350 300 T (milliseconds) RT 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 (SSL) 3-54 54

Setting the timeout interval 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 (SSL) 3-55 55

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt 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 (SSL) 3-56 56

TCP reliable data transfer TCP creates reliable service on top of IP s unreliable service Cumulative acks 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 Transport Layer (SSL) 3-57 57

Sliding Window Protocol At the sender, a will be pointed to by SendBase, and s by NextSeqNum P1 Sender Source: send window 0 1 2 a 1 a s 1 s acknowledged unacknowledged Sink: next expected received r+rw 1 P2 Receiver 0 1 2 r delivered d receive window RW receive window size SW send window size (s - a SW) Transport Layer (SSL) 3-58 58

NextSeqNum = InitialSeqNum SendBase = InitialSeqNum loop (forever) { switch(event) TCP sender event: data received from application above and send window has enough room create TCP segment with sequence number NextSeqNum if (timer currently not running) (simplified) start timer pass segment to IP NextSeqNum = NextSeqNum + length(data) event: timer timeout retransmit not-yet-acknowledged segment with smallest sequence number start timer Note: event: ACK received, with ACK field value = y y > SendBase if (y > SendBase) { SendBase = y means new data if (there are currently not-yet-acknowledged segments) ack ed start timer; else stop timer } } /* end of loop forever */ Transport Layer (SSL) 3-59 59

TCP: retransmission scenario (1) Host A Host B SendBase =92 tim meout X loss lost ACK scenario restart timer for seq= 92 SendBase = 100 Stop timer time Transport Layer (SSL) 3-60 60

TCP retransmission scenario (2) Host A Host B SendBase = 92 SendBase = 120 Stop timer Seq 92 tim meout X loss Cumulative ACK scenario time Transport Layer (SSL) 3-61 61

TCP: retransmission scenario (3) premature timeout scenario SendBase= 92 Host A Host B restart timer for seq= 100 restart timer for seq= 92 Sendbase = 100 SendBase = 120 Seq=9 92 timeout stop timer SendBase = 120 time What does Host A do here? Transport Layer (SSL) 3-62 62

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 l be many 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 Transport Layer (SSL) 3-63 63

Host A Host B X or 2 nd segm timeout fo ent time Resending a segment after triple duplicate ACK without waiting for timeout Transport Layer (SSL) 3-64 64

Fast retransmit algorithm: event: ACK received, with ACK field value = y if (y > SendBase) { SendBase = y if (there is a not-yet-acknowledged segment) start timer } else { increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) { resend segment with sequence number y reset timer for y } a duplicate ACK for fast retransmit already ACKed segment Transport Layer (SSL) 3-65 65

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt 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 (SSL) 3-66 66

TCP Flow Control flow control sender won t overrun receiver s buffers by transmitting too much, too fast receiver: explicitly informs sender of (dynamically y changing) amount of free buffer space RcvWindow field in TCP segment header sender: keeps amount of transmitted, unacked data less than most recently received RcvWindow value buffer at receive side of a TCP connection Transport Layer (SSL) 3-67 67

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt 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 (SSL) 3-68 68

TCP Connection Management Three way handshake initialize TCP variables seq. #s buffers, flow control info (e.g. RcvWindow) Step 1: client end system sends TCP SYN control segment to server - initial seq number chosen at random Step 2: server end system Active participant p Passive participant Step server end system (client) (server) receives SYN, replies with SYNACK control segment allocates buffers specifies server-to-receiver initial seq. # (chosen at random) Step 3: client end system replies with ack # (likely piggybacked in segment with app data) Transport Layer (SSL) 3-69 69

TCP Connection Management (cont.) Closing a connection: client closes socket Step 1: client end system sends TCP FIN control message to server close client server close Step 2: server receives FIN, replies with ACK. Later no more data to send. It closes connection, sends FIN. timed wait closed Transport Layer (SSL) 3-70 70

TCP Connection Management (cont.) Step 3: client receives FIN, replies with ACK and client server enters timed wait close will respond with ACK to a retransmitted FIN (due to loss of previous ACK) Step 4: server receives ACK. Its connection is closed. Step 5: client closes connection at the end of timed wait closing timed wait Note: protocol spec allows simultaneous FINs closed close closed Transport Layer (SSL) 3-71 71

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt 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 (SSL) 3-72 72

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

Causes/costs of congestion: scenario four senders multi-hop paths Timeout & retransmit Host A λ in Q: what happens as and increase at every sender? λ in : original data λ' in : original data plus retransmitted data finite shared output link buffers λ' in positive feedback instability Host B λ out Transport Layer (SSL) 3-74 74

Causes/costs of congestion: scenario Host A λ out Host B Cost of congestion when a packet is dropped, any upstream transmission capacity used for that packet was wasted behavior on right side of above graph called congestion collapse Transport Layer (SSL) 3-75 75

Approaches towards congestion control End-to-end congestion control: no explicit feedback from network congestion inferred from end-system s observed loss (or delay) approach taken by TCP Network-assisted congestion control: routers provide feedback to end systems single bit indicating congestion, e.g., SNA, DECbit, ATM TCP/IP explicit congestion notification (ECN) explicit sending rate for sender Transport Layer (SSL) 3-76 76

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing l i 3.3 Connectionless transport: rt 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 (SSL) 3-77 77

TCP Congestion Control end-to-end control (no network assistance) sender limits transmission: LastByteSent-LastByteAcked CongWin Roughly, the send buffer s throughput h CongWin RTT bytes/sec where CongWin is in bytes How does sender determine CongWin? loss event = timeout or 3 duplicate acks TCP sender reduces CongWin after loss event three mechanisms: slow start reduce to 1 segment after timeout event AIMD (additive i increase multiplicative decrease) Note: For now consider RcvWindow to be very large such that the send window size is equal lto CongWin. They are referred to as rwnd and cwnd, respectively, in the textbook. tb Transport Layer (SSL) 3-78 78

TCP Slow Start Probing for usable bandwidth When connection begins, CongWin =1MSS Example: MSS = 500 bytes & RTT = 200 msec initial rate = 2500 bytes/sec = 20 kbps available bandwidth may be >> MSS/RTT desirable to quickly ramp up to a higher rate Transport Layer (SSL) 3-79 79

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

Congestion avoidance state & responses to loss events Q: If no loss, when should 14 the exponential increase 12 switch to linear? A: When CongWin gets to 10 current value of 8 threshold 6 Implementation: For initial slow start, threshold h is set to a large value (e.g., 64 Kbytes) Subsequently, threshold is variable At a loss event, threshold is set to 1/2 of CongWin just before loss event size n window s egments) congestion (se 4 2 0 TCP Tahoe threshold 3 dup ACKs TCP Reno 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Transmission round Tahoe Reno Notes: 1. For simplicity, CongWin is in number of segments in the above graph. 2. Reno s window inflation and deflation steps (details) omitted Transport Layer (SSL) 3-81 81

Rationale for Reno s Fast Recovery After 3 dup ACKs: CongWin is cut in half (multiplicative decrease) 3 dup ACKs indicate g f network capable of delivering some segments timeout occurring before 3 dup ACKs is more alarming window then grows linearly (additive t increase) But after timeout event: CongWin is set to 1 MSS instead; window then grows exponentially to a threshold, then grows linearly Additive Increase Multiplicative Decrease (AIMD) Transport Layer (SSL) 3-82 82

TCP Reno (example scenario) CongWin Timeout 3 dupacks halved Initial slow start 3 dupacks during slow start before reaching initial threshold threshold reached t during slow start Transport Layer (SSL) 3-84 83

Summary: TCP Congestion Control (Reno) When CongWin is below Threshold, sender in slow-start phase, window grows exponentially (until loss event or exceeding threshold). When CongWin is above Threshold, senderisin 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 (SSL) 3-84 84

AIMD in steady state (when no timeout) additive increase: multiplicative decrease: increase CongWin by cut CongWin in half 1 MSS every RTT in after loss event (3 dup the absence of any acks) loss event: probing congestion window What limits the average 24 Kbytes window size (or throughput)? 16 Kbytes 8 Kbytes Long-lived TCP connection time Transport Layer (SSL) 3-85 85

TCP Throughput limited by loss rate TCP average throughput h t (approximate) of send buffer under AIMD in terms of loss rate, L: 1.22 MSS throughput = bytes/second RTT L where MSS is number of bytes per segment Example: 1500-byte segments, 100ms RTT, to get 10 Gbps throughput, loss rate needs to be very low L = 2 10-10 New version of TCP needed for high-speed applications Transport Layer (SSL) 3-86 86

Is TCP fair? Two competing sessions: Additive increase gives slope of 1, as window size increases multiplicative decrease reduces window size to half (proportionally) W equal window size loss: decrease window by factor of 2 congestion avoidance: additive increase loss: decrease window by factor of 2 congestion avoidance: additive increase Connection 1 window size W Transport Layer (SSL) 3-87 87

Is TCP fair? 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 AIMD only provides convergence to same window size, not necessarily same throughput rate Transport Layer (SSL) 3-88 88

No fairness in practice UDP Some multimedia apps use UDP instead of TCP Can tolerate packet loss, do not want rate throttled by congestion control send at constant rate Parallel TCP connections nothing prevents an app from opening parallel connections between 2 hosts. Web browsers do this Transport Layer (SSL) 3-89 89

Chapter 3: Summary principles behind transport layer services: multiplexing, demultiplexing reliable data transfer connection management 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 (SSL) 3-90 90