Download presentation
Presentation is loading. Please wait.
Published byDwight Lamb Modified over 9 years ago
1
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009. All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved
2
Transport Layer 3-2 Internet transport-layer protocols r reliable, in-order delivery (TCP) r unreliable, unordered delivery: UDP m no-frills extension of “best-effort” IP r services not available: m delay guarantees m 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
3
Transport Layer 3-3 UDP: User Datagram Protocol [RFC 768] r “no frills,” “bare bones” transport protocol r “_____________” service, UDP segments may be: m _____________ r connectionless: m _________________ m each UDP segment handled independently of others Why is there a UDP?
4
Transport Layer 3-4 UDP: more r often used for streaming multimedia apps m loss tolerant m rate sensitive r other UDP uses m _____________ r Is reliable transfer over UDP possible? source port #dest port # 32 bits Application data (message) UDP segment format length checksum
5
Transport Layer 3-5 UDP checksum Sender: r treat segment contents as sequence of 16-bit integers r checksum: addition (1’s complement sum) of segment contents r sender puts checksum value into UDP checksum field Receiver: r Add all 16-bit integers in segment m 1111111111111111 - no error detected. m Otherwise - error detected Goal: detect “errors” (e.g., flipped bits) in transmitted segment
6
Transport Layer 3-6 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection m MSS: maximum segment size r connection-oriented: m handshaking (exchange of control msgs) init’s sender, receiver state before data exchange r flow controlled: m sender will not overwhelm receiver r point-to-point: m one sender, one receiver r reliable, in-order byte steam: m no “message boundaries” r pipelined: m TCP congestion and flow control set window size r send & receive buffers
7
Transport Layer 3-7 TCP segment structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement number Receive window Urg data pointer checksum F SR PAU head len not used Options (variable length)
8
Transport Layer 3-8 TCP seq. #’s and ACKs Seq. #’s: m byte stream “number” of first byte in segment’s data ACKs: m seq # of next byte expected from other side m cumulative ACK Q: how receiver handles out-of-order segments m A: TCP spec doesn’t say, - up to implementer Host A Host B Seq=42, ACK=79, data = ‘C’ Seq=_____, ACK=_____, data = ‘C’ Seq=43, ACK=80 User types ‘C’ host ACKs receipt of echoed ‘C’ host ACKs receipt of ‘C’, echoes back ‘C’ time simple telnet scenario
9
Transport Layer 3-9 TCP Round Trip Time and Timeout Q: how to set TCP timeout value? r longer than RTT m but RTT varies r too short m r too long m Q: how to estimate RTT? SampleRTT : measured time from segment transmission until ACK receipt m ignore retransmissions (why?) SampleRTT will vary, want estimated RTT “smoother” average several recent measurements, not just current SampleRTT
10
Transport Layer 3-10 TCP Round Trip Time and Timeout EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT r Exponential weighted moving average r influence of past sample decreases exponentially fast typical value: = 0.125
11
Transport Layer 3-11 Example RTT estimation:
12
Transport Layer 3-12 TCP Round Trip Time and Timeout Setting the timeout EstimtedRTT plus “safety margin” large variation in EstimatedRTT -> larger safety margin r first estimate of how much SampleRTT deviates from EstimatedRTT: TimeoutInterval = EstimatedRTT + 4*DevRTT DevRTT = (1- )*DevRTT + *|SampleRTT-EstimatedRTT| (typically, = 0.25) Then set timeout interval:
13
Transport Layer 3-13 TCP reliable data transfer r TCP creates rdt service on top of IP’s unreliable service r pipelined segments r cumulative ACKs r TCP uses single retransmission timer r retransmissions are triggered by: m timeout events m duplicate ACKs r initially consider simplified TCP sender: m ignore duplicate ACKs m ignore flow control, congestion control
14
Transport Layer 3-14 TCP sender events: data rcvd from app: r ________________ ________________ expiration interval: TimeOutInterval timeout: r ______________ r _______________ ACK rcvd: r if acknowledges previously unACKed segments m update what is known to be ACKed m start timer if there are outstanding segments
15
Transport Layer 3-15 Fast Retransmit r time-out period often relatively long: m long delay before resending lost packet r detect lost segments via duplicate ACKs. m sender often sends many segments back-to- back m if segment is lost, there will likely be many duplicate ACKs for that segment r If sender receives 3 ACKs for same data, it assumes that segment after ACKed data was lost: m fast retransmit: resend segment before timer expires
16
Transport Layer 3-16 Host A timeout Host B time X resend seq X2 seq # x1 seq # x2 seq # x3 seq # x4 seq # x5 ACK x1 triple duplicate ACKs
17
Transport Layer 3-17 TCP Flow Control r receive side of TCP connection has a receive buffer: r speed-matching service: matching send rate to receiving application’s drain rate r app process may be slow at reading from buffer sender won’t overflow receiver’s buffer by transmitting too much, too fast flow control IP datagrams TCP data (in buffer) (currently) unused buffer space application process
18
Transport Layer 3-18 TCP Flow control: how it works (suppose TCP receiver discards out-of-order segments) unused buffer space: = rwnd = RcvBuffer-[LastByteRcvd - LastByteRead] receiver: advertises unused buffer space by including rwnd value in segment header sender: limits # of unACKed bytes to rwnd m guarantees receiver’s buffer doesn’t overflow IP datagrams TCP data (in buffer) (currently) unused buffer space application process rwnd RcvBuffer
19
Transport Layer 3-19 TCP congestion control: r goal: TCP sender should transmit as fast as possible, but without congesting network m Q: how to find rate just below congestion level r decentralized: each TCP sender sets its own rate, based on implicit feedback: m ACK: _____________________________ m lost segment: _________________________
20
Transport Layer 3-20 Principles of Congestion Control Congestion: r informally: “too many sources sending too much data too fast for network to handle” r different from flow control! r manifestations: m lost packets (buffer overflow at routers) m long delays (queueing in router buffers) r a top-10 problem!
21
Transport Layer 3-21 Approaches towards congestion control end-end congestion control: r no explicit feedback from network r congestion inferred from end-system observed loss, delay r approach taken by TCP network-assisted congestion control: r routers provide feedback to end systems m single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM) m explicit rate sender should send at two broad approaches towards congestion control:
22
Transport Layer 3-22 TCP Congestion Control: more details segment loss event: reducing cwnd r timeout: no response from receiver m ________________ r 3 duplicate ACKs: at least some segments getting through (recall fast retransmit) m ___________________ ACK received: increase cwnd r slowstart phase: m increase exponentially fast (despite name) at connection start, or following timeout r congestion avoidance: m increase linearly
23
Transport Layer 3-23 TCP: congestion avoidance when cwnd > ssthresh grow cwnd linearly m _____increse cwnd by 1 mss/per rtt____ m approach possible congestion slower than in slowstart implementation: cwnd = cwnd + MSS/cwnd for each ACK received ACKs: increase cwnd by 1 MSS per RTT: additive increase loss: cut cwnd in half (non-timeout-detected loss ): multiplicative decrease AIMD AIMD: Additive Increase Multiplicative Decrease
24
Transport Layer 3-24 Popular “flavors” of TCP ssthresh TCP Tahoe TCP Reno Transmission round cwnd window size (in segments)
25
Transport Layer 3-25 Summary: TCP Congestion Control when cwnd < ssthresh, sender in ___________ phase, window grows __________. when cwnd >= ssthresh, sender is in ______________ phase, window grows _______. when triple duplicate ACK occurs, ssthresh set to ________, cwnd set to ______________ when timeout occurs, ssthresh set to ________, cwnd set to _________ MSS.
26
Transport Layer 3-26 TCP throughput r Q: what’s average throughout of TCP as function of window size, RTT? m ignoring slow start r let W be window size when loss occurs. m when window is W, throughput is W/RTT m just after loss, window drops to W/2, throughput to W/2RTT. m average throughout:.75 W/RTT
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.