Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Transport Layer 3-1 Principles of Congestion Control 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) a top-10 problem! Transport Layer 3-2
Causes/costs of congestion: scenario 1 two senders, two receivers one router, infinite buffers Host B Host A λ in : original data unlimited shared output link buffers λ out no retransmission large delays when congested maximum achievable throughput Transport Layer 3-3 Causes/costs of congestion: scenario 2 one router, finite buffers sender retransmission of lost packet Host A λ in : original data λ' in : original data, plus retransmitted data λ out Host B finite shared output link buffers Transport Layer 3-4
Causes/costs of congestion: scenario 2 Ideal case: only send a packet if buffer available: More reasonable case: λ = λ' = in in λ out retransmit only packets that where dropped: λ < λ' in in Realistic case: retransmit packets that where either dropped or delayed: λ < λ' in in unnecessary retransmissions! Even larger offered load costs of congestion: more work (retrans) for given goodput unneeded retransmissions: link carries multiple copies of pkt Transport Layer 3-5 Causes/costs of congestion: scenario 3 four senders multihop paths timeout/retransmit Q: what happens as λ in and increase? λ in Host A λ in : original data λ' in : original data, plus retransmitted data finite shared output link buffers λ out Host B Transport Layer 3-6
Causes/costs of congestion: scenario 3 H o s t A λ o u t H o s t B Another cost of congestion: when packet dropped, any upstream transmission capacity used for that packet was wasted! Transport Layer 3-7 Approaches towards congestion control Two broad approaches towards congestion control: 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 Transport Layer 3-8
Case study: ATM ABR congestion control ABR: available bit rate: elastic service if sender s path underloaded : sender should use available bandwidth if sender s path congested: sender throttled to minimum guaranteed rate RM (resource management) cells: sent by sender, interspersed with data cells bits in RM cell set by switches ( network-assisted ) NI bit: no increase in rate (mild congestion) CI bit: congestion indication RM cells returned to sender by receiver, with bits intact Transport Layer 3-9 Case study: ATM ABR congestion control two-byte ER (explicit rate) field in RM cell congested switch may lower ER value in cell sender send rate thus minimum supportable rate on path EFCI bit in data cells: set to 1 in congested switch if data cell preceding RM cell has EFCI set, sender sets CI bit in returned RM cell Transport Layer 3-10
TCP Congestion Control end-end control (no network assistance) sender limits transmission: congwin congwin is dynamic, function of perceived network congestion w segments, each with MSS bytes sent in one RTT: throughput = w * MSS RTT Bytes/sec Transport Layer 3-11 TCP congestion control: probing for usable bandwidth: ideally: transmit as fast as possible (Congwin as large as possible) without loss increase Congwin until loss event (congestion) loss event: decrease Congwin, then begin probing (increasing) again How does sender perceive congestion? Timeout 3 duplicate acks two phases slow start congestion avoidance important variables: Congwin threshold: defines threshold between two slow start phase, congestion control phase Transport Layer 3-12
TCP Slowstart Slowstart algorithm initialize: Congwin = 1 for (each segment ACKed) Congwin++ until (loss event OR CongWin > threshold) RTT Host A Host B one segment two segments four segments Double congestion window every RTT (exponential increase) loss event: timeout (Tahoe TCP) and/or or three duplicate ACKs (Reno TCP) time Transport Layer 3-13 TCP Congestion Avoidance: Tahoe TCP Tahoe Congestion avoidance /* slowstart is over */ /* Congwin > threshold */ Until (loss event) { every w segments ACKed: Congwin++ } threshold = Congwin/2 Congwin = 1 perform slowstart Transport Layer 3-14
TCP Congestion Avoidance: Reno three duplicate ACKs (Reno TCP): some segments are getting through correctly! don t overreact by decreasing window to 1 as in Tahoe decrease window size by half TCP Reno Congestion avoidance /* slowstart is over */ /* Congwin > threshold */ Until (loss event) { every w segments ACKed: Congwin++ } threshold = Congwin/2 If (loss detected by timeout) { Congwin = 1 perform slowstart } If (loss detected by triple duplicate ACK) Congwin = Congwin/2 Transport Layer 3-15 TCP Reno versus TCP Tahoe: 14 congestion window size (segments) 12 10 8 6 4 2 0 threshold 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Transmission round Series1 TCP Series2 TCP Tahoe Reno Figure 3.49 (revised): Evolution of TCP s Congestion window (Tahoe and Reno) Transport Layer 3-16
TCP AIMD additive increase: increase CongWin by 1 MSS every RTT in the absence of loss events: probing multiplicative decrease: cut CongWin in half on loss event 24 Kbytes congestion window 16 Kbytes 8 Kbytes Long-lived TCP connection time Transport Layer 3-17 TCP Fairness Fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K TCP connection 1 TCP connection 2 bottleneck router capacity R Transport Layer 3-18
Why is TCP fair? Two competing sessions: Additive increase gives slope of 1, as throughout increases multiplicative decrease decreases throughput proportionally R equal bandwidth share Connection 2 throughput Connection 1 throughput loss: decrease window by factor of 2 congestion avoidance: additive increase loss: decrease window by factor of 2 congestion avoidance: additive increase R Transport Layer 3-19 Fairness (more) Fairness and UDP Multimedia apps often do not use TCP do not want rate throttled by congestion control Instead use UDP: pump audio/video at constant rate, tolerate packet loss Research area: TCP friendly Fairness and parallel TCP connections nothing prevents app from opening parallel cnctions between 2 hosts. Web browsers do this Example: link of rate R supporting 9 cnctions; new app asks for 1 TCP, gets rate R/10 new app asks for 11 TCPs, gets R/2! Transport Layer 3-20
TCP Throughput (macroscopic view) Transfer of a very large file long-lived TCP connection Network is not too congested AIMD in steady state W bytes W/2 bytes congestion window Each transmission period send w bytes time Throughput = 0.75 W RTT Transport Layer 3-21 Chapter 3: Summary principles behind transport layer services: multiplexing, demultiplexing reliable data transfer flow control congestion control instantiation and implementation in the Internet UDP TCP Next: leaving the network edge (application, transport layers) into the network core Transport Layer 3-22