Communication Networks Recitation 9 Fairness TCP Congestion Control

  • Slides: 19
Download presentation
Communication Networks Recitation 9 Fairness & TCP Congestion Control Comnet 2006 1

Communication Networks Recitation 9 Fairness & TCP Congestion Control Comnet 2006 1

Max-Min Fairness • The intuition: to maximize the bandwidth allocated to the session with

Max-Min Fairness • The intuition: to maximize the bandwidth allocated to the session with the minimum allocation • More formally: to maximize the allocation of each session i under constrain that an increase in i’s allocation doesn’t cause a decrease in some other session allocation with the same or smaller rate than i Comnet 2006 2

Example of max-min fair flow Session 2 Session 3 Session 1 Capacity=1 Session 0

Example of max-min fair flow Session 2 Session 3 Session 1 Capacity=1 Session 0 Maximal fair flow division will be to give for the sessions 0, 1, 2 a flow rate of 1/3 and for the session 3 a flow rate of 2/3 Comnet 2006 3

TCP Overview • Connectionoriented • Byte-stream – – app writes bytes TCP sends segments

TCP Overview • Connectionoriented • Byte-stream – – app writes bytes TCP sends segments – app reads bytes • Reliable data transfer • Full duplex • Flow control: keep sender from overrunning receiver • Congestion control: keep sender from overrunning network Comnet 2006 4

TCP Segment Structure 32 bits URG: urgent data (generally not used) ACK: ACK #

TCP Segment Structure 32 bits URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection management (reset, setup teardown commands) Also in UDP source port # dest port # sequence number acknowledgement number head not UA P R S F len used checksum rcvr window size ptr urgent data Options (variable length) counting by bytes of data (not segments!) # bytes rcvr willing to accept application data (variable length) Comnet 2006 5

Connection Establishment Active participant (client) Passive participant (server) SYN, Sequ ence. N um =

Connection Establishment Active participant (client) Passive participant (server) SYN, Sequ ence. N um = x K AC + N Y S ACK, = y, m u nce. N e 1 u q =x + , Se t en m g d e wl o Ackno wledg ment Comnet 2006 =y+1 6

Connection Termination Active participant (server) Passive participant (client) FIN, S eque nce. N um

Connection Termination Active participant (server) Passive participant (client) FIN, S eque nce. N um = x x+1 = t n me g d e l y ow = n k m c u A nce. N e u q Se FIN, Ackno wledg ment =y + 1 Comnet 2006 7

Detecting Congestion • Packet drops indicate congestion – Is that really true? – Why

Detecting Congestion • Packet drops indicate congestion – Is that really true? – Why does it work? Packet Dst Src Drop Ack Timeout! No Ack = Congestion! Comnet 2006 9

Controlling Congestion – The Effect of Window Size • Note that sender’s window is

Controlling Congestion – The Effect of Window Size • Note that sender’s window is equal to the number of sender packets in flight (in the network). Window Source Destination A Window’s worth of pa ckets X acks X more p ack 2006 ets Comnet 10

Controlling Congestion • Reduce window less packets in the network • Increase window more

Controlling Congestion • Reduce window less packets in the network • Increase window more packets in the network • Idea: Concept of a congestion window – window is smaller when congestion is larger and vice versa Comnet 2006 11

Additive Increase, Multiplicative Decrease • Each time a packet drop occurs, slash window size

Additive Increase, Multiplicative Decrease • Each time a packet drop occurs, slash window size in half (multiplicative decrease) – Multiplicative decrease is necessary to avoid congestion • When no losses are observed, gradually increase window size (additive increase) Comnet 2006 12

Additive Increase Src D A D D A A D D D A A

Additive Increase Src D A D D A A D D D A A A Dest Comnet 2006 13

Leads to the TCP “sawtooth” Rate Timeouts halved Could take a long time to

Leads to the TCP “sawtooth” Rate Timeouts halved Could take a long time to get started! Comnet 2006 t 14

“Slow Start” Designed to cold-start connection quickly at startup or if a connection has

“Slow Start” Designed to cold-start connection quickly at startup or if a connection has been halted (e. g. window dropped to zero, or window full, but ACK is lost). How it works: increase cwnd by 1 for each ACK received. Src 1 D 2 A D D 4 A A D D 8 D A A A Dest Comnet 2006 15

Slow Start Rate 3 Dupacks halved Exponential “slow start” Slow start in operation until

Slow Start Rate 3 Dupacks halved Exponential “slow start” Slow start in operation until it reaches half of t cwnd. previous Why is it called slow-start? Because TCP originally had no congestion control mechanism. The source would just start by sending a whole window’s worth of data. Comnet 2006 16

Fast Retransmit & Recovery • Upon 3 duplicate ACKs, TCP retransmits. • Do not

Fast Retransmit & Recovery • Upon 3 duplicate ACKs, TCP retransmits. • Do not enter slowstart. Sender Receiver Packet 1 Packet 2 Packet 3 ACK 1 Packet 4 ACK 2 Packet 5 ACK 2 Packet 6 ACK 2 Retransmit packet 3 ACK 6 Comnet 2006 17

TCP Vegas • Uses congestion avoidance instead of congestion control – Reno: Congestion control

TCP Vegas • Uses congestion avoidance instead of congestion control – Reno: Congestion control React to congestion after it occurs – Vegas: Congestion avoidance Predict and avoid congestion before it occurs Comnet 2006 19

Observation • Packet accumulation in the network can be inferred by monitoring RTT and

Observation • Packet accumulation in the network can be inferred by monitoring RTT and sending rate cwnd Send ing R ate Overloaded Bottleneck Link Router Sending Rate = cwnd / RTT Comnet 2006 20

TCP Vegas Congestion Control • Base. RTT is the minimum of all measured RTTs

TCP Vegas Congestion Control • Base. RTT is the minimum of all measured RTTs (commonly the RTT of the first packet) • If not overflowing the connection, then Expect. Rate = Congestion. Window/Base. RTT • Source calculates Actual. Rate once per RTT • Source compares Actual. Rate with Expect. Rate Diff = Expected. Rate - Actual. Rate if Diff < a increase Congestion. Window linearly else if Diff > b decrease Congestion. Window linearly else leave Congestion. Window unchanged Comnet 2006 21