130 likes | 245 Views
What is TCP?. Connection-oriented reliable transfer No packet loss. How? Uses acknowledgments, retransmission, and TO. Stream paradigm Allows sender to generate a stream of bytes; then divide stream into small segments; and then sends each segment in IP datagram. Flow control
E N D
What is TCP? • Connection-oriented reliable transfer • No packet loss. How? • Uses acknowledgments, retransmission, and TO. • Stream paradigm • Allows sender to generate a stream of bytes; then divide stream into small segments; and then sends each segment in IP datagram. • Flow control • Receiver advertises window that specifies how many additional bytes it can accept.
What is TCP? • TCP connection establishment Send SYN seq=x Receive SYN seq=x Send SYN seq=y, Ack x+1 Receive SYN, Ack Send Ack y+1 Receive Ack • TCP versus UDP
TCP Congestion Control • Question: How does TCP control network congestion? • Specifically, when does TCP increase or decrease its sending rate and how much? • Here, we will study how TCP supports network congestion control.
1. Send up to a window of data 2. Ack for each packet 3. If TO, resend from the oldest unacked 1. Packet arrives faster than output link 3. TO and resend … increase network traffic! Early TCP • Early TCP runs like go-back-n. sender receiver • What if … sender router 2. Queue grows and packet drops Congestion collapse! Throughput becomes so low
Avoid Congestion Collapse? • How can we address the congestion collapse problem? • Can we adopt self-clocking mechanism in TCP? • Self-clocking • A new packet is not put into network until the old packet leaves. • It is called connection in equilibrium.
1 RTT 0R 1 1R 2 3 2R 4 5 6 7 3R 8 10 9 11 12 14 13 15 Initial Start • Goal: Reach equilibrium by opening up the window quickly. • Sender sets cwnd to 1. • As Ack arrives, cwnd is increased by one segment. • Slow start: exponential increase of cwnd.
Congestion Avoidance • After slow start, what happens? Congestion Avoidance ssthresh Slow Start TCP cwnd • We want to ensure that cwnd does not increase exponentially forever. • In congestion avoidance, cwnd is increased by 1/cwnd segments (approx. 1 segment per RTT) for one Ack received (additive increase).
Congestion Avoidance • What if TO occurs? • It indicates network congestion. • Update • ssthresh = max(2, min(cwnd/2, rwnd)) segments • This is multiplicative decrease! • cwnd = 1 • System goes back to slow start. • That’s why CA is called AIMD (Additive Increase Multiplicative Decrease). • AIMD in CA is known to be stable, i.e., converges to a fair share condition.
1. Send segments 0 to 5 2. dupAcks(2) 3. Fast retransmit after 3 dupAcks and go back to SS Can We Do Better? • Usually TO takes long and degrades TCP performance. • Is there a way to learn network congestion earlier than TO? Segment 2 gets lost sender receiver TCP Tahoe (SS, CA, FR)
3 dupAcks Even Better? • In TCP Tahoe, should we go back to SS after fast retransmit? Why? • In addition to packet loss, doesn’t dupAck also indicate that a segment has left the network ? sender receiver Retransmits lost segment Reduces ssthresh by half Reduces cwnd by half Inflates cwnd by one segment for each dupAck (self-clocking) Comes out of this Fast Recovery when it receives ack for lost segment. TCP Reno (SS, CA, Fast Recovery) • Reno tries to keep track of the number of dupAcks to estimate the amount of outstanding data in the net. • What if there are multiple segment losses?
TCP Congestion Control Slow-Start Congestion Avoidance cwnd Additive Increase Multiplicative Decrease (AIMD) ssthresh 1 TCP-Reno 3 DupAck Timeout time new ssthresh = cwnd / 2
Vegas Dream? • So far, all the schemes use Acks to infer packet losses to detect network congestion and devise self-clocking. • Can we estimate expected throughput of a connection and use it for cwnd increase or decrease? • Congestion avoidance • Expected throughput = current cwnd / min RTT • Actual throughput = bytes xmitted / measured RTT • Diff = expected throughput - actual throughput • If Diff < alpha, linear increase of cwnd (good condition) • Else if Diff > beta, linear decrease of cwnd (congestion)
TCP Vegas • Slow start • Exponential increase cwnd every other RTT. • Calculate Diff using the other RTT. • Transition from SS to CA occurs when actual throughput is lower than expected throughput by gamma. • Retransmission • A segment is retransmitted after one dupAck. • This will be helpful when cwnd small or multiple segment losses. • TCP Vegas was popular due to its more accurate estimation. • It was, however, never widely deployed. Why?