In communication networks, reliable data delivery is of utmost importance. This is typically ensured by the Transmission Control Protocol (TCP). TCP is one of the core protocols of the Internet Protocol (IP) suite (the entire suite is often called TCP/IP). IP works by exchanging pieces of information called packets. A packet is a sequence of octets (bytes) and consists of a header followed by a body. The header describes the packet's source, destination and control information. The body contains the payload data IP is transmitting.
When an application program desires to send a large chunk of data across the Internet using IP, instead of breaking the data into IP-sized pieces and issuing a series of IP requests, the application program can issue a single request to TCP and let TCP handle the IP details. Due to network congestion, traffic load balancing, or other unpredictable network behavior, IP packets can be lost, duplicated, or delivered out of order. TCP detects these problems, requests retransmission of lost data, rearranges out-of-order data, and even helps minimize network congestion to reduce the occurrence of the other problems. If the data still remains undelivered, its source is notified of this failure. Once the TCP receiver has reassembled the sequence of octets originally transmitted, the TCP receiver passes them to the receiving application.
That is, TCP provides reliable, ordered and error-checked delivery or notification of failure to delivery of data between computing devices such as programs running on computers connected to a local area network (LAN) or the public Internet. TCP is optimized for accurate delivery rather than timely delivery, and therefore, TCP sometimes incurs relatively long delays on the order of seconds while waiting for out-of-order messages or retransmissions of lost messages. Applications that do not require the reliability of a TCP connection may instead use the connectionless User Datagram Protocol (UDP), which emphasizes low-overhead operation and reduced latency rather than error checking and delivery validation. For example, real-time applications such as Voice over IP often make use of other protocols like the Real-time Transport Protocol (RTP) running over the UDP.
While IP handles actual delivery of the data, TCP keeps track of the individual units of data transmission, called segments, that a message is divided into for efficient routing through the network. For example, when an HTML file is sent from a web server, the TCP software layer of that server divides the sequence of octets of the file into segments and forwards them individually to the IP software layer (Internet Layer). The Internet Layer encapsulates each TCP segment into an IP packet by adding a header that includes (among other data) the destination IP address. When the client program on the destination computer receives them, the TCP layer (i.e. the Transport Layer) reassembles the individual segments and ensures they are correctly ordered and error free as it streams them to an application.
A main aspect of TCP is congestion control. TCP uses a number of mechanisms to achieve high performance and avoid congestion collapse, where network performance can decrease by several orders of magnitude. These mechanisms control the rate of data entering the network, keeping the data flow below a rate that would trigger collapse. Acknowledgments for data sent, or lack of acknowledgments, are used by senders to infer network conditions between the TCP sender and receiver. Coupled with timers, TCP senders and receivers can alter the behavior of the flow of data. This is more generally referred to as congestion control and/or network congestion avoidance. In TCP, senders employ a retransmission timeout (RTO) that is based on the estimated round-trip-time (RTT) between the sender and receiver. The behavior of this timer is specified in Request For Comments (RFC) 6298. TCP applies congestion control and can generally be distinguished to work in two phases, namely slow-start (which may also be referred to as slowstart or slow start) congestion and congestion avoidance. Modern implementations of TCP contain four intertwined algorithms: Slow-start congestion, congestion avoidance, fast retransmit, and fast recovery, as described in RFC 5681.
Slow-start is the initial part of the congestion control strategy used by TCP. Slow-start is used to avoid sending more data than the network is capable of transmitting, that is, to avoid causing network congestion. The algorithm is specified by RFC 5681 and is also known as the exponential growth phase. Slow-start begins initially with a congestion window size (cwnd) of 1, 2 or 10. The value of the congestion window will be increased with each acknowledgment (ACK) of each segment received by the transmitter, effectively doubling the window size each RTT. In other words, in this phase the congestion window, i.e. the number of TCP segments that can be in-flight, increases exponentially. To give an example, if 1 segment is sent and 1 ACK is received, the congestion window is increased by 1. If 2 segments are sent and 2 ACKs are received, the congestion window is increases twice by 1. The congestion window is further increased exponentially, if 4 or more segments are sent. A fast increase is important to utilize the full link capacity. How fast the increase happens depends on the RTT, i.e. the time between sending a segment and receiving the corresponding ACK. The transmission rate will be increased with slow-start algorithm until either a loss is detected, or the receiver's advertised window (rwnd) is the limiting factor, or the slow start threshold (ssthresh) is reached. If a loss event occurs, TCP assumes that it is due to network congestion and takes steps to reduce the offered load on the network. Although the strategy is referred to as “slow-start” (before slow-start was introduced in TCP, the initial pre-congestion avoidance phase which was used instead of the slow start phase was even faster), the used congestion window growth is quite aggressive, at least more aggressive than the subsequent congestion avoidance phase.
The second phase is called congestion avoidance. Once the ssthresh is reached in the slow start phase, TCP changes from slow-start algorithm to congestion avoidance algorithm. The congestion avoidance phase is more conservative. In the congestion avoidance phase, the congestion window increases for typical congestion avoidance algorithms only linearly, i.e. the congestion window is increased by 1 segment for each RTT.
The overall end-to-end delay, i.e. user experience, for services using TCP is influenced by the TCP congestion control.