* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter3 Transport Layer4
Survey
Document related concepts
Distributed firewall wikipedia , lookup
Airborne Networking wikipedia , lookup
Network tap wikipedia , lookup
Asynchronous Transfer Mode wikipedia , lookup
Multiprotocol Label Switching wikipedia , lookup
Computer network wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Deep packet inspection wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
UniPro protocol stack wikipedia , lookup
Internet protocol suite wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Transcript
Transport Layer CS 381 3/7/2017 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-2 Principles of Congestion Control Congestion: • Informally: “too many sources sending too much data too fast for network to handle” • Different from flow control! • Flow Control: Sender decreases packet transmission to accommodate receiver. • Manifestations: • • Lost packets (buffer overflow at routers) Long delays (queueing in router buffers) a top-10 problem! Transport Layer 3-3 Causes/costs of congestion: scenario 1 • Two senders, two receivers • One router, infinite buffers • • • • No errors/retransmissions No flow control No congestion control Both hosts transmitting continuously at the same time Host A Host B lin : original data lout unlimited shared output link buffers Transport Layer 3-4 Causes/costs of congestion: scenario 1 • Maximum throughput for two senders: R/2 • Link can’t deliver packets to receiver at a rate that exceeds R/2 • As the sending rate approaches R/2, the average package delay increases (as the number of buffered packets increase). • When the sending rate exceeds R/2, packet delay becomes infinite. Transport Layer 3-5 Causes/costs of congestion: scenario 1 • First cost of a congested network: • Large queuing delays are experienced as the packet arrival rate nears the link capacity • Why? • Processing packet header takes time! Transport Layer 3-6 Causes/costs of congestion: scenario 2 • Two senders, two receivers • one router, finite buffers • Packets dropped when arriving to router with full buffer • sender retransmission of lost packet Host A lin : original data lout l'in : original data, plus retransmitted data Host B finite shared output link buffers Transport Layer 3-7 Causes/costs of congestion: scenario 2 • Case 1: Hosts only transmits data when it knows buffer space in the router is free. • • No packet loss Throughput up to R/2 Sending rate cannot exceed R/2 since packet loss is assumed never to occur R/2 • Realistic scenario? • NO! lout • • Why? lin R/2 Transport Layer 3-8 Causes/costs of congestion: scenario 2 • Case 2: Sender retransmits only when a packet is know for certain to be lost. • • • • How does the sender know for sure a packet is lost? Performance is decreased as the sender resends lost packets Assume for each 3 packets transmitted, 1 packet is duplicated 33% performance decrease due to packet retransmissions in this case lout • Second cost of a congested network: • Sender must retransmit to compensate for lost packets due to router buffer overflow R/2 R/3 lin R/2 Transport Layer 3-9 Causes/costs of congestion: scenario 2 • Case 3: Sender times out prematurely, retransmits a dup packet that has been delayed in the router buffer, but not lost • • • • • Destination receives duplicate data Work done by router to forward duplicate data is wasted Assume each packet has to be forwarded twice by the router Due to large queueing delays 50% performance decrease due to packet retransmissions in this case • Third cost of a congested network: • Duplicate transmissions from sender due to large delays may cause routers to forward unneeded copies of data Transport Layer 3-10 Causes/costs of congestion: scenario 3 • Four senders, four receivers • Four routers, finite buffers • Packets dropped when arriving to router with full buffer • Sender retransmission of lost packet Host A lin : original data lout Host B l'in : original data, plus retransmitted data finite shared output link buffers Host D Host C Transport Layer 3-11 Causes/costs of congestion: scenario 3 • Fourth cost of a congested network: • When a packet is dropped along a path, any “upstream” transmission capacity used for that packet is wasted! Transport Layer 3-12 Approaches towards congestion control Two broad approaches Network-assisted congestion control: • Routers provide feedback to end systems about current buffer state. • Two ways: • • • “Choke packet”: Examine sender packet header to obtain IP, notify about state of buffers. • Router can update a field in the sender’s packet header that indicates state of buffers. Note: This can take up to 1 RTT. Complexity? Router explicit communication with end host processes Flooding, loss of choke packets, etc. Transport Layer 3-13 Approaches towards congestion control two broad approaches End-end congestion control: • No explicit feedback from network core • Congestion of network “inferred” by the end systems based on packet loss and delay This is the approach taken by TCP • Segment loss (3 dup ACK, timeout) indicates congestion • TCP adjusts sender’s transmission rate based on congestion Transport Layer 3-14 Approaches towards congestion control Two broad approaches Transport Layer 3-15 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-16 TCP congestion control: • Goal: • • TCP sender should transmit as fast as possible, but without congesting the network Q: how to find rate just below congestion level? • Decentralized approach: each TCP sender sets its own rate, based on implicit feedback • ACK: segment received (a good thing!), network not congested • increase sending rate • Lost segment: assume loss due to congested network • decrease sending rate Transport Layer 3-17 TCP congestion control: • TCP sender rate is dynamic based on current status of the network • Questions: • • • How does a TCP sender limit transmission rate? How does a TCP sender perceive network congestion? How does TCP react to network congestion? Transport Layer 3-18 TCP congestion control: • How does a TCP sender limit transmission rate? Ignoring flow control, a TCP sender keeps track of a variable, congestion window, or cwnd. By adhering to the constraint: • LastByteSent – LastByteAcked <= min{cwnd, rwnd} • • • The TCP sender modifies the value of cwnd to adjust the rate at which it sends data into the network. • Sending rate: ~cwnd/RTT bps Transport Layer 3-19 TCP congestion control: • How does a TCP sender perceive network congestion? • • Excessive congestion in the network causes packets to be dropped or delayed, which creates a “loss” event at the TCP sender TCP considers a loss event as: • Timeout for receiving ACK • Receiving 3 dup ACKs • The TCP sender perceives the above loss events as network congestion and adjusts its transmission rate to accommodate Transport Layer 3-20 TCP congestion control: • How does a TCP sender react to network congestion? • • A lost packet implies congestion • TCP sender rate should be decreased Successfully ACK’d packets implies that the network is delivering packets to the destination • TCP sender rate should be increased Transport Layer 3-21 TCP congestion control: bandwidth probing • “Probing for bandwidth”: increase transmission rate on receipt of ACK, until eventually loss occurs, then decrease transmission rate Continue to increase on ACK, decrease on loss • Since available bandwidth is changing, depending on other connections in network ACKs being received, so increase rate sending rate • X X loss, so decrease rate X X TCP’s “sawtooth” behavior X time • Q: How fast to increase/decrease? • details to follow Transport Layer 3-22 TCP Congestion Control: details • Sender limits rate by limiting number of unACKed bytes “in pipeline”: • Cwnd: differs from rwnd (how, why?) • Cwnd set by TCP sender (congestion control window) • Rwnd set by TCP receiver (used for flow control) • Sender limited by min(cwnd,rwnd) • Roughly: Sending rate = cwnd RTT bytes/sec • Cwnd is dynamic, function of perceived network congestion Transport Layer 3-23 TCP Congestion Control: more details Segment loss event: reducing cwnd • Timeout: no response from receiver • • Set cwnd to 1MSS Aggressive response to congestion • Why reduce cwnd to 1? • 3 duplicate ACKs: at least some segments getting through (recall fast retransmit) • Set cwnd in half, not as aggressive as timeout event • Why? Transport Layer 3-24 TCP Congestion Control: more details ACK received: increase cwnd • Slowstart phase: • • Increase exponentially fast (despite the name) at connection start, or following timeout Doubles cwnd for each successful ACK, until cwnd reaches predetermined threshold • Congestion avoidance: • • Cwnd increase linearly Generally happens after slowstart phase reaches threshold Transport Layer 3-25 TCP Congestion Control: MSS MSS: Maximum Segment Size TCP MSS is calculated by Link Layer frame MTU (maximum transmission unit) – IP header – TCP header. Ethernet typical MTU size: 1500 bytes So, TCP typical MSS size over Ethernet: 1500 – 20 – 20 = 1460 bytes Transport Layer 3-26 TCP Slow Start • When connection begins, cwnd = 1 Host A Host B RTT MSS (maximum segment size) • Ex: MSS = 500 bytes & RTT = 200 msec • Initial rate = 20 kbps • Available bandwidth may be >> MSS/RTT • Desirable to quickly ramp up to respectable rate • Increase rate exponentially until first loss event or when threshold reached • Double cwnd every RTT • Done by increasing cwnd for every ACK received time Transport Layer 3-27 TCP: congestion avoidance • Due to previous loss events, the TCP sender will probe for bandwidth less aggressively • ssthresh: cwnd/2 when loss occurs • When cwnd > ssthresh grow cwnd linearly • • Increase cwnd by 1 MSS (1460 bytes) per RTT Approach possible network congestion slower than in slowstart Transport Layer 3-28 TCP: congestion avoidance • AIMD: Additive Increase Multiplicative Decrease • ACKs: • Increase cwnd by 1 MSS per RTT: additive increase • loss: • Set cwnd to half (non-timeout-detected loss ): multiplicative decrease • Remember: • The TCP sender responds to all timeout events by reducing cwnd to 1. Transport Layer 3-29 TCP congestion control FSM: overview cwnd > ssthresh slow start loss: timeout congestion avoidance loss: timeout loss: timeout loss: 3dupACK new ACK loss: 3dupACK fast recovery Transport Layer 3-30 TCP: Fast Recovery • TCP Tahoe: Earlier version of TCP • Reaction to loss events • Timeout: set ssthresh = cwnd/2, then cwnd to 1 and enter slowstart until cwnd >= ssthresh. Then enter congestion avoidance • 3 dup ACK’s: set ssthresh = cwnd/2, then cwnd to 1 and enter slowstart until cwnd >= ssthresh. Then enter congestion avoidance • TCP Reno: • Reaction to loss events • Timeout: Same as TCP Tahoe • 3 dup ACK’s: set cwnd = cwnd/2 = ssthresh and enter congestion avoidance 3-31 cwnd window size (in segments) Versions of TCP TCP Reno ssthresh ssthresh TCP Tahoe Transmission round Transport Layer 3-32 Summary: TCP Congestion Control • When cwnd < ssthresh, the TCP sender is in slow- start phase, window grows exponentially. • When cwnd >= ssthresh, the TCP sender is in congestion-avoidance phase, window grows linearly. • When triple duplicate ACK occurs, ssthresh set to cwnd/2, cwnd set to ~ ssthresh • When timeout occurs, ssthresh set to cwnd/2, cwnd set to 1 MSS. Transport Layer 3-33 Transport layer Protocol Fairness Fairness and UDP • Multimedia apps often do not use TCP • Does not want rate throttled by congestion control • No flow control • Instead use UDP: • Pump audio/video at constant rate • Tolerates packet loss • Current research interests for developing congestion-control mechanisms for the Internet that prevent UDP traffic from unfairly transmitting data Transport Layer 3-34 Transport layer Protocol Fairness Fairness and parallel TCP connections • Nothing prevents app from opening parallel connections between 2 hosts. • Web browsers do this • Example: link of rate R supporting 9 connections; • • New app asks for 1 TCP connection, gets rate R/10 New app instead asks for 11 TCP connections, gets R/2 ! Transport Layer 3-35 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-36