Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Transport Protocols (continued) Relates to Lab 5. UDP and TCP.

Similar presentations


Presentation on theme: "1 Transport Protocols (continued) Relates to Lab 5. UDP and TCP."— Presentation transcript:

1 1 Transport Protocols (continued) Relates to Lab 5. UDP and TCP

2 2 Flow Control Congestion Control TCP:

3 3 What is Flow/Congestion Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver buffer Congestion Control: Algorithms to prevent that the sender overloads the network  Sliding window implements both control mechanisms.

4 4 Flow Control

5 5 Congestion Control TCP connection 1 bottleneck router capacity R

6 6 TCP Flow Control

7 7 TCP uses the sliding window algorithm to implement flow control

8 8 Sliding Window Flow Control Sliding Window Protocol is performed at the byte level: Here: Sender can transmit sequence numbers 6,7,8.

9 9 Sliding Window: “Window Opens” Acknowledgement is received that enlarges the window to the right (AckNo = 5, Win=6): A receiver opens a window when TCP buffer empties (meaning that data is delivered to the application). 1234567891011 1234567891011 AckNo = 5, Win = 6 is received

10 10 Window Management in TCP The receiver is returning two parameters to the sender The interpretation is: I am ready to receive new data with SeqNo= AckNo, AckNo+1, …., AckNo+Win-1 Receiver can acknowledge data without opening the window Receiver can change the window size without acknowledging data

11 11

12 12 Sliding Window: Example

13 13 TCP Congestion Control

14 14 TCP Congestion Control Keep a sender from congesting the network.

15 15 TCP Congestion Control Keep a sender from congesting the network. The sender has two internal parameters: –Congestion Window (cwnd) –Slow-start threshhold Value (ssthresh) Sliding window size is set to the minimum of (cwnd, receiver advertised win) Congestion control works in two modes: –slow start (cwnd < ssthresh) Probe the available bandwidth –congestion avoidance (cwnd >= ssthresh) Try not to overload the network.

16 16 Slow Start Initial value: Set cwnd = 1 Note: Unit is a segment size. TCP actually is based on bytes and increments by 1 MSS (maximum segment size) Modern TCP implementation may set initial cwnd to 2 Each time an ACK is received by the sender, the congestion window is increased by 1 segment: cwnd = cwnd + 1 If an ACK acknowledges two segments, cwnd is still increased by only 1 segment. Even if ACK acknowledges a segment that is smaller than MSS bytes long, cwnd is increased by 1 maximum segment size. Question: how can you accelerate your TCP download?

17 17 Slow Start Example Not really slow: The congestion window size grows very rapidly –For every ACK, we increase cwnd by 1 irrespective of the number of segments ACK’ed TCP slows down the increase of cwnd when cwnd > ssthresh

18 18 Congestion Avoidance Congestion avoidance phase is started if cwnd has reached the slow-start threshold value If cwnd >= ssthresh then each time an ACK is received, increment cwnd as follows: cwnd = cwnd + 1/ cwnd So cwnd is increased by one only if all cwnd segments have been acknowledged.

19 19 Example of Slow Start/Congestion Avoidance Assume that ssthresh = 8 Roundtrip times Cwnd (in segments) ssthresh

20 20 Responses to Congestion TCP uses packet loss as congestion signal A TCP sender can detect lost packets via: Receipt of a duplicate ACK Timeout of a retransmission timer

21 21 Response to Timeout TCP interprets a Timeout as a severe congestion signal. When a timeout occurs, the sender performs: –cwnd is reset to one: cwnd = 1 –ssthresh is set to half of the current size of the congestion window: ssthressh = cwnd / 2 –and slow-start is entered

22 22 Reaction to Duplicate ACKs Fast retransmit –Three duplicate ACKs indicate a packet loss –Retransmit without timeout Fast recovery –Avoid slow start –Retransmit “lost packet” –ssthresh = cwnd/2 –cwnd = cwnd+3 –Increment cwnd by one for each additional duplicate ACK When ACK arrives that acknowledges “new data” set: cwnd=ssthresh enter congestion avoidance

23 23 Duplicate ACK example

24 24 Flavors of TCP Congestion Control TCP Tahoe (1988, FreeBSD 4.3 Tahoe) –Slow Start –Congestion Avoidance –Fast Retransmit TCP Reno (1990, FreeBSD 4.3 Reno) –Fast Recovery –Modern TCP implementation New Reno (1996) SACK (1996)

25 25 TCP Tahoe This picture is copied from somewhere

26 26 TCP Reno (Jacobson 1990) CA SS Fast retransmission/fast recovery This picture is copied from somewhere

27 27 TCP III – Retransmission and Timeout

28 28 Retransmissions in TCP A TCP sender retransmits a segment when it assumes that the segment has been lost: 1.No ACK has been received and a timeout occurs 2.Multiple ACKs have been received for the same segment

29 29 Retransmission Timer TCP sender maintains one retransmission timer for each connection When the timer reaches the retransmission timeout (RTO) value, the sender retransmits the first segment that has not been acknowledged The timer is started when 1.When a packet with payload is transmitted and timer is not running 2.When an ACK arrives that acknowledges new data, 3.When a segment is retransmitted The timer is stopped when –All segments are acknowledged

30 30 How to set the timer Retransmission Timer: –The setting of the retransmission timer is crucial for good performance of TCP –Timeout value too small  results in unnecessary retransmissions –Timeout value too large  long waiting time before a retransmission can be issued –A problem is that the delays in the network are not fixed –Therefore, the retransmission timers must be adaptive

31 31 Setting the value of RTO: The RTO value is set based on round-trip time (RTT) measurements that each TCP performs Each TCP connection measures the time difference between the transmission of a segment and the receipt of the corresponding ACK There is only one measurement ongoing at any time (i.e., measurements do not overlap) Figure on the right shows three RTT measurements

32 32 Setting the RTO value RTO is calculated based on the RTT measurements –Uses an exponential moving average to estimate RTT (srtt) and variance of RTT (rttvar) from –The influence of past samples decrease exponentially The RTT measurements are smoothed by the following estimators srtt and rttvar: srtt n+1 =  RTT + (1-  ) srtt n rttvar n+1 =  ( | RTT - srtt n | ) + (1-  ) rttvar n RTO n+1 = srtt n+1 + 4 rttvar n+1 –The gains are set to  =1/4 and  =1/8

33 33 Setting the RTO value (cont’d) Initial value for RTO: –Sender should set the initial value of RTO to RTO 0 = 3 seconds RTO calculation after first RTT measurements arrived srtt 1 = RTT rttvar 1 = RTT / 2 RTO 1 = srtt 1 + 4 rttvar n+1 When a timeout occurs, the RTO value is doubled RTO n+1 = max ( 2 RTO n, 64) seconds This is called an exponential backoff

34 34 Karn’s Algorithm Karn’s Algorithm: Don’t update RTT on any segments that have been retransmitted If an ACK for a retransmitted segment is received, the sender cannot tell if the ACK belongs to the original or the retransmission.  RTT measurements is ambiguous in this case

35 35 Summary UDP: connectionless, unreliable, datagram service TCP: reliable, connection-oriented, byte stream service –TCP header –Connection management –Delayed ACKs and nagle’s algorithm –TCP flow control –TCP congestion control –TCP retransmission and timeout References –TCP/IP illustrated vol. 1, chapter11, 17-24 –RFC793 (Transmission Control Protocol) –RFC768 (User Datagram Protocol) –RFC2581 (TCP Congestion control) –RFC2988 (Computing TCP’s Retransmission Timer) –RFC3390 (Increasing TCP’s Initial Window)

36 36 Lab 7 Problems Exercise 3(B), Part 4-5 TCP Path MTU Discovery –How does it works? 1.TCP uses the minimum of the MSS announced by the 2 hosts in connection establishment 2.All TCP segment has the DF bit set in IP header 3.If a router along the path has a smaller MTU than the TCP segment size, it returns an “ICMP unreachable” error report with its MTU, e.g. MTU r 4.TCP set the MSS to (MTU r - 40), and try again. 5.The process continues until no “ICMP unreachable” error message is received.

37 37 LAB 5

38 38 TCP Path MTU Discovery Example MTU 1500 MTU 500 MTU 1500 10.0.1.11/2410.0.2.22/2410.0.1.33/2410.0.2.33/24 PC1 PC2 PC3/Router ttcp –ts –1024 –n2 –p4444 –D 10.0.2.22 ttcp –rs –1024 –n2 –p4444 SYN, MSS=1460 SYN, ACK, MSS=1460 ACK PUSH, LEN=1460 ICMP Unreachable, MTU=500 PUSH, LEN=460 ACK

39 39 Exercise 6A: TCP Bulk Data transfer (fast link) eth1 10.0.5.11/2410.0.5.22/24 PC1PC2 ttcp –ts –l1000 –n500 –p4444 –D 10.0.5.22ttcp –rs –l1000 –n500 –p4444 Step 4(5): Determine whether or not the TCP sender generally transmits the maximum amount of data allowed by the advertised window. Explain your answer.

40 40 Exercise 6B: TCP Bulk Data transfer (slow link) eth0 10.0.1.11/24 10.0.2.22/24 PC2 ttcp –ts –l1000 –n500 –p4444 –D 10.0.2.22ttcp –rs –l1000 –n500 –p4444 Step 4(4): Does TCP sender generally transmits the maximum amount of data allowed by the advertised window? Explain your answer. PC1 Router 1Router 2

41 41 Trouble Shooting I did everything by following the instructions, but it does not work and I can’t ping other hosts/routers. Why? Well, something must be wrong. Let’s figure it out.

42 42 Trouble Shooting Techniques The key to trouble shooting is to isolate the problem, i.e. what is the problem and where it happened in the network. –What is the output of the ping command? “Network unreachable”  Check local routing table “PING x.x.x.x (x.x.x.x) 56(84) bytes of data”, and it hangs there  run “traceroute x.x.x.x” to see where the ICMP Echo Request packet failed.


Download ppt "1 Transport Protocols (continued) Relates to Lab 5. UDP and TCP."

Similar presentations


Ads by Google