4.2. Generating Acknowledgments
Delayed ACK Algorithm
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
- An ACK MUST be generated within 500 ms of the arrival of the first unacknowledged packet
Clarification on SHOULD vs MUST
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 another as a MUST. Here we unambiguously state it is a SHOULD.
We also emphasize that this is a SHOULD, meaning that an implementor should indeed 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.
Full-Sized Segment Agreement
In some cases, the sender and receiver may not agree on what constitutes 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).
Path MTU Discovery Consideration
The sender may be forced to use a segment size less than RMSS due to:
- The maximum transmission unit (MTU)
- The path MTU discovery algorithm
- Other factors
For instance, consider the case when the receiver announces an RMSS of X bytes but the sender ends up using a segment size of Y bytes (Y < X) due to 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 an ACK is sent. Clearly this will take more than 2 segments of size Y bytes.
Therefore, while a specific algorithm is not defined, it is desirable for receivers to attempt to prevent this situation, for example, by acknowledging at least every second segment, regardless of size.
Maximum Delay
Finally, we repeat that an ACK MUST NOT be delayed for more than 500 ms waiting on a second full-sized segment to arrive.
Out-of-Order Segments
Out-of-order data segments SHOULD be acknowledged immediately, in order to accelerate 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 provide 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.
ACK Frequency Limit
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]).