Transport Layer
Chapter 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 Thanks and enjoy! JFK/KWR Computer Networking: A Top Down Approach Featuring the Internet, 3rd edition Jim Kurose, Keith Ross Addison-Wesley, July 2004 All material copyright 1996-2006 J.F Kurose and K.W Ross, All Rights Reserved Transport Layer 3-1 Chapter 3: Transport Layer Our goals: Ì understand principles behind transport layer services: r r r r multiplexing/demultipl exing reliable data transfer flow control congestion control Ì learn about transport layer protocols in the Internet: r r r UDP: connectionless transport TCP: connection-oriented transport TCP congestion control Transport Layer 3-2 Chapter 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 r r r r segment structure reliable data transfer flow control connection management Ì 3.6 Principles of congestion control Ì 3.7 TCP congestion control Transport Layer 3-3 Transport services and protocols application transport network data link physical network data link physical network data link physical g lo e al ic nd -e nd network data link physical a tr network data link physical network data link physical rt po ns logical communication between app processes running on different hosts Ì transport protocols run in end systems r send side: breaks app messages into segments, passes to network layer r rcv side: reassembles segments into messages, passes to app layer Ì more than one transport protocol available to apps r Internet: TCP and UDP Ì provide application transport network data link physical Transport Layer 3-4 Transport vs network layer network layer: logical communication between hosts Ì transport layer: logical communication between processes Ì r relies on, enhances, network layer services Household analogy: 12 kids sending letters to 12 kids Ì processes = kids Ì app messages = letters in envelopes Ì hosts = houses Ì transport protocol = Ann and Bill Ì network-layer protocol = postal service Transport Layer 3-5 Internet transport-layer protocols Ì reliable, in-order delivery (TCP) r no-frills extension of “best-effort” IP Ì services not available: r delay guarantees r bandwidth guarantees network data link physical network data link physical rt po ns delivery: UDP network data link physical a tr Ì unreliable, unordered nd -e nd r network data link physical e al ic r congestion control flow control connection setup network data link physical g lo r application transport network data link physical application transport network data link physical Transport Layer 3-6 Chapter 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 r r r r segment structure reliable data transfer flow control connection management Ì 3.6 Principles of congestion control Ì 3.7 TCP congestion control Transport Layer 3-7 Multiplexing/demultiplexing Multiplexing at send host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) Demultiplexing at rcv host: delivering received segments to correct socket = socket application transport network link = process P3 P1 P1 application transport network P2 P4 application transport network link link physical host physical host physical host Transport Layer 3-8 How demultiplexing works Ì host receives IP datagrams each datagram has source IP address, destination IP address r each datagram carries transport-layer segment r each segment has source, destination port number Ì host uses IP addresses & port numbers to direct segment to appropriate socket r 32 bits source port # dest port # other header fields application data (message) TCP/UDP segment format Transport Layer 3-9 Connectionless demultiplexing Ì Create sockets with port numbers: DatagramSocket mySocket1 = new DatagramSocket(12534); DatagramSocket mySocket2 = new DatagramSocket(12535); Ì UDP socket identified by two-tuple: (dest IP address, dest port number) Ì When host receives UDP segment: r r checks destination port number in segment directs UDP segment to socket with that port number Ì IP datagrams with different source IP addresses and/or source port numbers directed to same socket Transport Layer 3-10 TCP Futures: TCP over “long, fat pipes” Ì Example: 1500 byte segments, 100ms RTT, want 10 Gbps throughput Ì Requires window size W = 83,333 in-flight segments Ì Throughput in terms of loss rate: 1.22 ⋅ MSS RTT L Wow Ì New versions of TCP for high-speed needed! Ì ➜ L = 2·10-10 Transport Layer 3-99 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 TCP connection bottleneck router capacity R Transport Layer 3-100 Why is TCP fair? Two competing sessions: Ì Additive increase gives slope of 1, as throughout increases Ì multiplicative decrease decreases throughput proportionally equal bandwidth share Connection throughput R loss: decrease window by factor of congestion avoidance: additive increase loss: decrease window by factor of congestion avoidance: additive increase Connection throughput R Transport Layer 3-101 Fairness (more) Fairness and UDP Ì Multimedia apps often not use TCP r not want rate throttled by congestion control Ì Instead use UDP: r pump audio/video at constant rate, tolerate packet loss Ì Research area: TCP friendly Fairness and parallel TCP connections Ì nothing prevents app from opening parallel connections between hosts Ì Web browsers this Ì Example: link of rate R supporting cnctions; r r new app asks for TCP, gets rate R/10 new app asks for 11 TCPs, gets R/2 ! Transport Layer 3-102 Delay modeling Q: How long does it take to receive an object from a Web server after sending a request? Ignoring congestion, delay is influenced by: Notation, assumptions: Ì Assume one link between client and server of rate R Ì S: MSS (bits) Ì O: object size (bits) Ì no retransmissions (no loss, no corruption) Ì TCP connection establishment Window size: Ì data transmission delay Ì First assume: fixed Ì slow start congestion window, W segments Ì Then dynamic window, modeling slow start Transport Layer 3-103 Fixed congestion window (1) First case: WS/R > RTT + S/R: ACK for first segment in window returns before window’s worth of data sent delay = 2RTT + O/R Transport Layer 3-104 Fixed congestion window (2) Second case: Ì WS/R < RTT + S/R: wait for ACK after sending window’s worth of data sent delay = 2RTT + O/R + (K-1)[S/R + RTT - WS/R] Transport Layer 3-105 TCP Delay Modeling: Slow Start (1) Now suppose window grows according to slow start Will show that the delay for one object is: Latency = RTT + O S S + P RTT + − ( P − 1) R R R where P is the number of times TCP idles at server: P = min{Q, K − 1} - where Q is the number of times the server idles if the object were of infinite size - and K is the number of windows that cover the object Transport Layer 3-106 TCP Delay Modeling: Slow Start (2) Delay components: • RTT for connection i n it i a t e T C P c o n n e c t i o n estab and request • O/R to transmit object • time server idles due to slow start r e q u e s t o b j e c t R T f ir s t w i n = S / R s e T w c o = Server idles: P = min{K-1,Q} times t h = Example: • O/S = 15 segments • K = windows •Q=2 • P = min{K-1,Q} = ir d f o u = o d Server idles P=2 times d b e d S w S / R in d / R r t h S w i n / R c o m p le t e t r a n s m is s j e c t li v e r e d t i m e a c l ie n t n t t im s e e a t r v e r Transport Layer 3-107 TCP Delay Modeling (3) S + RTT = time from when server starts to send segment R until server receives acknowledgement 2k −1 S = time to transmit the kth window R in it i a t e T C P c o n n e c t i o n r e q u e s t o b j e c t + S S + RTT − k −1 = idle time after the kth window R R R T f i r s t w i n = S / R T s e t h = P O delay = + RTT + ∑ idleTime p R p =1 P O S S = + RTT + ∑ [ + RTT − k −1 ] R R k =1 R O S S = + RTT + P[ RTT + ] − (2 P − 1) R R R c o = i r d f o u = o d b e j e c t li v e r e d S / R w i n / R r t h S w / R S c o m p l e t r a n s m i d t i m e a c l i e n t n t t im s e e a t r v e r Transport Layer 3-108 TCP Delay Modeling (4) Recall K = number of windows that cover object How we calculate K ? K = min{k : S + 21 S + + k −1 S ≥ O} = min{k : + 21 + + k −1 ≥ O / S } O = min{k : − ≥ } S O = min{k : k ≥ log ( + 1)} S O = log ( + 1) S k Calculation of Q, number of idles for infinite-size object, is similar (see HW) Transport Layer 3-109 HTTP Modeling Assume Web page consists of: r base HTML page (of size O bits) r M images (each of size O bits) Ì Non-persistent HTTP: r M+1 TCP connections in series r Response time = (M+1)O/R + (M+1)2RTT + sum of idle times Ì Persistent HTTP: r RTT to request and receive base HTML file r RTT to request and receive M images r Response time = (M+1)O/R + 3RTT + sum of idle times Ì Non-persistent HTTP with X parallel connections r Suppose M/X integer r TCP connection for base file r M/X sets of parallel connections for images r Response time = (M+1)O/R + (M/X + 1)2RTT + sum of idle times Ì Transport Layer 3-110 HTTP Response time (in seconds) RTT = 100 msec, O = Kbytes, M=10 and X=5 20 18 16 14 12 10 non-persistent persistent parallel nonpersistent 28 100 10 Kbps Kbps Mbps Mbps For low bandwidth, connection & response time dominated by transmission time Persistent connections only give minor improvement over parallel connections Transport Layer 3-111 HTTP Response time (in seconds) RTT =1 sec, O = Kbytes, M=10 and X=5 70 60 50 non-persistent 40 persistent 30 20 parallel nonpersistent 10 28 Kbps 100 10 Kbps Mbps Mbps For larger RTT, response time dominated by TCP establishment & slow start delays Persistent connections now give important improvement: particularly in high delay•bandwidth networks Transport Layer 3-112 Chapter 3: Summary Ì principles behind transport layer services: r multiplexing, demultiplexing r reliable data transfer r flow control r congestion control Ì instantiation and implementation in the Internet r UDP r TCP Next: Ì leaving the network “edge” (application, transport layers) Ì into the network “core” Transport Layer 3-113 ... transport layer protocols in the Internet: r r r UDP: connectionless transport TCP: connection-oriented transport TCP congestion control Transport Layer 3-2 Chapter outline Ì 3.1 Transport- layer. .. than one transport protocol available to apps r Internet: TCP and UDP Ì provide application transport network data link physical Transport Layer 3-4 Transport vs network layer network layer: logical... letters in envelopes Ì hosts = houses Ì transport protocol = Ann and Bill Ì network -layer protocol = postal service Transport Layer 3-5 Internet transport- layer protocols Ì reliable, in-order delivery