The second question:
The main principle of TCP congestion control depends on the congestion window (cwnd). Before that, we also discussed that TCP also has a receiving window (rwnd) for peer-to-peer notification of flow control. The size of the window indicates the maximum data segment that can be sent but has not received an ACK. Obviously, the larger the window, the faster the data transmission speed, but it is also more likely to cause network congestion. If the window value is 1, it will be simplified to a stop-and-wait protocol. Every time you send a data, you have to wait for the other party to confirm before sending the second data packet. Obviously, the data transmission efficiency is low. TCP's congestion control algorithm is to balance the two, choose the best cwnd value, maximize the network throughput and avoid congestion.
Slow startup: The initial TCP will send a large number of packets to the network after the connection is established successfully, which will easily lead to the exhaustion of router cache space in the network, thus causing congestion. Therefore, the newly established connection cannot send a large number of data packets at the beginning, and can only gradually increase the amount of data sent each time according to the network situation to avoid the above phenomenon. Specifically, when a new connection is established, cwnd is initialized to the size of 1 maximum message segment (MSS), and the sender starts sending data according to the congestion window size. Every time a message segment is acknowledged, cwnd increases by 1 millisecond. Thus, the value of cwnd increases exponentially with the round trip time (RTT) of the network. In fact, the speed of slow startup is not slow at all, but the starting point is relatively low. We can simply calculate:
Go -> cwnd = 1
After 1 RTT.
-& gt; cwnd = 2* 1 = 2
After two RTT-> cwnd = 2 * 2 = 4
After 3 RTTs -> cwnd = 4*2 = 8