Misplaced Pages

TCP tuning

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
#89910

58-398: TCP tuning techniques adjust the network congestion avoidance parameters of Transmission Control Protocol (TCP) connections over high- bandwidth , high- latency networks. Well-tuned networks can perform up to 10 times faster in some cases. However, blindly following instructions without understanding their real consequences can hurt performance as well. Bandwidth-delay product (BDP) is

116-407: A computer network fail to reach their destination. Packet loss is either caused by errors in data transmission, typically across wireless networks , or network congestion . Packet loss is measured as a percentage of packets lost with respect to packets sent. The Transmission Control Protocol (TCP) detects packet loss and performs retransmissions to ensure reliable messaging . Packet loss in

174-451: A price signaled by the network. Each link capacity imposes a constraint, which gives rise to a Lagrange multiplier , p l {\displaystyle p_{l}} . The sum of these multipliers, y i = ∑ l p l r l i , {\displaystyle y_{i}=\sum _{l}p_{l}r_{li},} is the price to which the flow responds. Congestion control then becomes

232-410: A TCP connection is also used to avoid congestion and thus produces an intentionally reduced throughput for the connection. In real-time applications like streaming media or online games , packet loss can affect a user's quality of experience (QoE). The Internet Protocol (IP) is designed according to the end-to-end principle as a best-effort delivery service, with the intention of keeping

290-594: A bandwidth of 10 Gbit/s can have up to 0.5×10 Gbits , i.e., 5 Gbit of unacknowledged data in flight. Despite having much lower latencies than satellite links, even terrestrial fiber links can have very high BDPs because their link capacity is so large. Operating systems and protocols designed as recently as a few years ago when networks were slower were tuned for BDPs of orders of magnitude smaller, with implications for limited achievable performance. The original TCP configurations supported TCP receive window size buffers of up to 65,535 (64 KiB - 1) bytes, which

348-646: A certain limit, it may even retransmit . This is how TCP achieves reliable data transmission . Even if there is no packet loss in the network, windowing can limit throughput. Because TCP transmits data up to the window size before waiting for the acknowledgements, the full bandwidth of the network may not always get used. The limitation caused by window size can be calculated as follows: T h r o u g h p u t ≤ R W I N R T T {\displaystyle \mathrm {Throughput} \leq {\frac {\mathrm {RWIN} }{\mathrm {RTT} }}\,\!} where RWIN

406-425: A denial-of-service attack. Congestive collapse (or congestion collapse) is the condition in which congestion prevents or limits useful communication. Congestion collapse generally occurs at choke points in the network, where incoming traffic exceeds outgoing bandwidth. Connection points between a local area network and a wide area network are common choke points. When a network is in this condition, it settles into

464-478: A distributed optimization algorithm. Many current congestion control algorithms can be modeled in this framework, with p l {\displaystyle p_{l}} being either the loss probability or the queueing delay at link l {\displaystyle l} . A major weakness is that it assigns the same price to all flows, while sliding window flow control causes burstiness that causes different flows to observe different loss or delay at

522-470: A given link. Among the ways to classify congestion control algorithms are: Mechanisms have been invented to prevent network congestion or to deal with a network collapse: The correct endpoint behavior is usually to repeat dropped information, but progressively slow the repetition rate. Provided all endpoints do this, the congestion lifts and the network resumes normal behavior. Other strategies such as slow start ensure that new connections don't overwhelm

580-444: A given sender as some sent data is never received and can't be counted as throughput. Packet loss indirectly reduces throughput as some transport layer protocols interpret loss as an indication of congestion and adjust their transmission rate to avoid congestive collapse. When reliable delivery is necessary, packet loss increases latency due to additional time needed for retransmission. Assuming no retransmission, packets experiencing

638-404: A large file, graphic or web page, it usually advertises a window of between 32K and 64K. This results in the server sending a full window of data (assuming the file is larger than the window). When many applications simultaneously request downloads, this data can create a congestion point at an upstream provider. By reducing the window advertisement, the remote servers send less data, thus reducing

SECTION 10

#1732780679090

696-543: A network might also need a command and control protocol for congestion management, adding even more complexity. To avoid all of these problems, the Internet Protocol allows for routers to simply drop packets if the router or a network segment is too busy to deliver the data in a timely fashion. This is not ideal for speedy and efficient transmission of data, and is not expected to happen in an uncongested network. Dropping of packets acts as an implicit signal that

754-606: A particular server. Admission control is any system that requires devices to receive permission before establishing new network connections. If the new connection risks creating congestion, permission can be denied. Examples include Contention-Free Transmission Opportunities (CFTXOPs) in the ITU-T G.hn standard for home networking over legacy wiring, Resource Reservation Protocol for IP networks and Stream Reservation Protocol for Ethernet . Packet loss Packet loss occurs when one or more packets of data travelling across

812-436: A reply. Tools such as ping , traceroute , MTR and PathPing use this protocol to provide a visual representation of the path packets are taking, and to measure packet loss at each hop . Many routers have status pages or logs, where the owner can find the number or percentage of packets dropped over a particular period. Per the end-to-end principle , the Internet Protocol leaves responsibility for packet recovery through

870-418: A router failure. Reliability is also not needed for all applications. For example, with live streaming media , it is more important to deliver recent packets quickly than to ensure that stale packets are eventually delivered. An application or user may also decide to retry an operation that is taking a long time, in which case another set of packets will be added to the burden of delivering the original set. Such

928-743: A stable state where traffic demand is high but little useful throughput is available, during which packet delay and loss occur and quality of service is extremely poor. Congestive collapse was identified as a possible problem by 1984. It was first observed on the early Internet in October 1986, when the NSFNET phase-I backbone dropped three orders of magnitude from its capacity of 32 kbit/s to 40 bit/s, which continued until end nodes started implementing Van Jacobson and Sally Floyd 's congestion control between 1987 and 1988. When more packets were sent than could be handled by intermediate routers,

986-441: A term primarily used in conjunction with TCP to refer to the number of bytes necessary to fill a TCP "path", i.e. it is equal to the maximum number of simultaneous bits in transit between the transmitter and the receiver. High performance networks have very large BDPs. To give a practical example, two nodes communicating over a geostationary satellite link with a round-trip delay time (or round-trip time, RTT) of 0.5 seconds and

1044-438: A too big bandwidth flow according to some quality of service policy. A policy could then divide the bandwidth among all flows by some criteria. Another approach is to use Explicit Congestion Notification (ECN). ECN is used only when two hosts signal that they want to use it. With this method, a protocol bit is used to signal explicit congestion. This is better than the indirect congestion notification signaled by packet loss by

1102-481: A transmitted packet is lost, it will be re-sent along with every packet that had already been sent after it. Protocols such as User Datagram Protocol (UDP) provide no recovery for lost packets. Applications that use UDP are expected to implement their own mechanisms for handling packet loss, if needed. There are many queuing disciplines used for determining which packets to drop. Most basic networking equipment will use FIFO queuing for packets waiting to go through

1160-673: Is inherently unreliable and even when two identical Wi-Fi receivers are placed within close proximity of each other, they do not exhibit similar patterns of packet loss, as one might expect. Cellular networks can experience packet loss caused by, "high bit error rate (BER), unstable channel characteristics, and user mobility." TCP's intentional throttling behavior prevents wireless networks from performing near their theoretical potential transfer rates because unmodified TCP treats all dropped packets as if they were caused by network congestion , and so may throttle wireless networks even when they aren't actually congested. Network congestion

1218-594: Is a cause of packet loss that can affect all types of networks. When content arrives for a sustained period at a given router or network segment at a rate greater than it is possible to send through, there is no other option than to drop packets. If a single router or link is constraining the capacity of the complete travel path or of network travel in general, it is known as a bottleneck . In some cases, packets are intentionally dropped by routing routines, or through network dissuasion technique for operational management purposes. Packet loss directly reduces throughput for

SECTION 20

#1732780679090

1276-724: Is a well known example. The first TCP implementations to handle congestion were described in 1984, but Van Jacobson's inclusion of an open source solution in the Berkeley Standard Distribution UNIX (" BSD ") in 1988 first provided good behavior. UDP does not control congestion. Protocols built atop UDP must handle congestion independently. Protocols that transmit at a fixed rate, independent of congestion, can be problematic. Real-time streaming protocols, including many Voice over IP protocols, have this property. Thus, special measures, such as quality of service, must be taken to keep packets from being dropped in

1334-413: Is because, even after data has been sent on the network, the sending side must hold it in memory until it has been acknowledged as successfully received, just in case it would have to be retransmitted. If the receiver is far away, acknowledgments will take a long time to arrive. If the send memory is small, it can saturate and block emission. A simple computation gives the same optimal send memory size as for

1392-414: Is detected by reliable protocols such as TCP. Reliable protocols react to packet loss automatically, so when a person such as a network administrator needs to detect and diagnose packet loss, they typically use status information from network equipment or purpose-built tools. The Internet Control Message Protocol provides an echo functionality, where a special packet is transmitted that always produces

1450-432: Is easily filled by a single personal computer. Even on fast computer networks, the backbone can easily be congested by a few servers and client PCs. Denial-of-service attacks by botnets are capable of filling even the largest Internet backbone network links, generating large-scale network congestion. In telephone networks, a mass call event can overwhelm digital telephone circuits, in what can otherwise be defined as

1508-476: Is performed by the network scheduler . One solution is to use random early detection (RED) on the network equipment's egress queue. On networking hardware ports with more than one egress queue, weighted random early detection (WRED) can be used. RED indirectly signals TCP sender and receiver by dropping some packets, e.g. when the average queue length is more than a threshold (e.g. 50%) and deletes linearly or cubically more packets, up to e.g. 100%, as

1566-408: Is possible to interpose large end to end buffering delays by putting in intermediate data storage points in an end to end system, and then to use automated and scheduled non-real-time data transfers to get the data to their final endpoints. Maximum achievable throughput for a single TCP connection is determined by different factors. One trivial limitation is the maximum bandwidth of the slowest link in

1624-401: Is present. This delayed packet loss interferes with TCP's automatic congestion avoidance. All flows that experience this packet loss begin a TCP retrain at the same moment – this is called TCP global synchronization . Active queue management (AQM) is the reordering or dropping of network packets inside a transmit buffer that is associated with a network interface controller (NIC). This task

1682-483: Is the TCP Receive Window and RTT is the round-trip time for the path. At any given time, the window advertised by the receive side of TCP corresponds to the amount of free receive memory it has allocated for this connection. Otherwise it would risk dropping received packets due to lack of space. The sending side should also allocate the same amount of memory as the receive side for good performance. That

1740-461: Is the maximum segment size and P loss is the probability of packet loss. If packet loss is so rare that the TCP window becomes regularly fully extended, this formula doesn't apply. A number of extensions have been made to TCP over the years to increase its performance over fast high-RTT links ("long fat networks" or LFNs). TCP timestamps (RFC 1323) play a double role: they avoid ambiguities due to

1798-514: Is the reduced quality of service that occurs when a network node or link is carrying more data than it can handle. Typical effects include queueing delay , packet loss or the blocking of new connections. A consequence of congestion is that an incremental increase in offered load leads either only to a small increase or even a decrease in network throughput . Network protocols that use aggressive retransmissions to compensate for packet loss due to congestion can increase congestion, even after

TCP tuning - Misplaced Pages Continue

1856-697: Is typically accomplished by reducing the rate of packets. Whereas congestion control prevents senders from overwhelming the network , flow control prevents the sender from overwhelming the receiver . The theory of congestion control was pioneered by Frank Kelly , who applied microeconomic theory and convex optimization theory to describe how individuals controlling their own rates can interact to achieve an optimal network-wide rate allocation. Examples of optimal rate allocation are max-min fair allocation and Kelly's suggestion of proportionally fair allocation, although many others are possible. Let x i {\displaystyle x_{i}} be

1914-559: The IPv4 header checksum or the Ethernet frame check sequence indicates the packet has been corrupted. Packet loss can also be caused by a packet drop attack . Wireless networks are susceptible to a number of factors that can corrupt or lose packets in transit, such as radio frequency interference (RFI), radio signals that are too weak due to distance or multi-path fading , faulty networking hardware, or faulty network drivers. Wi-Fi

1972-572: The 32-bit sequence number field wrapping around, and they allow more precise RTT estimation in the presence of multiple losses per RTT. With those improvements, it becomes reasonable to increase the TCP window beyond 64 kB, which can be done using the window scaling option (RFC 1323). The TCP selective acknowledgment option (SACK, RFC 2018) allows a TCP receiver to precisely inform the TCP sender about which segments have been lost. This increases performance on high-RTT links, when multiple losses per window are possible. Path MTU Discovery avoids

2030-580: The RED/WRED algorithms, but it requires support by both hosts. When a router receives a packet marked as ECN-capable and the router anticipates congestion, it sets the ECN flag, notifying the sender of congestion. The sender should respond by decreasing its transmission bandwidth, e.g., by decreasing its sending rate by reducing the TCP window size or by other means. Congestion avoidance can be achieved efficiently by reducing traffic. When an application requests

2088-407: The appropriate adjustments. The protocols that avoid congestive collapse generally assume that data loss is caused by congestion. On wired networks, errors during transmission are rare. WiFi , 3G and other networks with a radio layer are susceptible to data loss due to interference and may experience poor throughput in some cases. The TCP connections running over a radio-based physical layer see

2146-401: The bottleneck and they will drop the packet if the queue is full at the time the packet is received. This type of packet dropping is called tail drop . Other full queue mechanisms include random early detection and weighted random early detection . Dropping packets is undesirable as the packet is either lost or must be retransmitted and this can impact real-time throughput; however, increasing

2204-404: The buffer size can lead to bufferbloat which has its own impact on latency and jitter during congestion. In cases where quality of service is rate limiting a connection, e.g., using a leaky bucket algorithm, packets may be intentionally dropped in order to slow down specific services to ensure available bandwidth for other services marked with higher importance. For this reason, packet loss

2262-474: The congestion. Backward ECN (BECN) is another proposed congestion notification mechanism. It uses ICMP source quench messages as an IP signaling mechanism to implement a basic ECN mechanism for IP networks, keeping congestion notifications at the IP level and requiring no negotiation between network endpoints. Effective congestion notifications can be propagated to transport layer protocols, such as TCP and UDP, for

2320-434: The corresponding vectors and matrix. Let U ( x ) {\displaystyle U(x)} be an increasing, strictly concave function , called the utility , which measures how much benefit a user obtains by transmitting at rate x {\displaystyle x} . The optimal rate allocation then satisfies The Lagrange dual of this problem decouples so that each flow sets its own rate, based only on

2378-570: The data loss and tend to erroneously believe that congestion is occurring. The slow-start protocol performs badly for short connections. Older web browsers created many short-lived connections and opened and closed the connection for each file. This kept most connections in the slow start mode. Initial performance can be poor, and many connections never get out of the slow-start regime, significantly increasing latency. To avoid this problem, modern browsers either open multiple connections simultaneously or reuse one connection for all files requested from

TCP tuning - Misplaced Pages Continue

2436-427: The initial load has been reduced to a level that would not normally have induced network congestion. Such networks exhibit two stable states under the same level of load. The stable state with low throughput is known as congestive collapse . Networks use congestion control and congestion avoidance techniques to try to avoid collapse. These include: exponential backoff in protocols such as CSMA/CA in 802.11 and

2494-472: The intermediate routers discarded many packets, expecting the endpoints of the network to retransmit the information. However, early TCP implementations had poor retransmission behavior. When this packet loss occurred, the endpoints sent extra packets that repeated the information lost, doubling the incoming rate. Congestion control modulates traffic entry into a telecommunications network in order to avoid congestive collapse resulting from oversubscription. This

2552-408: The logic routers must implement, as simple as possible. If the network made reliable delivery guarantees on its own, that would require store and forward infrastructure, where each router devotes a significant amount of storage space to packets while it waits to verify that the next node properly received them. A reliable network would not be able to maintain its delivery guarantees in the event of

2610-412: The logic for this themselves. In the event of packet loss, the receiver asks for retransmission or the sender automatically resends any segments that have not been acknowledged. Although TCP can recover from packet loss, retransmitting missing packets reduces the throughput of the connection as receivers wait for retransmissions and additional bandwidth is consumed by them. In certain variants of TCP, if

2668-584: The need for in-network fragmentation , increasing the performance in the presence of packet loss. The default IP queue length is 1000, which is generally too large. Imagine a Wi-Fi base station having a speed of 20 Mbit/s and an average packet size of 750 byte. How large should the IP queue be? A voice over IP client should be able to transmit a packet every 20 ms. The estimated maximum number of packets in transit would then be: A better queue length would be: Network congestion avoidance Network congestion in data networking and queueing theory

2726-492: The network is congested, and may cause senders to reduce the amount of bandwidth consumed, or attempt to find another path. For example, using perceived packet loss as feedback to discover congestion, the Transmission Control Protocol (TCP) is designed so that excessive packet loss will cause the sender to throttle back and stop flooding the bottleneck point with data. Packets may also be dropped if

2784-412: The path. But there are also other, less obvious limits for TCP throughput. Bit errors can create a limitation for the connection as well as RTT. In computer networking , RWIN (TCP Receive Window) is the amount of data that a computer can accept without acknowledging the sender. If the sender has not received acknowledgement for the first packet it sent, it will stop and wait and if this wait exceeds

2842-518: The presence of congestion. Connection-oriented protocols , such as the widely used TCP protocol, watch for packet loss or queuing delay to adjust their transmission rate. Various network congestion avoidance processes support different trade-offs. The TCP congestion avoidance algorithm is the primary basis for congestion control on the Internet. Problems occur when concurrent TCP flows experience tail-drops , especially when bufferbloat

2900-480: The queue fills further. The robust random early detection (RRED) algorithm was proposed to improve the TCP throughput against denial-of-service (DoS) attacks, particularly low-rate denial-of-service (LDoS) attacks. Experiments confirmed that RED-like algorithms were vulnerable under LDoS attacks due to the oscillating TCP queue size caused by the attacks. Some network equipment is equipped with ports that can follow and measure each flow and are thereby able to signal

2958-552: The rate of flow i {\displaystyle i} , c l {\displaystyle c_{l}} be the capacity of link l {\displaystyle l} , and r l i {\displaystyle r_{li}} be 1 if flow i {\displaystyle i} uses link l {\displaystyle l} and 0 otherwise. Let x {\displaystyle x} , c {\displaystyle c} and R {\displaystyle R} be

SECTION 50

#1732780679090

3016-627: The receive memory size given above. When packet loss occurs in the network, an additional limit is imposed on the connection. In the case of light to moderate packet loss when the TCP rate is limited by the congestion avoidance algorithm , the limit can be calculated according to the formula (Mathis, et al.): T h r o u g h p u t ≤ M S S R T T P l o s s {\displaystyle \mathrm {Throughput} \leq {\frac {\mathrm {MSS} }{\mathrm {RTT} {\sqrt {P_{\mathrm {loss} }}}}}} where MSS

3074-605: The retransmission of dropped packets to the endpoints - the computers sending and receiving the data. They are in the best position to decide whether retransmission is necessary because the application sending the data should know whether a message is best retransmitted in whole or in part, whether or not the need to send the message has passed, and how to control the amount of bandwidth consumed to account for any congestion. Network transport protocols such as TCP provide endpoints with an easy way to ensure reliable delivery of packets so that individual applications don't need to implement

3132-436: The router before congestion detection initiates. Common router congestion avoidance mechanisms include fair queuing and other scheduling algorithms , and random early detection (RED) where packets are randomly dropped as congestion is detected. This proactively triggers the endpoints to slow transmission before congestion collapse occurs. Some end-to-end protocols are designed to behave well under congested conditions; TCP

3190-621: The similar CSMA/CD in the original Ethernet , window reduction in TCP , and fair queueing in devices such as routers and network switches . Other techniques that address congestion include priority schemes which transmit some packets with higher priority ahead of others and the explicit allocation of network resources to specific flows through the use of admission control . Network resources are limited, including router processing time and link throughput . Resource contention may occur on networks in several common circumstances. A wireless LAN

3248-418: The type of data being sent. For example, for voice over IP traffic, one commentator reckoned that "[m]issing one or two packets every now and then will not affect the quality of the conversation. Losses between 5% and 10% of the total packet stream will affect the quality significantly." Another described less than 1% packet loss as "good" for streaming audio or video, and 1–2.5% as "acceptable". Packet loss

3306-412: The worst delays might be preferentially dropped (depending on the queuing discipline used), resulting in lower latency overall. Packet loss may be measured as frame loss rate defined as the percentage of frames that should have been forwarded by a network but were not. Packet loss is closely associated with quality of service considerations. The amount of packet loss that is acceptable depends on

3364-419: Was adequate for slow links or links with small RTTs. Larger buffers are required by the high performance options described below. Buffering is used throughout high performance network systems to handle delays in the system. In general, buffer size will need to be scaled proportionally to the amount of data "in flight" at any time. For very high performance applications that are not sensitive to network delays, it

#89910