RFC 5681

TCP Congestion Control

๐Ÿ“… published September 2009, from ietf

TCP Congestion Control ๐ŸŽ€

Okay bestie, so this is RFC 5681, called TCP Congestion Control. It was written by M. Allman and V. Paxson (both at ICSI) and E. Blanton (Purdue University) in September 2009. It's a Standards Track doc, and it obsoletes RFC 2581 ๐Ÿ’…

Abstract โœจ

So the vibe here is that this doc defines TCP's four intertwined congestion control algorithms: slow start, congestion avoidance, fast retransmit, and fast recovery ๐Ÿ”ฅ It also explains how TCP should start sending again after a relatively long idle period, plus it talks through a few ways of generating acknowledgments. And yes, this one obsoletes RFC 2581 ๐Ÿซถ

Status of This Memo ๐Ÿ“œ

This is an Internet standards track protocol for the Internet community, and it's asking for discussion and suggestions for improvements ๐Ÿฆ‹ If you want the current standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited โœจ

Copyright (c) 2009 IETF Trust and the persons identified as the document authors. All rights reserved ๐Ÿ’œ

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents in effect on the date of publication of this document (http://trustee.ietf.org/license-info). Please review these documents carefully, because they describe your rights and restrictions with respect to this document ๐Ÿ“–

This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English ๐Ÿ™ˆ

Table Of Contents ๐Ÿฆ‹

1. Introduction ....................................................2
2. Definitions .....................................................3
3. Congestion Control Algorithms ...................................4
   3.1. Slow Start and Congestion Avoidance ........................4
   3.2. Fast Retransmit/Fast Recovery ..............................8
4. Additional Considerations ......................................10
   4.1. Restarting Idle Connections ...............................10
   4.2. Generating Acknowledgments ................................11
   4.3. Loss Recovery Mechanisms ..................................12
5. Security Considerations ........................................13
6. Changes between RFC 2001 and RFC 2581 ..........................13
7. Changes Relative to RFC 2581 ...................................14
8. Acknowledgments ................................................15
9. References .....................................................15
   9.1. Normative References ......................................15
   9.2. Informative References ....................................16

1. Introduction โœจ

Okay so this doc specifies four TCP [RFC793] congestion control algorithms: slow start, congestion avoidance, fast retransmit and fast recovery ๐ŸŒธ These were devised in [Jac88] and [Jac90]. Their use with TCP is standardized in [RFC1122]. Early work on additive-increase, multiplicative-decrease congestion control is in [CJ89], which is lowkey the origin story ๐Ÿ‘‘

Note that [Ste94] gives examples of these algorithms in action, and [WS95] explains the source code for the BSD implementation of these algorithms ๐Ÿ’–

Beyond the algorithms, this document also specifies what TCP connections should do after a relatively long idle period, and it spells out and clarifies some of the issues around TCP ACK generation ๐Ÿงš

This document obsoletes [RFC2581], which in turn obsoleted [RFC2001] ๐ŸŽ€

Here's the layout. Section 2 gives various definitions used throughout the document. Section 3 specifies the congestion control algorithms. Section 4 outlines concerns related to the congestion control algorithms, and finally section 5 outlines security considerations ๐Ÿฆ‹

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. Those capitalized words are the important ones, so pay attention ๐Ÿ’…

2. Definitions ๐Ÿ“š

This section defines several terms that get used for the rest of the document, so bookmark it bestie ๐Ÿ”–

  • SEGMENT: A segment is ANY TCP/IP data or acknowledgment packet (or both) ๐ŸŒˆ
  • SENDER MAXIMUM SEGMENT SIZE (SMSS): The SMSS is the size of the largest segment that the sender can transmit. This value can be based on the maximum transmission unit of the network, the path MTU discovery [RFC1191, RFC4821] algorithm, RMSS (see next item), or other factors. The size does not include the TCP/IP headers and options ๐Ÿ“
  • RECEIVER MAXIMUM SEGMENT SIZE (RMSS): The RMSS is the size of the largest segment the receiver is willing to accept. This is the value specified in the MSS option sent by the receiver during connection startup. Or, if the MSS option is not used, it is 536 bytes [RFC1122]. The size does not include the TCP/IP headers and options ๐Ÿ’œ
  • FULL-SIZED SEGMENT: A segment that contains the maximum number of data bytes permitted (i.e., a segment containing SMSS bytes of data) ๐Ÿซถ
  • RECEIVER WINDOW (rwnd): The most recently advertised receiver window โœจ
  • CONGESTION WINDOW (cwnd): A TCP state variable that limits the amount of data a TCP can send. At any given time, a TCP MUST NOT send data with a sequence number higher than the sum of the highest acknowledged sequence number and the minimum of cwnd and rwnd. This one's the main character of the whole doc ๐Ÿ‘‘
  • INITIAL WINDOW (IW): The initial window is the size of the sender's congestion window after the three-way handshake is completed ๐ŸŒธ
  • LOSS WINDOW (LW): The loss window is the size of the congestion window after a TCP sender detects loss using its retransmission timer ๐Ÿ’”
  • RESTART WINDOW (RW): The restart window is the size of the congestion window after a TCP restarts transmission after an idle period (if the slow start algorithm is used; see section 4.1 for more discussion) ๐Ÿฆ‹
  • FLIGHT SIZE: The amount of data that has been sent but not yet cumulatively acknowledged ๐Ÿงš
  • DUPLICATE ACKNOWLEDGMENT: An acknowledgment is considered a "duplicate" in the following algorithms when (a) the receiver of the ACK has outstanding data, (b) the incoming acknowledgment carries no data, (c) the SYN and FIN bits are both off, (d) the acknowledgment number is equal to the greatest acknowledgment received on the given connection (TCP.UNA from [RFC793]) and (e) the advertised window in the incoming acknowledgment equals the advertised window in the last incoming acknowledgment. Lowkey a lot of conditions, but they're all doing a job ๐Ÿ™ˆ

Alternatively, a TCP that utilizes selective acknowledgments (SACKs) [RFC2018, RFC2883] can leverage the SACK information to determine when an incoming ACK is a "duplicate" (e.g., if the ACK contains previously unknown SACK information). That's a really iconic upgrade ๐Ÿ”ฅ

3. Congestion Control Algorithms ๐Ÿ’…

This section defines the four congestion control algorithms: slow start, congestion avoidance, fast retransmit, and fast recovery, developed in [Jac88] and [Jac90]. In some situations, it may be beneficial for a TCP sender to be more conservative than the algorithms allow; however, a TCP MUST NOT be more aggressive than the following algorithms allow (that is, MUST NOT send data when the value of cwnd computed by the following algorithms would not allow the data to be sent). Not being too aggressive is non-negotiable, periodt ๐Ÿ’€

Also, note that the algorithms specified in this document work in terms of using loss as the signal of congestion. Explicit Congestion Notification (ECN) could also be used as specified in [RFC3168] ๐ŸŒˆ

To be continued... ๐Ÿซถ

3.1. Slow Start and Congestion Avoidance โœจ

Okay bestie, this is the core of how TCP stays polite on the network ๐Ÿ’… The slow start and congestion avoidance algorithms MUST be used by a TCP sender to control the amount of outstanding data being injected into the network. To pull this off, two variables get added to the per-connection state ๐ŸŽ€ The congestion window (cwnd) is a sender-side limit on how much data the sender can push into the network before an acknowledgment (ACK) comes back. The receiver's advertised window (rwnd) is a receiver-side limit on outstanding data. The minimum of cwnd and rwnd decides what gets sent ๐Ÿฆ‹

Another state variable, the slow start threshold (ssthresh), decides whether slow start or congestion avoidance is in charge of data transmission, as we'll get into below ๐Ÿ’œ

Starting to send into a network with unknown conditions means TCP has to slowly probe for the available capacity so it doesn't dump an inappropriately large burst of data on everyone ๐ŸŒธ Slow start handles that at the beginning of a transfer, or after repairing loss detected by the retransmission timer. It also starts the "ACK clock" that the TCP sender uses to release data into the network during slow start, congestion avoidance, and loss recovery ๐Ÿงš

IW, the initial value of cwnd, MUST be set using the following guidelines as an upper bound.

If SMSS > 2190 bytes:
    IW = 2 * SMSS bytes and MUST NOT be more than 2 segments
If (SMSS > 1095 bytes) and (SMSS <= 2190 bytes):
    IW = 3 * SMSS bytes and MUST NOT be more than 3 segments
if SMSS <= 1095 bytes:
    IW = 4 * SMSS bytes and MUST NOT be more than 4 segments

As specified in [RFC3390], the SYN/ACK and the acknowledgment of the SYN/ACK MUST NOT increase the size of the congestion window ๐Ÿ™ˆ Further, if the SYN or SYN/ACK is lost, the initial window used by a sender after a correctly transmitted SYN MUST be one segment consisting of at most SMSS bytes.

A detailed rationale and discussion of the IW setting is provided in [RFC3390] ๐Ÿ“š

When initial congestion windows of more than one segment are implemented along with Path MTU Discovery [RFC1191], and the MSS being used is found to be too large, the congestion window cwnd SHOULD be reduced to prevent large bursts of smaller segments. Specifically, cwnd SHOULD be reduced by the ratio of the old segment size to the new segment size ๐Ÿ“

The initial value of ssthresh SHOULD be set arbitrarily high (e.g., to the size of the largest possible advertised window), but ssthresh MUST be reduced in response to congestion. Setting ssthresh as high as possible lets the network conditions, rather than some arbitrary host limit, decide the sending rate ๐Ÿ‘‘ In cases where the end systems have a solid understanding of the network path, more carefully setting the initial ssthresh value may have merit (e.g., such that the end host does not create congestion along the path) ๐Ÿซถ

The slow start algorithm is used when cwnd < ssthresh, while the congestion avoidance algorithm is used when cwnd > ssthresh. When cwnd and ssthresh are equal, the sender may use either slow start or congestion avoidance.

During slow start, a TCP increments cwnd by at most SMSS bytes for each ACK received that cumulatively acknowledges new data. Slow start ends when cwnd exceeds ssthresh (or, optionally, when it reaches it, as noted above) or when congestion is observed. While traditionally TCP implementations have increased cwnd by precisely SMSS bytes upon receipt of an ACK covering new data, we RECOMMEND that TCP implementations increase cwnd, per:

   cwnd += min (N, SMSS)                      (2)

where N is the number of previously unacknowledged bytes acknowledged in the incoming ACK. This adjustment is part of Appropriate Byte Counting [RFC3465] and provides robustness against misbehaving receivers that may attempt to induce a sender to artificially inflate cwnd using a mechanism known as "ACK Division" [SCWA99]. ACK Division consists of a receiver sending multiple ACKs for a single TCP data segment, each acknowledging only a portion of its data. A TCP that increments cwnd by SMSS for each such ACK will inappropriately inflate the amount of data injected into the network ๐Ÿ˜ค

During congestion avoidance, cwnd is incremented by roughly 1 full-sized segment per round-trip time (RTT). Congestion avoidance continues until congestion is detected. The basic guidelines for incrementing cwnd during congestion avoidance are:

  • MAY increment cwnd by SMSS bytes
  • SHOULD increment cwnd per equation (2) once per RTT
  • MUST NOT increment cwnd by more than SMSS bytes

We note that [RFC3465] allows for cwnd increases of more than SMSS bytes for incoming acknowledgments during slow start on an experimental basis. However, such behavior is not allowed as part of the standard โš ๏ธ

The RECOMMENDED way to increase cwnd during congestion avoidance is to count the number of bytes that have been acknowledged by ACKs for new data. (A drawback of this implementation is that it requires maintaining an additional state variable.) When the number of bytes acknowledged reaches cwnd, then cwnd can be incremented by up to SMSS bytes. Note that during congestion avoidance, cwnd MUST NOT be increased by more than SMSS bytes per RTT. This method both allows TCPs to increase cwnd by one segment per RTT in the face of delayed ACKs and provides robustness against ACK Division attacks ๐Ÿ›ก๏ธ

Another common formula that a TCP MAY use to update cwnd during congestion avoidance is given in equation (3):

   cwnd += SMSS*SMSS/cwnd                     (3)

This adjustment is executed on every incoming ACK that acknowledges new data. Equation (3) provides an acceptable approximation to the underlying principle of increasing cwnd by 1 full-sized segment per RTT. (Note that for a connection in which the receiver is acknowledging every-other packet, (3) is less aggressive than allowed -- roughly increasing cwnd every second RTT.) ๐Ÿข

Implementation Note: Since integer arithmetic is usually used in TCP implementations, the formula given in equation (3) can fail to increase cwnd when the congestion window is larger than SMSS*SMSS. If the above formula yields 0, the result SHOULD be rounded up to 1 byte. ๐Ÿ”ข

Implementation Note: Older implementations have an additional additive constant on the right-hand side of equation (3). This is incorrect and can actually lead to diminished performance [RFC2525]. ๐Ÿ™…โ€โ™€๏ธ

Implementation Note: Some implementations maintain cwnd in units of bytes, while others in units of full-sized segments. The latter will find equation (3) difficult to use, and may prefer to use the counting approach discussed in the previous paragraph ๐Ÿงฎ

When a TCP sender detects segment loss using the retransmission timer and the given segment has not yet been resent by way of the retransmission timer, the value of ssthresh MUST be set to no more than the value given in equation (4):

   ssthresh = max (FlightSize / 2, 2*SMSS)            (4)

where, as discussed above, FlightSize is the amount of outstanding data in the network.

On the other hand, when a TCP sender detects segment loss using the retransmission timer and the given segment has already been retransmitted by way of the retransmission timer at least once, the value of ssthresh is held constant.

Implementation Note: An easy mistake to make is to simply use cwnd, rather than FlightSize, which in some implementations may incidentally increase well beyond rwnd. ๐Ÿ™ƒ

Furthermore, upon a timeout (as specified in [RFC2988]) cwnd MUST be set to no more than the loss window, LW, which equals 1 full-sized segment (regardless of the value of IW). Therefore, after retransmitting the dropped segment the TCP sender uses the slow start algorithm to increase the window from 1 full-sized segment to the new value of ssthresh, at which point congestion avoidance again takes over ๐Ÿ”

As shown in [FF96] and [RFC3782], slow-start-based loss recovery after a timeout can cause spurious retransmissions that trigger duplicate acknowledgments. The reaction to the arrival of these duplicate ACKs in TCP implementations varies widely. This document does not specify how to treat such acknowledgments, but does note this as an area that may benefit from additional attention, experimentation and specification ๐Ÿง

3.2. Fast Retransmit/Fast Recovery โœจ

okay bestie, a TCP receiver SHOULD send an immediate duplicate ACK whenever an out-of-order segment shows up ๐Ÿฆ‹. The whole point is to tell the sender "hey, this one came in out of order, and this is the sequence number I'm still waiting for" ๐Ÿ’…. From the sender's side, duplicate ACKs can come from a few different network drama situations ๐Ÿ˜ญ. First, segments can get dropped, and then every segment after the dropped one keeps triggering duplicate ACKs until the loss is fixed. Second, the network can reorder data segments (which is not a rare thing on some paths [Pax97]). Third, the network can replicate ACK or data segments. Also, a TCP receiver SHOULD send an immediate ACK when the incoming segment fills in all or part of a gap in the sequence space ๐Ÿซถ. This gives a sender recovering from a loss through a retransmission timeout, a fast retransmit, or an advanced loss recovery algorithm (as outlined in section 4.3) much more timely info, which is so important ๐Ÿ”ฅ.

The TCP sender SHOULD use the "fast retransmit" algorithm to detect and repair loss, based on incoming duplicate ACKs ๐Ÿงš. This algorithm treats the arrival of 3 duplicate ACKs (as defined in section 2, without any intervening ACKs which move SND.UNA) as a sign that a segment has been lost. After getting 3 duplicate ACKs, TCP retransmits what looks like the missing segment, without waiting for the retransmission timer to expire ๐Ÿ’จ.

Once the fast retransmit algorithm sends what looks like the missing segment, the "fast recovery" algorithm takes over and governs the transmission of new data until a non-duplicate ACK arrives ๐ŸŒธ. Why no slow start? Because those duplicate ACKs don't just mean a segment got lost, they also mean segments are most likely leaving the network (although a massive segment duplication by the network can mess with this conclusion ๐Ÿ™ˆ). Here's the logic: the receiver can only generate a duplicate ACK when a segment has arrived, so that segment has left the network and is sitting in the receiver's buffer, meaning it's no longer eating up network resources. Plus, since the ACK "clock" [Jac88] is preserved, the TCP sender can keep sending new segments (though transmission must continue using a reduced cwnd, since loss is an indication of congestion ๐Ÿ“).

The fast retransmit and fast recovery algorithms work together like this ๐Ÿ‘‘:

  1. On the first and second duplicate ACKs received at a sender, a TCP SHOULD send a segment of previously unsent data per [RFC3042], provided that the receiver's advertised window allows it, the total FlightSize would stay less than or equal to cwnd plus 2*SMSS, and new data is available for transmission. Also, the TCP sender MUST NOT change cwnd to reflect these two segments [RFC3042]. Note that a sender using SACK [RFC2018] MUST NOT send new data unless the incoming duplicate acknowledgment contains new SACK information.
  2. When the third duplicate ACK is received, a TCP MUST set ssthresh to no more than the value given in equation (4). When [RFC3042] is in use, additional data sent in limited transmit MUST NOT be included in this calculation.
  3. The lost segment starting at SND.UNA MUST be retransmitted, and cwnd gets set to ssthresh plus 3*SMSS. This artificially "inflates" the congestion window by the number of segments (three) that have left the network and which the receiver has buffered ๐ŸŽ€.
  4. For each additional duplicate ACK received (after the third), cwnd MUST be incremented by SMSS. This artificially inflates the congestion window to reflect the additional segment that has left the network.

Note: [SCWA99] discusses a receiver-based attack where lots of bogus duplicate ACKs get sent to the data sender in order to artificially inflate cwnd and cause a higher than appropriate sending rate to be used ๐Ÿšจ. So a TCP MAY therefore limit the number of times cwnd is artificially inflated during loss recovery to the number of outstanding segments (or an approximation of that).

Note: When an advanced loss recovery mechanism (such as the one outlined in section 4.3) is not in use, this increase in FlightSize can cause equation (4) to slightly inflate cwnd and ssthresh, because some of the segments between SND.UNA and SND.NXT are assumed to have left the network but are still reflected in FlightSize ๐Ÿค”.

  1. When previously unsent data is available and the new value of cwnd and the receiver's advertised window allow it, a TCP SHOULD send 1*SMSS bytes of previously unsent data โœจ.
  2. When the next ACK arrives that acknowledges previously unacknowledged data, a TCP MUST set cwnd to ssthresh (the value set in step 2). This is termed "deflating" the window ๐Ÿซง.

This ACK should be the acknowledgment elicited by the retransmission from step 3, one RTT after the retransmission (though it may arrive sooner if there's significant out-of-order delivery of data segments at the receiver). Also, this ACK should acknowledge all the intermediate segments sent between the lost segment and the receipt of the third duplicate ACK, if none of these were lost.

Note: This algorithm is known to generally not recover efficiently from multiple losses in a single flight of packets [FF96]. Section 4.3 below addresses such cases ๐Ÿ’€.


4. Additional Considerations ๐ŸŒˆ

4.1. Restarting Idle Connections

Okay, so here's a known problem with the TCP congestion control algorithms we just covered ๐Ÿ˜ฌ. They can allow a potentially inappropriate burst of traffic to get sent after TCP has been idle for a relatively long period. After an idle period, TCP can't use the ACK clock to strobe new segments into the network, because all the ACKs have drained from the network. So, as specified above, TCP can potentially send a cwnd-size line-rate burst into the network after an idle period ๐Ÿ’ฅ. On top of that, changing network conditions may have made TCP's notion of the available end-to-end network capacity between two endpoints (as estimated by cwnd) inaccurate during a long idle period.

[Jac88] recommends that a TCP use slow start to restart transmission after a relatively long idle period. Slow start restarts the ACK clock, just like it does at the beginning of a transfer. This mechanism has been widely deployed in the following way: when TCP has not received a segment for more than one retransmission timeout, cwnd is reduced to the value of the restart window (RW) before transmission begins ๐ŸŒท.

For the purposes of this standard, we define RW = min(IW,cwnd).

Using the last time a segment was received to decide whether or not to decrease cwnd can fail to deflate cwnd in the common case of persistent HTTP connections [HTH98] ๐Ÿ™ƒ. In this case, a Web server receives a request before transmitting data to the Web client. Receiving that request makes the test for an idle connection fail, and lets TCP begin transmission with a possibly inappropriately large cwnd.

So, a TCP SHOULD set cwnd to no more than RW before beginning transmission if the TCP has not sent data in an interval exceeding the retransmission timeout ๐Ÿญ.

4.2. Generating Acknowledgments

The delayed ACK algorithm specified in [RFC1122] SHOULD be used by a TCP receiver ๐ŸŽง. When using delayed ACKs, a TCP receiver MUST NOT excessively delay acknowledgments. Specifically, an ACK SHOULD be generated for at least every second full-sized segment, and MUST be generated within 500 ms of the arrival of the first unacknowledged packet โฐ.

The requirement that an ACK "SHOULD" be generated for at least every second full-sized segment is listed in [RFC1122] in one place as a SHOULD and in another as a MUST. Here we unambiguously state that it is a SHOULD. We also emphasize that this is a SHOULD, which means an implementor should only deviate from this requirement after careful consideration of the implications ๐Ÿง. See the discussion of "Stretch ACK violation" in [RFC2525] and the references therein for a discussion of the possible performance problems with generating ACKs less frequently than every second full-sized segment.

Sometimes the sender and receiver don't agree on what counts as a full-sized segment ๐Ÿคทโ€โ™€๏ธ. An implementation is deemed to comply with this requirement if it sends at least one acknowledgment every time it receives 2*RMSS bytes of new data from the sender, where RMSS is the Maximum Segment Size specified by the receiver to the sender (or the default value of 536 bytes, per [RFC1122], if the receiver does not specify an MSS option during connection establishment). The sender may be forced to use a segment size less than RMSS because of the maximum transmission unit (MTU), the path MTU discovery algorithm, or other factors. For instance, consider the case where the receiver announces an RMSS of X bytes but the sender ends up using a segment size of Y bytes (Y < X) because of path MTU discovery (or the sender's MTU size). The receiver will generate stretch ACKs if it waits for 2*X bytes to arrive before sending an ACK. Clearly this will take more than 2 segments of size Y bytes. So, while a specific algorithm is not defined, it's desirable for receivers to try to prevent this situation, for example by acknowledging at least every second segment, regardless of size ๐Ÿซถ. Finally, we repeat that an ACK MUST NOT be delayed for more than 500 ms while waiting on a second full-sized segment to arrive.

Out-of-order data segments SHOULD be acknowledged immediately, to speed up loss recovery ๐Ÿš€. To trigger the fast retransmit algorithm, the receiver SHOULD send an immediate duplicate ACK when it receives a data segment above a gap in the sequence space. To give feedback to senders recovering from losses, the receiver SHOULD send an immediate ACK when it receives a data segment that fills in all or part of a gap in the sequence space ๐Ÿ’–.

A TCP receiver MUST NOT generate more than one ACK for every incoming segment, other than to update the offered window as the receiving application consumes new data (see [RFC813] and page 42 of [RFC793]) ๐ŸŒธ.

4.3. Loss Recovery Mechanisms โœจ

okay so TCP researchers have cooked up a bunch of loss recovery algorithms that build on fast retransmit and fast recovery, and they're written up in the RFC series ๐Ÿงš some of them lean on the TCP selective acknowledgment (SACK) option [RFC2018], like [FF96], [MM96a], [MM96b], and [RFC3517]. others don't need SACKs at all, like [Hoe96], [FF96], and [RFC3782]. the non-SACK ones use "partial acknowledgments" (ACKs that cover some previously unacknowledged data, but not all the data that was outstanding when the loss got detected) to kick off retransmissions ๐Ÿ’… this document doesn't standardize any one of these specific algorithms, but they're implicitly allowed as long as they follow the general principles of the basic four algorithms we covered above ๐Ÿซถ

so here's the vibe. when the first loss in a window of data is detected, ssthresh MUST be set to no more than the value given by equation (4). next, until all the lost segments in that window are repaired, the number of segments sent in each RTT MUST be no more than half the number of outstanding segments when the loss was detected. then, once all the loss in that window has been successfully retransmitted, cwnd MUST be set to no more than ssthresh, and congestion avoidance MUST be used to grow cwnd from there ๐Ÿ“ˆ and if there's loss in two successive windows of data, or the loss of a retransmission, that should be taken as two indications of congestion, so cwnd (and ssthresh) MUST be lowered twice in this case ๐Ÿ˜ญ

the big takeaway: multiple losses = multiple cuts. don't be the sender who ignores the signs ๐Ÿ™ˆ

we RECOMMEND that TCP implementors use some form of advanced loss recovery that can handle multiple losses in a single window of data ๐ŸŒˆ the algorithms in [RFC3782] and [RFC3517] both conform to the general principles we just went over. these aren't the only two algorithms that do, but they've been vetted by the community and are currently on the Standards Track, so they're a very safe bet ๐ŸŽ€


5. Security Considerations ๐Ÿ”

this document requires a TCP to lower its sending rate when there are retransmission timeouts and when duplicate acknowledgments show up. so an attacker can absolutely mess with a TCP connection's performance by making data packets or their acknowledgments get lost, or by forging a bunch of excessive duplicate acknowledgments ๐Ÿ˜ˆ

in response to the ACK division attack described in [SCWA99], this document RECOMMENDS increasing the congestion window based on the number of bytes newly acknowledged in each arriving ACK, instead of by a fixed constant on each arriving ACK (as described in section 3.1) ๐Ÿ›ก๏ธ

the Internet, to a pretty big degree, depends on these algorithms being implemented correctly to keep the network stable and avoid congestion collapse ๐Ÿšจ an attacker could make TCP endpoints respond way more aggressively to congestion by forging excessive duplicate acknowledgments or excessive acknowledgments for new data. and honestly? that attack could conceivably push part of the network into congestion collapse. this is serious, bestie ๐Ÿ’€


6. Changes between RFC 2001 and RFC 2581 ๐Ÿ“œ

[RFC2001] got a massive editorial rewrite, so it isn't really feasible to list every change between [RFC2001] and [RFC2581] ๐Ÿ˜ตโ€๐Ÿ’ซ the intention of [RFC2581] was not to change any of the recommendations in [RFC2001], just to clarify cases that weren't discussed in detail there. specifically, [RFC2581] suggested what TCP connections should do after a relatively long idle period, and it specified and clarified some of the issues around TCP ACK generation. finally, the allowable upper bound for the initial congestion window got raised from one to two segments ๐Ÿ“


7. Changes Relative to RFC 2581 ๐Ÿฆ‹

a specific definition for "duplicate acknowledgment" has been added, based on the one used by BSD TCP ๐Ÿง 

the document now notes that what to do with duplicate ACKs after the retransmission timer has fired is future work, and it's explicitly left unspecified in this document ๐Ÿคทโ€โ™€๏ธ

the initial window requirements changed to allow Larger Initial Windows, as standardized in [RFC3390]. on top of that, the steps to take when an initial window is discovered to be too large because of Path MTU Discovery [RFC1191] are now spelled out ๐Ÿ—บ๏ธ

the recommended initial value for ssthresh changed to say that it SHOULD be arbitrarily high, where it used to be MAY. this gives implementors more guidance on the matter โœจ

during slow start, using Appropriate Byte Counting [RFC3465] with L=1*SMSS is explicitly recommended. the method of increasing cwnd given in [RFC2581] is still explicitly allowed. byte counting during congestion avoidance is also recommended, while the method from [RFC2581] and other safe methods are still allowed ๐Ÿ”ข

the treatment of ssthresh on retransmission timeout got clarified. in particular, ssthresh must be set to half the FlightSize on the first retransmission of a given segment, and then it is held constant on subsequent retransmissions of that same segment ๐ŸงŠ

the description of fast retransmit and fast recovery got clarified too, and the use of Limited Transmit [RFC3042] is now recommended ๐Ÿ’–

TCPs now MAY limit the number of duplicate ACKs that artificially inflate cwnd during loss recovery to the number of segments outstanding, which helps avoid the duplicate ACK spoofing attack described in [SCWA99] ๐Ÿ•ต๏ธโ€โ™€๏ธ

the restart window changed from IW to min(IW,cwnd). this behavior was described as "experimental" in [RFC2581] ๐ŸŒธ

it is now recommended that TCP implementors implement an advanced loss recovery algorithm that conforms to the principles outlined in this document ๐Ÿ‘‘

the security considerations got updated to discuss ACK division and to recommend byte counting as a counter to this attack ๐Ÿ”


8. Acknowledgments ๐Ÿซถ

the core algorithms we describe were developed by Van Jacobson [Jac88, Jac90] ๐Ÿงšโ€โ™€๏ธ Limited Transmit [RFC3042] was developed in conjunction with Hari Balakrishnan and Sally Floyd. the initial congestion window size specified in this document is the result of work with Sally Floyd and Craig Partridge [RFC2414, RFC3390] ๐Ÿ’œ

W. Richard ("Rich") Stevens wrote the first version of this document [RFC2001] and co-authored the second version [RFC2581]. this present version benefits hugely from his clarity and thoughtfulness of description, and we're so grateful for Rich's contributions in explaining TCP congestion control, as well as in helping us understand a ton of networking issues more broadly ๐Ÿฅน

we want to emphasize that the shortcomings and mistakes of this document are solely the responsibility of the current authors ๐Ÿ™ˆ

some of the text in this document is taken from "TCP/IP Illustrated, Volume 1: The Protocols" by W. Richard Stevens (Addison-Wesley, 1994) and "TCP/IP Illustrated, Volume 2: The Implementation" by Gary R. Wright and W. Richard Stevens (Addison-Wesley, 1995). this material is used with the permission of Addison-Wesley ๐Ÿ“š

Anil Agarwal, Steve Arden, Neal Cardwell, Noritoshi Demizu, Gorry Fairhurst, Kevin Fall, John Heffner, Alfred Hoenes, Sally Floyd, Reiner Ludwig, Matt Mathis, Craig Partridge, and Joe Touch all contributed a number of helpful suggestions ๐ŸŽ€


9. References ๐Ÿ“š

9.1. Normative References

[RFC793]  Postel, J., "Transmission Control Protocol", STD 7, RFC
          793, September 1981.

[RFC1122] Braden, R., Ed., "Requirements for Internet Hosts -
          Communication Layers", STD 3, RFC 1122, October 1989.

[RFC1191] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191,
          November 1990.

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
          Requirement Levels", BCP 14, RFC 2119, March 1997.

9.2. Informative References โœจ

okay bestie, these are the receipts ๐Ÿงพ every paper and older RFC the spec leans on, so you can go check the sources yourself ๐Ÿ”

  • [CJ89] Chiu, D. and R. Jain, "Analysis of the Increase/Decrease Algorithms for Congestion Avoidance in Computer Networks", Journal of Computer Networks and ISDN Systems, vol. 17, no. 1, pp. 1-14, June 1989.
  • [FF96] Fall, K. and S. Floyd, "Simulation-based Comparisons of Tahoe, Reno and SACK TCP", Computer Communication Review, July 1996, ftp://ftp.ee.lbl.gov/papers/sacks.ps.Z.
  • [Hoe96] Hoe, J., "Improving the Start-up Behavior of a Congestion Control Scheme for TCP", In ACM SIGCOMM, August 1996.
  • [HTH98] Hughes, A., Touch, J., and J. Heidemann, "Issues in TCP Slow-Start Restart After Idle", Work in Progress, March 1998.
  • [Jac88] Jacobson, V., "Congestion Avoidance and Control", Computer Communication Review, vol. 18, no. 4, pp. 314-329, Aug. 1988. ftp://ftp.ee.lbl.gov/papers/congavoid.ps.Z.
  • [Jac90] Jacobson, V., "Modified TCP Congestion Avoidance Algorithm", end2end-interest mailing list, April 30, 1990. ftp://ftp.isi.edu/end2end/end2end-interest-1990.mail.
  • [MM96a] Mathis, M. and J. Mahdavi, "Forward Acknowledgment: Refining TCP Congestion Control", Proceedings of SIGCOMM'96, August, 1996, Stanford, CA. Available from http://www.psc.edu/networking/papers/papers.html
  • [MM96b] Mathis, M. and J. Mahdavi, "TCP Rate-Halving with Bounding Parameters", Technical report. Available from http://www.psc.edu/networking/papers/FACKnotes/current.
  • [Pax97] Paxson, V., "End-to-End Internet Packet Dynamics", Proceedings of SIGCOMM '97, Cannes, France, Sep. 1997.
  • [RFC813] Clark, D., "Window and Acknowledgement Strategy in TCP", RFC 813, July 1982.
  • [RFC2001] Stevens, W., "TCP Slow Start, Congestion Avoidance, Fast Retransmit, and Fast Recovery Algorithms", RFC 2001, January 1997.
  • [RFC2018] Mathis, M., Mahdavi, J., Floyd, S., and A. Romanow, "TCP Selective Acknowledgment Options", RFC 2018, October 1996.
  • [RFC2414] Allman, M., Floyd, S., and C. Partridge, "Increasing TCP's Initial Window", RFC 2414, September 1998.
  • [RFC2525] Paxson, V., Allman, M., Dawson, S., Fenner, W., Griner, J., Heavens, I., Lahey, K., Semke, J., and B. Volz, "Known TCP Implementation Problems", RFC 2525, March 1999.
  • [RFC2581] Allman, M., Paxson, V., and W. Stevens, "TCP Congestion Control", RFC 2581, April 1999.
  • [RFC2883] Floyd, S., Mahdavi, J., Mathis, M., and M. Podolsky, "An Extension to the Selective Acknowledgement (SACK) Option for TCP", RFC 2883, July 2000.
  • [RFC2988] Paxson, V. and M. Allman, "Computing TCP's Retransmission Timer", RFC 2988, November 2000.
  • [RFC3042] Allman, M., Balakrishnan, H., and S. Floyd, "Enhancing TCP's Loss Recovery Using Limited Transmit", RFC 3042, January 2001.
  • [RFC3168] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition of Explicit Congestion Notification (ECN) to IP", RFC 3168, September 2001.
  • [RFC3390] Allman, M., Floyd, S., and C. Partridge, "Increasing TCP's Initial Window", RFC 3390, October 2002.
  • [RFC3465] Allman, M., "TCP Congestion Control with Appropriate Byte Counting (ABC)", RFC 3465, February 2003.
  • [RFC3517] Blanton, E., Allman, M., Fall, K., and L. Wang, "A Conservative Selective Acknowledgment (SACK)-based Loss Recovery Algorithm for TCP", RFC 3517, April 2003.
  • [RFC3782] Floyd, S., Henderson, T., and A. Gurtov, "The NewReno Modification to TCP's Fast Recovery Algorithm", RFC 3782, April 2004.
  • [RFC4821] Mathis, M. and J. Heffner, "Packetization Layer Path MTU Discovery", RFC 4821, March 2007.
  • [SCWA99] Savage, S., Cardwell, N., Wetherall, D., and T. Anderson, "TCP Congestion Control With a Misbehaving Receiver", ACM Computer Communication Review, 29(5), October 1999.
  • [Ste94] Stevens, W., "TCP/IP Illustrated, Volume 1: The Protocols", Addison-Wesley, 1994.
  • [WS95] Wright, G. and W. Stevens, "TCP/IP Illustrated, Volume 2: The Implementation", Addison-Wesley, 1995.

Authors' Addresses ๐ŸŽ€

these are the lovely people who wrote it, with exactly how to reach them ๐Ÿ’Œ

Mark Allman
International Computer Science Institute (ICSI)
1947 Center Street
Suite 600
Berkeley, CA 94704-1198
Phone: +1 440 235 1792
EMail: mallman@icir.org
http://www.icir.org/mallman/


Vern Paxson
International Computer Science Institute (ICSI)
1947 Center Street
Suite 600
Berkeley, CA 94704-1198
Phone: +1 510/642-4274 x302
EMail: vern@icir.org
http://www.icir.org/vern/


Ethan Blanton
Purdue University Computer Sciences
305 North University Street
West Lafayette, IN  47907
EMail: eblanton@cs.purdue.edu
http://www.cs.purdue.edu/homes/eblanton/
๐Ÿ“ฆ where this page comes from