Linux TCP congestion control implementation mechanism

Source: Internet
Author: User

Several important counters:

Packets_out: Packet after snd. una

Sacked_out: Packets confirmed by SACK (duplicate ack also causes this count to + 1 if no SACK exists)

Lost_out: Estimation of lost packets in the Network

Retrans_out: retransmission packet count

 

Here, lost_out is an estimated value, depending on the specific implementation.

Packet in_flight = packets_out + retrans_out-left_out residing in the network.

Left_out indicates the number of data packets that have left the network. left_out = sacked_out + lost_out.

 

In addition, packets in the sending queue are marked with: (kernel annotation)

We have three tag bits: SACKED (S), RETRANS (R) and LOST (L ).
Packets in queue with these bits set are counted in variables
Sacked_out, retrans_out and lost_out, correspondingly.
 
Valid combinations are:
Tag InFlight Description
0 1-orig segment is in flight.
S 0-nothing flies, orig reached receiver.
L 0-nothing flies, orig lost by net.
R 2-both orig and retransmit are in flight.
L | R 1-orig is lost, retransmit is in flight.
S | R 1-orig reached receiver, retrans is still in flight.
(L | S | R is logically valid, it cocould occur when L | R is sacked,
But it is equivalent to plain S and code short-curcuits it to S.
L | S is logically invalid, it wocould mean-1 packet in flight 8 ))

 

In NewReno, when the sender enters the recovery status, the first unconfirmed packet is marked as lost;

In sack, the hole between the sack blocks is marked as lost (fack ).

 

TCP congestion control state machine (triggered by ACK)

A open status. Normal status. Execute the slow start algorithm or the congestion avoid algorithm, depending on the congestion window and ssthresh size.

 

B disorder status. This status is returned when duplicate ACK or sack is detected. In this status, the congestion window is not adjusted. If no data packet is received, the transmission of a new data packet is triggered.

 

C CWR status. This status is returned when a congestion prompt is detected due to ECN, ICMP, or local settings. In this state, every time two ACK packets are received, the congestion window is-1 until it is halved.

 

D recovery status. This status is entered when three duplicate ACK packets are detected, which generally enters the disorder status. Re-transmit the first unconfirmed packet immediately. The congestion window is-1 every time two ACK packets are received,

Until you see ssthresh (this value is set to half of the congestion window when you enter the recovery status ). TCP stays in this status until all the packets that reside in the network are confirmed, and then

Return to open status

E loss status. This status is enabled when RTO timer times out. All packets residing in the network are marked as lost, and the congestion window is set to 1. The slow start algorithm is enabled.

When all packets that reside in the network are confirmed, they are returned to the open state.

 

There are occasions where the number of outstanding

Packets decreases suddenly by several segments.
Example, a retransmitted segment and the following forward
Transmissions can be acknowledged with a single
Cumulative ACK. These situations wowould cause bursts
Data to be transmitted into the network, unless they are
Taken into account in the TCP sender implementation.
The Linux TCP sender avoids the bursts by limiting
Congestion window to allow at most three segments to be
Transmitted for an incoming ACK. Since burst avoidance
May reduce the congestion window size below the slow
Start threshold, it is possible for the sender to enter slow
Start after several segments have been acknowledged
A single ACK.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.