560 likes | 742 Views
CMPE 150 Fall 2005 Lecture 27. Introduction to Computer Networks . 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!.
E N D
CMPE 150Fall 2005Lecture 27 Introduction to Computer Networks
Announcements • Homework 5 posted. • Due, Mon, 12.05. • Lab tonight! • Final exam: December 7th. 4-7pm • In class. • Closed books/notes. • Comprehensive. • Course evaluation. • Last day of class. • CE 151 will be offered in Winter 06!
Today • Transport Layer (Cont’d). • Chapter 6 of Tanenbaum.
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.
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.
Three-Way Handshake • Solves the problem of getting 2 sides to agree on initial sequence number. 2 1 CR: connection request. CR (seq=x) ACK(seq=y,ACK=x) DATA(seq=x, ACK=y)
Delayed Duplicates 2 1 . 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)
Delayed Duplicates 2 1 . Old duplicate CR and ACK to connection accepted. * CR(seq=x) ACK(seq=y, ACK=x) DATA(seq=x, ACK=z) REJECT(ACK=y)
Sequence Numbers versus Time 1 Seq. #’s . Linear relation between time and initial sequence number. Time
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.
Symmetric Release • How to determine when all data has been sent and connection could be released? • 2-army problem: Blue army 2 Blue army 1 . 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. White army
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.
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.
Connection Release Protocol DR: disconnection request. Send DR+ start timer DR DR Send DR+ start timer Release connection ACK Send ACK Release connection
Connection Release: Scenario 1 DR: disconnection request. Send DR+ start timer DR DR Send DR+ start timer Release connection ACK Send ACK Timeout: Release connection
Connection Release: Scenario 2 DR: disconnection request. Send DR+ start timer DR DR Send DR+ start timer Timeout: send DR+ start timer DR Send DR+ start timer DR Release connection ACK
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,
TCP Connection Release FIN FIN ACK FIN FIN ACK Timers to avoid 2-army problem.
TCP Reliability • Reliability. • Ordering. • Duplicate detection.
TCP Reliability: Mechanisms • Acknowledgements. • Timers. • Sequence numbers.
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.
Window Flow Control: Sender effective window advertised window (from receiver) Sent but not acked Not yet sent Sequence numbers send buffer last byte ACKed last byte sent
Window Flow Control: Receiver Receive buffer (possible window) ACKed but not delivered to user recv’d but not ACKed Sequence numbers missing data advertised window
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.
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 1st partial packet, but not more until it’s ACKed or you have a full packet
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.
TCP Congestion Control • (a) A fast network feeding a low capacity receiver. • (b) A slow network feeding a high-capacityreceiver.
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.
10 Mbps 1.5 Mbps 10 Mbps 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).
Network dynamics delay throughput load load
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.
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.
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.
Self-clocking • If we have large actual window, should we send data in one shot? • No, use ACKs to clock sending new data.
..Self-clocking Pr Pb receiver sender Ab As Ar
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.
TCP congestion control mechanisms • Collection of interrelated mechanisms: • Slow start. • Congestion avoidance. • Accurate retransmission timeout estimation. • Fast retransmit. • Fast recovery.
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).
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 How to adjust window?
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 * log2W (exponential increase). • Can overshoot window and cause packet loss. • Connection’s congestion window starts at 1 segment.
Slow start example one RTT 0R 1 one pkt time 1R 1 2 3 2R 2 3 4 6 5 7 3R 4 5 6 7 8 10 12 14 9 11 13 15
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.
Congestion avoidance • Upon receiving ACK • Increase cwnd by 1/cwnd. • This is additive increase. • Why not multiplicative increase? • Growing too fast in equilibrium => oscillations
TCP Congestion Control: Operation cwin timeout threshold threshold time
TCP Retransmission Timer • When segment sent, retransmission timer starts. • If segment ACKed, timer stops. • If time out, segment retransmitted and timer starts again.