170 likes | 259 Views
EEC-484/584 Computer Networks. Lecture 14 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer Networking book). Outline. Reminder: Wiki project#2 due: 4/16 Wednesday Quiz 4: 4/21 Monday TCP
E N D
EEC-484/584Computer Networks Lecture 14 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross’s slides for their Computer Networking book)
Outline • Reminder: • Wiki project#2 due: 4/16 Wednesday • Quiz 4: 4/21 Monday • TCP • Reliable data transfer (ack generation) • Flow control • Congestion control EEC-484/584: Computer Networks
TCP ACK Generation TCP Receiver action Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq. # of next expected byte Immediate send ACK, provided that segment starts at lower end of gap Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Arrival of in-order segment with expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. # . Gap detected Arrival of segment that partially or completely fills gap EEC-484/584: Computer Networks
Receive side of TCP connection has a receive buffer: Speed-matching service: matching the send rate to the receiving app’s drain rate TCP Flow Control Flow control: sender won’t overflow receiver’s buffer by transmitting too much, too fast • App process may be slow at reading from buffer EEC-484/584: Computer Networks
(Suppose TCP receiver discards out-of-order segments) Spare room in buffer = RcvWindow = RcvBuffer-[LastByteRcvd - LastByteRead] Rcvr advertises spare room by including value of RcvWindow in segments Sender limits unACKed data to RcvWindow guarantees receive buffer doesn’t overflow TCP Flow Control EEC-484/584: Computer Networks
Congestion: Informally: “too many sources sending too much data too fast for network to handle” Different from flow control! Manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) Principles of Congestion Control EEC-484/584: Computer Networks
End-end congestion control: no explicit feedback from network congestion inferred from end-system observed loss, delay approach taken by TCP Network-assisted congestion control: routers provide feedback to end systems single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM) explicit rate sender should send at Approaches towards Congestion Control Two broad approaches towards congestion control EEC-484/584: Computer Networks
TCP Congestion Control: Additive Increase, Multiplicative Decrease • Approach: increase transmission rate (window size), probing for usable bandwidth, until loss occurs • Additive increase: increase cwnd every RTT until loss detected • Multiplicative decrease: cut cwnd after loss Saw tooth behavior: probing for bandwidth EEC-484/584: Computer Networks
Sender limits transmission: LastByteSent-LastByteAcked cwnd Roughly, cwnd is dynamic, function of perceived network congestion How does sender perceive congestion? loss event = timeout or 3 duplicate acks TCP sender reduces rate (cwnd) after loss event cwnd rate = Bytes/sec RTT TCP Congestion Control EEC-484/584: Computer Networks
When connection begins, cwnd = 1 MSS Example: MSS = 500 bytes & RTT = 200 msec Initial rate = 25 kBps Available bandwidth may be >> MSS/RTT Desirable to quickly ramp up to respectable rate TCP Slow Start • When connection begins, increase rate exponentially fast until first loss event EEC-484/584: Computer Networks
When connection begins, increase rate exponentially until first loss event: Double cwnd every RTT Done by incrementing cwnd for every ACK received Summary:initial rate is slow but ramps up exponentially fast time TCP Slow Start Host A Host B one segment RTT two segments four segments EEC-484/584: Computer Networks
Q: When should the exponential increase switch to linear? A: When cwnd gets to 1/2 of its value before timeout Implementation: Variable Threshold At loss event, Threshold is set to 1/2 of cwnd just before loss event Congestion Avoidance How to increase cwnd linearly:cwnd (new) = cwnd + mss*mss/cwnd EEC-484/584: Computer Networks
After 3 duplicated ACKs: cwnd is cut in half window then grows linearly But after timeout event: cwnd instead set to 1 MSS window then grows exponentially to a threshold, then grows linearly Congestion Control Philosophy: • 3 dup ACKs indicates network capable of delivering some segments • timeout indicates a “more alarming” congestion scenario EEC-484/584: Computer Networks
Summary: TCP Congestion Control • When cwnd is below Threshold, sender in slow-start phase, window grows exponentially • When cwnd is above Threshold, sender is in congestion-avoidance phase, window grows linearly • When a triple duplicate ACK occurs, Threshold set to cwnd/2 and cwnd set to Threshold • When timeout occurs, Threshold set to cwnd/2and cwnd is set to 1 MSS EEC-484/584: Computer Networks
TCP Sender Congestion Control EEC-484/584: Computer Networks
TCP Sender Congestion Control EEC-484/584: Computer Networks
TCP Congestion Control Slow start Segment lost Repeated acks EEC-484/584: Computer Networks