TCP Westwood for Wireless מבוא רקע טכני בקרת עומס ב- TCP TCP על קשר אלחוטי שיפור תפוקה עם פרוטוקול TCP Westwood סיכום.1.2.3.4.5 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 1
TCP Over Wireless Wireless internet Widely used Routine workflow Requires TCP/IP Problem TCP handles packet loss as congestion Lost packet bit error or congestion TCP designed for cable (BER < 1-9 ) Congestion slow packet transmission Wireless BER 1-3 Many random errors without congestion No need (or efficacy) in lower packet rate Westwood Modified TCP SEQ/ACK mechanism Improved treatment of random errors Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 2
Congestion Control Flow control Avoid overflow in TCP receiver buffer Congestion control Avoid overflow in router buffers Flow Control TCP Buffer Router Buffer Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 3
Slow-Start Congestion window (cwnd) Source window Maximum number of "unacked" bytes Initial cwnd = 1 MSS (maximum segment size) Data rate = 1 MSS / RTT RTT Sender ACK 1 MSS Receiver ACK 2 MSS Exponential growth On each ACK cwnd cwnd + size of data ACKed if (cwnd > maximum cwnd = destination window) cwnd max cwnd if (ACK timeout) Segment size threshold (ssthresh) last cwnd cwnd initial cwnd = 1 MSS Timeout ACK 3 MSS Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 4
RTT and Buffer Errors Round Trip Time RTT = data transmit time + send buffer times + ACK transmit time + ACK buffer times Buffer time ~ typical service time buffer level RTT = random variable (rise / fall sharply) RTT Sender SEQ ACK Receiver Buffer time in TCP Timeout Buffer level RTT > RTO (retransmit timeout) Packet considered lost Out-of-order packet Buffer level RTT(packet k) > RTT(packet k+1) Receiver will send cumulative ACK if OOO packet not lost Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 5
RTT and Congestion Buffer error condition Sender Receiver Buffer level RTT > RTO for time T error Isolated error T error < time between packets Buffer empties before next packet No need to lower transmission rate RTT SEQ ACK Congestion T error > time between packets Multiple buffer errors Lower transmission rate to prevent buffer errors Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 6
Congestion Avoidance TCP Reno protocol Slow start phase On (ACK && cwnd < ssthresh) cwnd cwnd + size of data ACKed On (ACK timeout) ssthresh cwnd cwnd initial cwnd = 1 MSS RTO 2 * RTO Congestion avoidance phase On (ACK && cwnd > ssthresh) cwnd cwnd + 1 MSS Fast retransmit with fast recovery On (3 dupacks) ssthresh cwnd cwnd cwnd / 2 Retransmit lost packet Wait 1 RTT continue sending For > 3 dupacks cwnd++ on each new dupack Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 7
Error-Free Transmission 1 8 ACK SEQ cwnd 6 Latency = 2.77 Utilization = 34.2% goodput = 34.2% 4 2 Slow Start Collision Avoidance 1 2 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 8
Congestion Longer RTT 1 8 ACK (no congestion) SEQ (no congestion) cwnd (no congestion) ACK SEQ cwnd 6 4 Latency = 3.7 Latency (lossless) = 2.77 Excess latency = 33.57% Utilization = 25.6% goodput = 25.6% 2 1 2 3 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 9
1 Lost Packet Early 1 8 ACK SEQ cwnd 6 Latency = 6.87 Latency (lossless) = 2.77 Excess latency = 148.1% Utilization = 14.% goodput = 13.8% 4 2 Packet 3 lost Timeout 2 4 6 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 1
Steady State 1 8 ACK SEQ cwnd 6 Latency = 5.32 Latency (lossless) = 2.77 Excess latency = 92.6% Utilization = 2.8% goodput = 17.8% 4 2 2 4 Packet 9 lost 3 dupacks Packet 29 lost 3 dupacks Packet 49 lost 3 dupacks Packet 69 lost 3 dupacks Packet 89 lost 3 dupacks Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 11
The Trouble with Wireless 1 Variations in transmission medium Multiple correlated packet losses + bit errors TCP interprets as serious congestion timeouts + slow start Fading channels Refraction Reflection Absorption Multipath refraction reflection absorption medium EMI (electromagnetic interference) Other users Other radio equipment Other radiating equipment station station station station Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 12
The Trouble with Wireless 2 Mobility drops User moves between wireless domains Adds delays + buffers + dupacks + timeouts MSC MSC RNC-1 RNC-2 Clusters RNC-1 RNC-2 1 2 3 4 Node-B Cells 1 2 3 4 TCP request in cell 1 TCP response in cell 4 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 13
The Trouble with Wireless 3 Link asymmetry Upstream channel slower than downstream channel Larger buffer longer buffer delay lower average B/s ACK compression Base Mobile ACKs delayed in upstream buffer RTT B/s All ACKs arrive together cwnd sharply Sender floods forward channel buffer Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 14
The Trouble with Wireless 4 MACA in WiFi Required to prevent hidden node problem RTS RTS CTS CTS A B C D E F DATA ACK MAC MACA overhead RTS+CTS+ACK MAC time TCP ACK time TCP WiFi ACK delay = 2 wired TCP ACK delay RTT Timeouts cwnd cwnd segment size B/s= RTT RTT and cwnd B/s Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 15
TCP Westwood Reference Saverio Mascolo, ClaudioCasetti, MarioGerla, M. Y.SanadidiandRenWang, TCP Westwood: Bandwidth Estimation for Enhanced Transport over Wireless Links(21) ACM SIGMOBILE. Modifies TCP sender Not dependent on negotiation with TCP sender Not dependent on support in router or receiver Estimates available bandwidth Counts dupacks as successful traffic On packet loss set cwnd = available bandwidth Improves on Reno cwnd = cwnd / 2 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 16
Average Transmission Rate in Reno Senders must measure bandwidth estimate R Know cwnd packets sent R= = Measure <RTT> time to ACK cwnd RTT TCP average RTT (simplified) R'= last RTT measurement SRTT (1 - α) * SRTT + α * R' RTO max(1 sec, SRTT) α = 1/8 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 17
Noise Filtering in Westwood Model bandwidth as noisy signal BW meas (time) = BW (time) + noise (time) Filter out noise with low-pass filter H 2πift x t X f e df ( ) = ( ) 2πift y t H f X f e df ( ) = ( ) ( ) ( f) = 1 f 1+ f 2 Fourier transform input signal Filter in frequency domain Low-pass filter Output signal "cut off" at frequency f Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 18
Low Pass Filter Example Filter input Filter output 1 x( t) = sin( 2π t) + sin( 2π t) 1 1 1 1 y t t t 2 2 1 1 1 1+ 1+ 2 2 ( ) = sin( 2π ) + sin( 2π ) ( ) ( ) x t y t 1 H( f) =, f 2 = f 1+ f 2 X ( f ) 1 1 f Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 19
DSP Low Pass Filter for Sampled Signals Sample input at times t k k, k =,1, 2,... t = t t b k k k 1 Sample stream from input dk dk number of bytes ACKed = = =, k =,1, 2,... t t t time of ACK time of previous ACK k k k 1 Output stream (Tustin approximation) ˆ ˆ b + b bk =αkbk 1+ αk 2 2τ tk α k = < 1, 2τ> t 2τ+ t Cutoff frequency τ= 1 f k k k 1 ( 1 ) k parameter related to Nyquist sampling theorem Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 2
Bandwidth Sampling inwestwind Bandwidth sample b k dk dk number of bytes ACKed = = = t t t time of ACK time of previous ACK k k k 1 No ACK for time > 2τ insert "virtual ACK" Insert d = b at time= t + 2τ k k k 1 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 21
Westwood Packet Counting Example Packet transmission times 1 2 3 4 5 6 7 8 5 9 t t 1 t 2 t 3 t 6 Time ACK Arrived at Receiver Packets for BWE Counted dupack BWE t 1 1 1 1 1 /(t 1 t ) t 2 3 2 + 3 2 2 /(t 2 t 1 ) t 3 4 4 1 1 /(t 3 t 2 ) t 4 4 6 1 1 1 /(t 4 t 3 ) t 5 4 7 1 2 1 /(t 5 t 4 ) t 6 4 8 1 3 1 /(t 6 t 5 ) t 7 9 5 + 9 2 2 /(t 7 t 6 ) ACK jumps to 9 from 4 = 5 but 3 ACKs (6, 7, 8) already counted as dupacks Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 22
Westwood ACK Counter (for BWE) newack = ACK prevack ; Packets ACKed by new ACK // if (newack = 1) do nothing No error condition report 1 ACK if (newack = ) count++ ; newack = 1 ; if (newack > 1) if (count >= newack) count = count newack + 1 ; newack = 1 ; else if (count < newack) newack = newack - count ; count = ; ACK "stuck" on old value (dupack) Increment dupack counter Count 1 dupack ACK advances Not all arrived packets ACKed Remove ACKed from dupack count Count as additional dupack All packets ACKed in order ReportACKed counted (new ACKs) Zero dupack counter prevack = ACK ; return(newack); Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 23
Westwood Scenario 1 No Errors Receive 1 2,3 4,5,6,7 8,9,1,11,12,13,14,15 ACK 1 3 7 11 15 newack = 1 2 4 4 4 newack = ACK prevack ; 1 2 4 4 4 if (newack = ) count++ ; newack = 1 ; if (newack > 1) if (count >= newack) count = count newack + 1 ; newack = 1 ; else if (count < newack) newack = newack - count ; count = ; 2 4 4 4 prevack = ACK ; 1 3 7 11 15 return(newack); Total = 15 1 2 4 4 4 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 24
Westwood Scenario 2 1 Packet Out-of-Order Receive 1 2,3 5,6,7,4 8,9,1,11,12,13,14,15 ACK 1 3 3 3 3 7 11 15 newack = ACK prevack ; 1 2 4 4 4 if (newack = ) count++ ; newack = 1 ; 1 1 2 1 3 1 if (newack > 1) if (count >= newack) count = count newack + 1 ; newack = 1 ; else if (count < newack) newack = newack - count ; count = ; 2 1 4 4 prevack = ACK ; 1 3 3 3 3 7 11 15 return(newack); Total = 15 1 2 1 1 1 1 4 4 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 25
Westwind Congestion Control Reno slow start On (ACK && cwnd < ssthresh) cwnd cwnd + size of data ACKed Reno congestion avoidance On (ACK && cwnd > ssthresh) cwnd cwnd + 1 Modified fast recovery On 3 dupacks ssthresh = BWE * RTT_min / segment_size if (cwnd > ssthresh) cwnd = ssthresh Modified timeout ssthresh = BWE * RTT_min / segment_size if (ssthresh < 2) ssthresh = 2 cwnd = 1 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 26
Westwood Performance Throughput Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 27
Loss Example Reno After 1 packets cwnd = 32 ssthresh = 16 Transmit 32 packets 11 132 packet 129 lost Round cwnd Packets ACK 1 32 11 132 3 dupacks = 129 2 16 129 133 (cumulative ACK) 3 17 133 149 15 4 18 15 167 168 Performance Total time to ACK = 4 RTT Average BW = (67 packets b bits per packet) / (4 RTT) For RTT = 1 msec with 1, bits per packet Average BW = 1.675 Mbps Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 28
Reno versus Westwood Example After 1 packets cwnd = 32 Transmit 32 packets 11 132 packet 129 lost Round BWE cwnd Packets ACK 1 32 b / RTT 32 11 132 3 dupacks = 129 2 32 b / RTT 32 129 133 (cumulative ACK) 3 32 b / RTT 32 133 164 165 4 32 b / RTT 32 165 196 197 Comparison of round 2 Reno: cwnd cwnd / 2 = 4 Westwood: ssthresh = cwnd BWE = 32 Performance Total time to ACK = 4 RTT Average BW = 2.4 Mbps = 43% (96/67) better than Reno ( ) ( ) ( 31 ) + ( 32 ) bˆ =α 32 + 1 α 2 2 2 1 α = 2 2 32 32 2 Seminar in Computer Networks and Distributed Systems Hadassah College Spring 215 TCP over Wireless Networks Dr. Martin Land 29