1.61k likes | 1.74k Views
Special Topics on Wireless Ad-hoc Networks. Lecture 11: TCP on Wireless Network. University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani. Covered topics. How to run applications on wireless network? Transport layer References Chapter 4 of the book
E N D
Special Topicson Wireless Ad-hoc Networks Lecture 11: TCP on Wireless Network University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Computer Network
Covered topics • How to run applications on wireless network? • Transport layer • References • Chapter 4 of the book • Alex C. Snoeren and Hari Balakrishnan, “An End-to-End Approach to Host Mobility” • Hari Balakrishnan, Venkata N. Padmanabhan, Srinivasan Seshan and Randy H. Katz, “A Comparison of Mechanisms for Improving TCP Performance over Wireless Links” Computer Network
Outline • TCP basics • Layer 4 consideration: • Impact of transmission errors on TCP performance • Timeout • Approaches to improve TCP performance • Approaches to improve application performance Computer Network
TCP Basics • Reliable ordered delivery • End-to-end semantics • Acknowledgements sent to TCP sender confirm delivery of data received by TCP receiver • Ack for data sent only after data has reached receiver • TCP window flow control is “self-clocking” • New data sent when old data is ack’d • Helps maintain “equilibrium” • Implements congestion avoidance and control Computer Network
Window Based Flow Control • TCP sender sets retransmission timer for only one packet. If ack for the timed packet is not received the packet is assumed to be lost • RTO dynamically calculated • Congestion window size bounds the amount of data that can be sent per round-trip time • Throughput <= W / RTT Computer Network
Retransmission Timeout (RTO) • RTO = mean + 4 mean deviation • Standard deviation s : s = average of (sample – mean) • Mean deviation d = average of |sample – mean| • Mean deviation easier to calculate than standard deviation • Mean deviation is more conservative: d >= s • Large variations in the RTT increase the deviation, leading to larger RTO 2 2 Computer Network
Timeout Granularity • RTT is measured as a discrete variable, in multiples of a “tick” • 1 tick = 500 ms in many implementations • smaller tick sizes in more recent implementations (e.g., Solaris) • RTO is at least 2 clock ticks • Double RTO on each timeout (Exponential backoff) Computer Network
Congestion Collapse and Efficiency • knee – point after which • throughput increasesslowly • delay increases quickly • cliff – point after which • throughput decreases quicklyto zero (congestion collapse) • delay goes to infinity • Congestion avoidance • stay at knee • Congestion control • stay left of (but usually close to) cliff • Note (in an M/M/1 queue) • delay =1/(1 – utilization) knee cliff congestion collapse Throughput under utilization over utilization saturation Load Delay Load Computer Network
Goals • Operate near the knee point • Remain in equilibrium • How to maintain equilibrium? • Don’t put a packet into network until another packet leaves. How do you do it? • Use ACK: send a new packet only after you receive and ACK. Why? • Maintain number of packets in network “constant” Computer Network
Congestion Control • TCP assume packet loss is due to congestion • On packet loss, reduces the congestion window and consequently amount of data sent per RTT • throughput may decrease Computer Network
Congestion Avoidance and Control Slow Start • initially, congestion window size cwnd = 1 MSS (maximum segment size) • increment window size by 1 MSS on each new ack • slow start phase ends when window size reaches the slow-start threshold • cwnd grows exponentially with time during slow start Computer Network
12 8 11 10 9 7 Fast Retransmit Mechanism • Timeouts can take too long • Fast retransmit in case of packet loss • How to identify packet loss? Duplicated Acks. • Dupacks may be generated due to • packet loss, or • out-of-order packet delivery • Assumes packet loss in case of three consecutive dupacks 3 dupacks are generated if a packet is delivered at least 3 places beyond its in-sequence location Fast retransmit useful only if lower layers deliver packets “almost ordered” ---- otherwise, unnecessary fast retransmit Computer Network
Congestion avoidance Slow start threshold Slow start Congestion Avoidance • On each new ack, increase cwnd by 1/cwnd packets • cwnd increases linearly with time during congestion avoidance Example assumes that acks are not delayed Computer Network
Congestion Control -- Timeout • On a timeout, the congestion window is reduced to the initial value of 1 MSS • The slow start threshold is set to half the window size before packet loss • more precisely, ssthresh = maximum of min(cwnd,receiver’s advertised window)/2 and 2 MSS • Slow start is initiated Computer Network
After timeout cwnd = 20 ssthresh = 10 ssthresh = 8 Computer Network
Fast recovery • Fast retransmit occurs when multiple (>= 3) dupacks come back • Fast recovery follows fast retransmit • Different from timeout : slow start follows timeout • timeout occurs when no more packets are getting across • fast retransmit occurs when a packet is lost, but latter packets get through • ack clock is still there when fast retransmit occurs • no need to slow start Computer Network
Fast Recovery • ssthresh = min(cwnd, receiver’s advertised window)/2 (at least 2 MSS) • retransmit the missing segment (fast retransmit) • cwnd = ssthresh + number of dupacks • when a new ack comes: cwnd = ssthreh • enter congestion avoidance Congestion window cut into half Computer Network
After fast recovery Receiver’s advertized window After fast retransmit and fast recovery window size is reduced in half. Computer Network
Fast Recovery Fast recovery can result in a timeout with multiple losses per RTT • TCP New-Reno • stay in fast recovery until all packet losses in window are recovered • can recover 1 packet loss per RTT without causing a timeout • Selective Acknowledgements (SACK)[mathis96rfc2018] • provides information about out-of-order packets received by receiver • can recover multiple packet losses per RTT Computer Network
Outline • TCP basics • Impact of transmission errors on TCP performance • Approaches to improve TCP performance • Classification • Discussion of selected approaches Computer Network
Random Errors • If number of errors is small, they may be corrected by an error correcting code • Excessive bit errors result in a packet being discarded, and Dup Acks. • Dups Acks cause Fast retransmit which results in • retransmission of lost packet • reduction in congestion window • Reducing congestion window in response to errors is unnecessary • Reduction in congestion window reduces the throughput Computer Network
Congestion Response to Errors • On a CDMA channel, errors occur due to interference from other user, and noise • Interference due to other users is an indication of congestion. If such interference causes transmission errors, it is appropriate to reduce congestion window • If noise causes errors, it is not appropriate to reduce window • When a channel is in a bad state for a long duration, it might be better to let TCP backoff, so that it does not unnecessarily attempt retransmissions while the channel remains in the bad state. Computer Network
Burst Errors May Cause Timeouts • If a wireless link remains unavailable for extended duration, • a window worth of data may be lost • Timeout might occur • Timeout results in slow start • Slow start reduces congestion window to 1 MSS, which reduces throughput • Unfortunately, TCP cannot distinguish between packet losses due to congestion and transmission errors Computer Network
Improving TCP How to improve performance? • Hide error losses from the sender • Not reduce congestion window • Let sender determine cause of packet loss • if it is due to errors, it will not reduce congestion window. where modifications are needed? • At the sender node • At the receiver node • At intermediate node(s) • Combinations of the above Computer Network
Ideal Behavior • Ideal TCP behavior: TCP sender should retransmit a packet lost due to transmission errors, without taking any congestion control actions • Ideal TCP typically not realizable • Ideal network behavior: Transmission errors should be hidden from the sender -- the errors should be recovered transparently and efficiently • Proposed schemes attempt to approximate one of the above two ideals Computer Network
Various Schemes • Link level mechanisms • Split connection approach • TCP-Aware link layer • TCP-Unaware approximation of TCP-aware link layer • Explicit notification • Receiver-based discrimination • Sender-based discrimination Computer Network
Link Layer Mechanisms • Forward Error Correction (FEC) • FEC incurs overhead even when errors do not occur • Adaptive FEC schemes can reduce the overhead by choosing appropriate FEC dynamically • Link level retransmission in case of error in the link layer. • FEC to correct a small number of errors • link level retransmission when FEC capability is exceeded Computer Network
application application application transport transport transport network network network rxmt link link link physical physical physical wireless Link Level Retransmissions Link layer state TCP connection Computer Network
Link Level RetransmissionsIssues • How many times to retransmit at the link level before giving up? • Finite bound -- semi-reliable link layer • No bound -- reliable link layer • What triggers link level retransmissions? • Link layer timeout mechanism • Link level acks (negative acks, dupacks, …) • Other mechanisms (e.g., Snoop, as discussed later) • How much time is required for a link layer retransmission? • Small fraction of end-to-end TCP RTT • Large fraction/multiple of end-to-end TCP RTT Computer Network
Link Level RetransmissionsIssues • Retransmissions can cause head-of-the-line blocking • Receiver 1 may be in a bad state, retransmissions to receiver 1 are lost, and also block a packet from being sent to receiver 2 • Should the link layer deliver packets as they arrive, or deliver them in-order? • Link layer may need to buffer packets and reorder if necessary so as to deliver packets in-order Receiver 1 Receiver 2 Base station Computer Network
Link Level Retransmissions • The sender’s Retransmission Timeout (RTO) is a function of measured RTT (round-trip times) • Link level retransmits increase RTT, therefore, RTO • If errors not frequent, RTO will not account for RTT variations due to link level retransmissions • When errors occur, the sender may timeout & retransmit before link level retransmission is successful • Sender and link layer both retransmit • Duplicate retransmissions (interference) waste wireless bandwidth • Timeouts also result in reduced congestion window Computer Network
A More Accurate Picture • With large RTO granularity, interference is unlikely, if time required for link-level retransmission is small compared to TCP RTO • Standard TCP RTO granularity is often large • Minimum RTO (2*granularity) is large enough to allow a small number of link level retransmissions, if link level RTT is relatively small • Interference due to timeout not a significant issue when wireless RTT small, and RTO granularity large. Computer Network
A More Accurate Picture • Frequent errors increase RTO significantly on slow wireless links • RTT on slow links large, retransmissions result in large variance, pushing RTO up • Likelihood of interference between link layer and TCP retransmissions smaller • But congestion response will be delayed due to larger RTO • When wireless losses do cause timeout, much time wasted Computer Network
A More Accurate Picture • Timeout interval may actually be larger than RTO • Retransmission timer reset on an ack • If the ack’d packet and next packet were transmitted in a burst, next packet gets an additional RTT before the timer will go off data ack 1 2 Timeout = RTO Reset, Timeout = RTO Effectively, Timeout = RTT of packet 1 + RTO Computer Network
Large TCP Retransmission Timeout Intervals • Good for reducing interference with link level retransmits • Bad for recovery from congestion losses • Need a timeout mechanism that responds appropriately for both types of losses • Open problem Computer Network
Link Level Retransmissions • Selective repeat protocols can deliver packets out of order • Significantly out-of-order delivery can trigger TCP fast retransmit • Redundant retransmission from TCP sender • Reduction in congestion window • Example: Receipt of packets 3,4,5 triggers dupacks Lost packet Retransmitted packet 6 2 5 4 3 2 1 Computer Network
Link Level RetransmissionsIn-order delivery • To avoid unnecessary fast retransmit, link layer using retransmission should attempt to deliver packets “almost in-order” 6 5 4 3 2 2 1 6 5 2 4 3 2 1 Computer Network
Link Level RetransmissionsIn-order delivery • Not all connections benefit from retransmissions or ordered delivery • audio • Need to be able to specify requirements on a per-packet basis • Should the packet be retransmitted? How many times? • Enforce in-order delivery? • Need a standard mechanism to specify the requirements • open issue (IETF PILC working group) Computer Network
Adaptive Link Layer Strategies Adaptive protocols attempt to dynamically choose: • FEC code • retransmission limit • frame size Computer Network
20 ms 1 ms 10 Mbps 2 Mbps Link Layer Retransmissions 2 Mbps wireless duplex link with 1 ms delay Exponential error model No congestion losses Computer Network
Link Layer Schemes:Summary When is a reliable link layer beneficial to TCP performance? • if it provides almost in-order delivery • TCP retransmission timeout large enough to tolerate additional delays due to link level retransmits Also • Hide wireless losses from TCP sender • Link layer modifications needed at both ends of wireless link • TCP need not be modified Computer Network
Split Connection Approach • TCP connection is broken into two connections: the wired and wireless parts • if wireless link is not last on route, then more than two TCP connections may be needed • FH - BS connection : standard TCP • BS - MH connection : selective repeat protocol on top of UDP • FH-MH = FH-BS + BS-MH FH BS MH Fixed Host Base Station Mobile Host Computer Network
application application application rxmt transport transport transport network network network link link link physical physical physical wireless Split Connection Approach • Split connection results in independent flow control for the two parts Per-TCP connection state TCP connection TCP connection Computer Network
Split Connection Approach : Other Variations • Asymmetric transport protocol (Mobile-TCP) Low overhead protocol at wireless hosts, and higher overhead protocol at wired hosts • smaller headers used on wireless hop (header compression) • simpler flow control - on/off for MH to BS transfer • MH only does error detection, BS does error correction too • No congestion control over wireless hop Computer Network
Split Connection Approach : Other Variations • Mobile-End Transport Protocol • Terminate the TCP connection at BS • TCP connection runs only between BS and FH • BS pretends to be MH (MH’s IP functionality moved to BS) • BS guarantees reliable ordered delivery of packets to MH • BS-MH link can use any arbitrary protocol optimized for wireless link Computer Network
Split Connection Approach : • Hides transmission errors from sender • Primary responsibility at base station • If specialized transport protocol used on wireless, then wireless host also needs modification • In case of Mobile host, the state of BS can be transferred. Computer Network
Split Connection Approach : Advantages • BS-MH connection can be optimized independent of FH-BS connection • Different flow / error control on the two connections • Local recovery of errors • Faster recovery due to relatively shorter RTT on wireless link • Good performanceachievable using appropriate BS-MH protocol • Standard TCP on BS-MH performs poorly when multiple packet losses occur per window (timeouts can occur on the BS-MH connection, stalling during the timeout interval) • Selective acks improve performance for such cases Computer Network
39 40 38 37 FH BS MH 36 40 Split Connection Approach : Disadvantages • End-to-end semanticsviolated • ack may be delivered to sender, before data delivered to the receiver • May not be a problem for applications that do not rely on TCP for the end-to-end semantics Computer Network
39 40 38 37 FH BS MH 36 40 Split Connection Approach : Disadvantages • BS retains hard state BS failure can result in loss of data (unreliability) • If BS fails, packet 40 will be lost • Because it is ack’d to sender, the sender does not buffer 40 Computer Network
39 40 38 37 FH BS MH 36 40 39 Hand-off 40 MH New base station Split Connection Approach : Disadvantages • Hand-off latency increases due to state transfer • Data that has been ack’d to sender, must be moved to new base station Computer Network