Timeout resend analysis when the sender sends a TCP segment, the timer starts and waits for the ACK Reply of the TCP segment. If the receiver correctly receives the ordered fragments, the receiver uses the ACK fragments to reply to the sender. After receiving an ACK reply, the sender moves the window and sends the next TCP segment. If the sender still does not receive an ACK reply until the timer is complete, the sender infers that the TCP segment sent earlier is lost, and therefore resends the TCP segment before. The waiting time is RTO (retransmission timeout ). How long should the sender wait for the resend? This is the core issue of resend. The above process actually has two directions: 1. Transmission of the sending part from the sender to the receiver, 2. Transmission of the ACK part from the receiver to the sender. The actual consumed time is the round-trip time (RTT, round trip time ). If the RTT is fixed, for example, 1 second, we can make RTO equal to RTT. But in fact, the up and down of RTT is very large. For example, if there is a lot of traffic in the network at a certain time point, the RTT will increase. In the case of RTT floating, if we set a small RTO, TCP will wait for a short period of time before re-sending, but in fact the fragments sent before are not lost, the transmission speed is slow. In this way, TCP fragments are repeatedly injected into the network, which wastes network transmission resources. On the other hand, if the RTO time is too long, when the TCP segment is actually lost, the sender cannot resend it in time, resulting in idle network resources. Therefore, RTO must meet the current network conditions. The better the network condition, the shorter the RTO. The worse the network condition, the longer the RTO. RTT: the round-trip time TCP protocol determines a reasonable RTO by calculating RTT. The sender can measure the RTT of each TCP transmission (starting from sending the data segment to receiving the ACK segment). The round-trip time of each measurement is called the sampling RTT (srtt, sampling round trip time ). After the connection is established, Each srtt is used as the sample, the mean and standard deviation are calculated, and the RTO is equal to the srtt average plus four times the srtt standard deviation. RTO = mean + 4 std (the preceding algorithms have multiple variants and vary according to the platform). The average value reflects the RTT in the average sense. The larger the average round-trip time, the larger the RTO. The larger the standard deviation also affects RTO. The standard deviation represents the degree of discretization of the RTT sample. If the RTT changes sharply, the standard deviation is relatively large. Large Floating RTT, indicating that the current network is relatively unstable. Therefore, you must set a longer RTO to cope with unstable network conditions.