Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 27 Introduction to Computer Networks.

Similar presentations


Presentation on theme: "CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 27 Introduction to Computer Networks."— Presentation transcript:

1 CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 27 Introduction to Computer Networks

2 CMPE 150- Introduction to Computer Networks 2 Announcements Homework 5 posted. –Due, Mon, 12.05. Lab tonight! Final exam: December 7 th. 4-7pm –In class. –Closed books/notes. –Comprehensive. Course evaluation. –Last day of class. CE 151 will be offered in Winter 06!

3 CMPE 150- Introduction to Computer Networks 3 Today Transport Layer (Cont’d). –Chapter 6 of Tanenbaum.

4 CMPE 150- Introduction to Computer Networks 4 The Transport Layer End-to-end. –Communication from source to destination host. –Only hosts run transport-level protocols. –Under user’s control as opposed to network layer which is controlled/owned by carrier.

5 CMPE 150- Introduction to Computer Networks 5 The Transport Service Service provided to application layer. Transport entity: process that implements the transport protocol running on a host. –Typically at OS kernel, or user-level process.

6 CMPE 150- Introduction to Computer Networks 6 Connection Establishment

7 CMPE 150- Introduction to Computer Networks 7 Three-Way Handshake Solves the problem of getting 2 sides to agree on initial sequence number. CR (seq=x) ACK(seq=y,ACK=x) DATA(seq=x, ACK=y) CR: connection request. 1 2

8 CMPE 150- Introduction to Computer Networks 8 Delayed Duplicates. Old duplicate CR.. The ACK from host 2 tries to verify if host 1 was trying to open a new connection with seq=x.. Host 1 rejects host 2’s attempt to establish. Host 2 realizes it was a duplicate CR and aborts connection. CR(seq=x) * ACK(seq=y, ACK=x) REJECT(ACK=y) 1 2

9 CMPE 150- Introduction to Computer Networks 9 Delayed Duplicates. Old duplicate CR and ACK to connection accepted. CR(seq=x) * ACK(seq=y, ACK=x) REJECT(ACK=y) 1 2 DATA(seq=x, ACK=z)

10 CMPE 150- Introduction to Computer Networks 10 TCP Connection Establishment 6-31

11 CMPE 150- Introduction to Computer Networks 11 Sequence Numbers versus Time 1 Seq. #’s Time. Linear relation between time and initial sequence number.

12 CMPE 150- Introduction to Computer Networks 12 Connection Release Asymmetric release: telephone system. –When one party hangs up, connection breaks. –May cause data loss. Symmetric release: –Treats connection as 2 separate unidirectional connections. –Requires each to be released separately.

13 CMPE 150- Introduction to Computer Networks 13 Symmetric Release How to determine when all data has been sent and connection could be released? 2-army problem: Blue army 1 White army Blue army 2. White army larger than either blue armies.. Blue army together is larger.. If each blue army attacks, it’ll be defeated. They win if attack together.

14 CMPE 150- Introduction to Computer Networks 14 2-Army Problem To synchronize attack, they must use messengers that need to cross valley: unreliable. Is there a protocol that allows blue army to win? No. –Blue army 1 sends message to blue army 2. –Blue army 2 sends ACK back. –Blue army 2 is not sure whether ACK was received.

15 CMPE 150- Introduction to Computer Networks 15 2-Army Problem (Cont’d) Use 2-way handshake. –Blue army 1 ACKs back but it’ll never know if the ACK was received. Applying to connection release: –Neither side is prepared to disconnect until convinced other side is prepared to disconnect. –In practice, hosts are willing to take risks.

16 CMPE 150- Introduction to Computer Networks 16 Connection Release Protocol DR ACK DR: disconnection request. Send DR+ start timer Send DR+ start timer Release connection Send ACK Release connection

17 CMPE 150- Introduction to Computer Networks 17 Connection Release: Scenario 1 DR ACK DR: disconnection request. Send DR+ start timer Send DR+ start timer Release connection Send ACK Timeout: Release connection

18 CMPE 150- Introduction to Computer Networks 18 Connection Release: Scenario 2 DR DR: disconnection request. Send DR+ start timer Send DR+ start timer Timeout: send DR+ start timer Release connection DR Send DR+ start timer DR ACK

19 CMPE 150- Introduction to Computer Networks 19 TCP Connection Release Each side released independently. –TCP segment with FIN bit set. –Means that side has no more data to send. When both sides have shutdown, connection is released,

20 CMPE 150- Introduction to Computer Networks 20 TCP Connection Release FIN FIN ACK FIN FIN ACK Timers to avoid 2-army problem.

21 CMPE 150- Introduction to Computer Networks 21 TCP Reliability Reliability. Ordering. Duplicate detection.

22 CMPE 150- Introduction to Computer Networks 22 TCP Reliability: Mechanisms Acknowledgements. Timers. Sequence numbers.

23 CMPE 150- Introduction to Computer Networks 23 Delayed ACKs ACKs are delayed waiting for data to be sent in the “other” direction. Either data will be sent or delayed ACK timer expires.

24 CMPE 150- Introduction to Computer Networks 24 TCP Flow Control

25 CMPE 150- Introduction to Computer Networks 25 Window Flow Control: Sender Sent but not ackedNot yet sent advertised window (from receiver) Sequence numbers last byte sentlast byte ACKed effective window send buffer

26 CMPE 150- Introduction to Computer Networks 26 Window Flow Control: Receiver ACKed but not delivered to user recv’d but not ACKed Receive buffer (possible window) Sequence numbers advertised window missing data

27 CMPE 150- Introduction to Computer Networks 27 Problem: Rapid Wrap-Around Sequence number is 32 bits long. Wraparound time vs. link speed: 1.5Mbps: 6.4 hours 10Mbps: 57 minutes 45Mbps: 13 minutes 100Mbps: 6 minutes 622Mbps: 55 seconds 1.2Gbps: 28 seconds  Protection Against Wrapped Sequences (PAWS extension): Use timestamp option to extend sequence number space.

28 CMPE 150- Introduction to Computer Networks 28 Silly Window Syndrome

29 CMPE 150- Introduction to Computer Networks 29 Window Advancement Issues What if window is full? –Sender sends full window, but ACK is lost.  Sender sends 1-byte probes (solicits new ACK). Silly window syndrome (RFC-813) –Receiver avoids small window advances.  Silly Window Avoidance: delay ACKing (receiver) or avoid sending small segments (sender). Sender avoids sending small chunks (like telnet).  Nagle’s algorithm (RFC-896): send 1 st partial packet, but not more until it’s ACKed or you have a full packet

30 CMPE 150- Introduction to Computer Networks 30 TCP Congestion Control

31 CMPE 150- Introduction to Computer Networks 31 What is Congestion Control? “Efforts made by network nodes to prevent or respond to overload condition”, [Peterson&Davie]. –Prevent senders from sending too much data into network. Flow control? –Prevents (faster) sender from overrunning (slower) receiver. Both concepts are often confused as they share common mechanisms.

32 CMPE 150- Introduction to Computer Networks 32 TCP Congestion Control (a) A fast network feeding a low capacity receiver. (b) A slow network feeding a high-capacity receiver.

33 CMPE 150- Introduction to Computer Networks 33 Why do congestion control? Use network resources efficiently. Preserve fair network resource allocation. Prevent or avoid congestion collapse. Congestion collapse is not just a theory! –Has been frequently observed in many networks.

34 CMPE 150- Introduction to Computer Networks 34 Congestion Collapse If both sources send full speed, the router is completely overwhelmed  congestion collapse: senders lose data from congestion and they resend, causing more congestion (can be self-reinforcing). 10 Mbps 1.5 Mbps

35 CMPE 150- Introduction to Computer Networks 35 Network dynamics load throughput load delay

36 CMPE 150- Introduction to Computer Networks 36 E2E congestion control Why do it at the transport layer? –Real fix to congestion is to slow down sender. Use law of “conservation of packets”. –Keep number of packets in the network constant. –Don’t inject new packet until old one leaves. Congestion indicator: packet loss.

37 CMPE 150- Introduction to Computer Networks 37 Congestion Control Design Avoidance or detection/recovery? –Avoidance keeps system at knee of curve Requires some congestion signal. –Detection/recovery responds to loss after the fact. TCP –Which is TCP? Congestion detection/recovery. –How does TCP do it? Slow start, congestion avoidance, exponential backoff.

38 CMPE 150- Introduction to Computer Networks 38 TCP congestion control Underlying design principle: packet conservation –At equilibrium, inject packet into network only when one is removed. –Basis for stability of physical systems.

39 CMPE 150- Introduction to Computer Networks 39 Self-clocking If we have large actual window, should we send data in one shot? –No, use ACKs to clock sending new data.

40 CMPE 150- Introduction to Computer Networks 40..Self-clocking PrPr PbPb ArAr AbAb receiver sender AsAs

41 CMPE 150- Introduction to Computer Networks 41 TCP congestion control basics Like, flow control, also window based. –Sender keeps congestion window (cwin). –Each sender keeps 2 windows: receiver’s advertised window and congestion window. –Sender’s maximum window: min(advertised window, cwin). Sender’s actual window: –Max window - unacknowledged segments.

42 CMPE 150- Introduction to Computer Networks 42 TCP congestion control mechanisms Collection of interrelated mechanisms: –Slow start. –Congestion avoidance. –Accurate retransmission timeout estimation. –Fast retransmit. –Fast recovery.

43 CMPE 150- Introduction to Computer Networks 43 TCP congestion window New congestion window cwnd –What the network can handle, –versus flow control window (wnd): what the other end can handle Actual congestion window: –min (wnd, cwnd).

44 CMPE 150- Introduction to Computer Networks 44 How to adjust window? When to increase/decrease? A control theory problem: –Observe network. –Reduce window if congested. –Increase window if not congested. Constraints: –Efficiency. –Fairness. –Stability (too much oscillation is bad). –Out-of-date info RTT is fundamental limit to how quickly you can react

45 CMPE 150- Introduction to Computer Networks 45 Slow start [Jacobson 1988] How do we get this self-clocking behavior to start? –Initialize cwnd = 1. –Upon receipt of every ack, cwnd = cwnd + 1 Implications –Window actually increases in RTT * log 2 W (exponential increase). –Can overshoot window and cause packet loss.  Connection’s congestion window starts at 1 segment.

46 CMPE 150- Introduction to Computer Networks 46 Slow start example 1 one RTT one pkt time 0R 2 1R 3 4 2R 5 6 7 8 3R 9 10 11 12 13 14 15 1 23 4567

47 CMPE 150- Introduction to Computer Networks 47 When to End Slow-Start? Want to end when the pipe is full. –When cwnd > ssthresh. –Start with large ssthresh, but then refine it. On packet loss. –cwnd=1 and go back to slow start. –ssthresh = cwnd / 2 assume that pipe size was somewhere between last good window (cwnd/2) and current window (cwnd). Eventually, ssthresh is right and transition to congestion avoidance without packet loss.

48 CMPE 150- Introduction to Computer Networks 48 Congestion avoidance Upon receiving ACK Increase cwnd by 1/cwnd. This is additive increase. Why not multiplicative increase? Growing too fast in equilibrium => oscillations

49 CMPE 150- Introduction to Computer Networks 49 TCP Congestion Control: Operation threshold timeout threshold cwin time

50 CMPE 150- Introduction to Computer Networks 50 TCP Retransmission Timer When segment sent, retransmission timer starts. –If segment ACKed, timer stops. –If time out, segment retransmitted and timer starts again.

51 CMPE 150- Introduction to Computer Networks 51 How to set timer? Based on round-trip time: time between a segment is sent and ACK comes back. If timer is too short, unnecessary retransmissions. If timer is too long, long retransmission delay.

52 CMPE 150- Introduction to Computer Networks 52 Jacobson’s Algorithm 1 Determining the round-trip time: –TCP keeps RTT variable. –When segment sent, TCP measures how long it takes to get ACK back (M). –RTT = alpha*RTT + (1-alpha)M. –alpha: smoothing factor; determines weight given to previous estimate. –Typically, alpha=7/8.

53 CMPE 150- Introduction to Computer Networks 53 Jacobson’s Algorithm 2 Determining timeout value: –Measure RTT variation, or |RTT-M|. –Keeps smoothed value of cumulative variation D=alpha*D+(1-alpha)|RTT-M|. –Alpha may or may not be the same as value used to smooth RTT. –Timeout = RTT+4*D.

54 CMPE 150- Introduction to Computer Networks 54 Karn’s Algorithm How to account for ACKs of retransmitted segments? –Count it for first or second transmission? –Karn proposed not to update RTT on any retransmitted segment. –Instead RTT is doubled on each failure until segments get through.

55 CMPE 150- Introduction to Computer Networks 55 Persistence Timer Prevents deadlock if an window update packet is lost and advertised window = 0. When persistence timer goes off, sender probes receiver; receiver replies with its current advertised window. If 0, persistence timer is set again.

56 CMPE 150- Introduction to Computer Networks 56 Keepalive Timer Goes off when a connection is idle for a long time. Causes one side to check whether the other side is still alive. If no answer, connection terminated.


Download ppt "CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 27 Introduction to Computer Networks."

Similar presentations


Ads by Google