Friday, 27 February 2015

Meaureable,Reilable,Adaptable, Fair Flexible Solution to Bufferbloat Problem



Introduction
Transmission Control Protocol is the Internet’s most widely used transport control protocol. TCP provides applications like FTP, Telnet etc. with a connection oriented, and reliable byte stream service on top of the Internet Protocol (IP). When a process communicates with another using TCP as the underlying transport mechanism, the sending process sends a SYN packet to which the receiving process replies with its SYN-ACK and the sender replies with an ACK. Once this three way handshake is negotiated, the connection is established and data transmission can begin. When all the data is sent, the client and the server exchange FIN and ACK in both directions and terminate the connection. Each byte of data that is sent by a client is assigned a sequence number, unique to that session. The server acknowledges receipt of each byte of the data using ACK segments. Acknowledgements of TCP are cumulative; an ACK confirms the successful receipt of all the data bytes up to (but not including) the acknowledged sequence number. Normally, TCP does not acknowledge each and every byte received individually, nor does it send ACK packets every time it receives data. It waits for a certain amount of time. During this period, if more data segments arrives, these segments are acknowledged together at once (“delayed acknowledgment”) or if a data segment has to be sent, the acknowledgment is ‘piggy backed” along with the data packet. The major control mechanisms of TCP are its congestion avoidance and congestion control mechanism. They are discussed in detail below:
·         Slow Start
Before TCP can send data at a fast rate, it needs to estimate the bandwidth available. If this is not done, the throughput of the TCP connection will drastically decrease, as the intermediate routers would have to queue or even drop the packets for want of buffer space. The slow start mechanism adds a new parameter that controls the rate at which packets are sent, congestion window denoted by cwnd. When a new TCP connection is established, the initial value of cwnd is set to a value less than or equal to 2*Maximum Segment Size (MSS), but not greater than two segments [15]. Every time an ACK segment is received, the cwnd   is increased by one segment. Thus, when an ACK arrives that acknowledges the first packet, the cwnd  is increased to two and two data segments are sent. When ACKs for these two segments arrives, the       cwnd is increased to four. This process thus provides an exponential increase to the cwnd parameter. At any point, the TCP sender can send up to the minimum of receiver’s advertised window and its own value of cwnd. TCP remains in this exponentially increasing slow start phase as long as cwnd value is less than or equal to “slow start threshold”, ssthresh (some implementations use just the “less than” condition).

 
Congestion Avoidance
Congestion avoidance is the algorithm used by TCP to avoid losing packets and if and when packets are lost, to deal with the situation. It is described in [3]. TCP performs congestion avoidance when cwnd   is greater than ssthresh. In the congestion avoidance phase, the cwnd is increased by 1 full-sized segment every round-trip time (RTT). Congestion avoidance continues until congestion is detected. Congestion can be detected in two ways – receipt of duplicate acknowledgment or due to time timeout. If the detection is done using the retransmission timer timeout, the value of ssthresh is updated as follows:
ssthresh = max (FlightSize / 2, 2*MSS)
FlightSize is the amount of outstanding data in the network. Then cwnd is set to 1 segment. After the packet has been retransmitted (whose timer had expired), TCP starts again in the slow start mode using the above mentioned algorithm to raise the cwnd from 1 to the new value of ssthresh, after which, congestion avoidance again clicks in. However, instead of the retransmission timer expiring, if three duplicate ACKs (three duplicate ACK is equal to four identical ACKs without the arrival of any other packet in between) were received at the sender, TCP assumes that it is an indication of packet loss. It then uses what is called the “fast retransmit” and “fast recovery” algorithm to recover the packet and fill the network again. The TCP sender does the following on the arrival of the third duplicate ACK:
·         Set ssthresh to the value given in the equation above.
·         Retransmit the lost packet and set cwnd to ssthresh + 3*MSS (fast retransmit).
·         For each additional duplicate ACK that is received, cwnd is incremented by one MSS.
·         If this new value of cwnd and receiver window allows, transmit new segment(s).
·         When the ACK that acknowledges the receipt of a new segment is received, set cwnd to ssthresh (fast recovery).





References:
[3]. V. Jacobson, “Congestion Avoidance and Control”, Proceedings of SIGCOMM’88 Symposium, pp 314- 322, August 1988.
[15]. M. Allman, S. Floyd, and C.Patridge, “Increasing TCP’s Initial Window”, RFC 2414, IETF, September 1998.


No comments:

Post a Comment