TCP Slow Start Algorithm

Source: Internet
Author: User
Definition of slow start

Slow Start is a blocking control mechanism used by the transmission control protocol. Slow Start is also called exponential growth period. Slow start means that the TCP receiving window increases every time it receives confirmation. The added size is the number of confirmed segments. In this case, either the segment is not received or the window size reaches the predefined threshold. If a loss event occurs, TCP considers this as a network congestion and takes measures to reduce network congestion. Once a loss event occurs or the threshold is reached, TCP will enter the linear growth phase. At this time, each time a RTT window is passed, a segment is increased.

Slow Start Parsing

The sender sends multiple packet segments to the network at the beginning until the size of the window advertised by the receiver is reached. This method works when the sender and receiver are in the same LAN. However, if there are multiple routers and slow links between the sender and receiver, some problems may occur.
Some intermediate routers must cache groups and may exhaust storage space.
TCP now needs to support a typeAlgorithm. This algorithm works by observing that the rate at which the new group enters the network should be the same as the rate at which the other end returns confirmation.
Slow Start adds another window for the sender's TCP: congestion window, which is marked as cwnd. When a t c p connection is established with the host of another network, the congestion window is initialized as one packet segment (that is, the packets advertised by the other end ).
Segment size ). Each time an ACK is received, a packet segment is added to the congestion window (The unit of c w n d is byte, but the unit of slow start is increased by the packet segment size ). The sender takes the minimum value in the congestion window and notification window as the maximum sending limit. Owner
The congestion window is the traffic control used by the sender, while the notification window is the traffic control used by the receiver. The sender sends a packet segment at the beginning and waits for a c k. When the c k is received, the congestion window is increased from 1 to 2, that is, two packets can be sent. When the c k of the two packets are received, the congestion window is increased to 4. This is an exponential increase.

On some points, the Internet capacity can be reached, so the intermediate router begins to discard the group. This notifies the sender that its congestion window is too large. When we discuss t c p's timeout and retransmission mechanisms in the next chapter, we will see how they work on the congestion window. Now, let's look at a real slow start.

Slow network example

Indicates the data that will be sent from the host sun to the host vangogh.cs.berkeley.edu. The data will pass through a slow slip link, which is a bottleneck on TCP connections (we have removed the connection establishment process from the time series ).

We observe that the sender sends a packet segment of 5 to 2 bytes and then waits for Ack. The Ack is received after 716 Ms. This time indicates a round-trip time. Therefore, the congestion window adds two packet segments and sends two more packets.
Text. When an ACK of packet segment 5 is received, the congestion window is increased to 3. At this time, although up to three packet segments can be sent, only two packet segments are sent before the next Ack is received.

 

Normal network example

In a normal network, the server is in the public network, and the client is a virtual machine. Through the client 223.226.200.34, each time the data is sent to the server 223.226.200.200 in the size of 102400, the number of cycles is 1000. The network between the two parties is good. At the beginning, each time the client sends a data, the server sends an ACK as follows:

 17 : 11 : 42.437707 IP223.226 . 200.34 . 42567 > 223.226 . 200.200 . 6888 : Flags [P.], seq 1 : 1025 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val 2003558 ECR 972961746 ], Length 1024 
17 : 11 : 42.437721 IP 223.226 . 200.200 . 6888 > 223.226 . 200.34 . 42567 : Flags [.], Ack 1025 , Win 33 , Options [NOP, NOP, TS Val 972961748 ECR2003558 ], Length 0
17 : 11 : 42.437805 IP 223.226 . 200.34 . 42567 > 223.226 . 200.200 . 6888 : Flags [P.], seq 1025 : 2485 , Ack1 , Win 64240 , Options [NOP, NOP, TS Val 2003558 ECR 972961746 ], Length 1460
17 : 11 : 42.437816 IP 223.226 . 200.200 . 6888 > 223.226 . 200.34 .42567 : Flags [.], Ack 2485 , Win 38 , Options [NOP, NOP, TS Val 972961748 ECR 2003558 ], Length 0
....
17 : 11 : 42.468767 IP 223.226 . 200.34 . 42567 >223.226 . 200.200 . 6888 : Flags [P.], seq 24025 : 25461 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val 2003558 ECR 972961753 ], Length 1436
17 : 11 : 42.468780 IP 223.226 . 200.200 . 6888 > 223.226 . 200.34 . 42567 : Flags [.], Ack 25461 , Win 83 , Options [NOP, NOP, TS Val 972961756 ECR 2003558 ], Length 0

We can see that the time difference between two packets is no more than 50 ms, usually 20 ms.

But later, it may be because some intermediate routers must cache groups and may exhaust storage space. As a result, the server cannot respond in time and confirm the data as follows:

17 : 11 : 42.468965 IP 223.226 . 200.34 . 42567 > 223.226 . 200.200 . 6888 : Flags [.], seq 25461 : 26897 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val2003558 ECR 972961753 ], Length 1436 
17 : 11 : 42.469200 IP 223.226 . 200.34 . 42567 > 223.226 . 200.200 . 6888 : Flags [P.], seq 26897 :28333 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val 2003558 ECR 972961753 ], Length 1436
......
17 : 11 : 42.478755 IP 223.226 . 200.34 .42567 > 223.226 . 200.200 . 6888 : Flags [P.], seq 52745 : 54181 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val 2003558 ECR 972961756 ], Length 1436
17 : 11 : 42.507104 IP 223.226 . 200.200 . 6888 > 223.226 . 200.34 . 42567 : Flags [.], Ack 54181 , Win 27 , Options [NOP, NOP, TS Val 972961766 ECR 2003558 ], Length 0
17 : 11 : 42.516476 IP 223.226 . 200.34 . 42567 > 223.226 . 200.200 . 6888 : Flags [P.], seq 54181 : 55617 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val2003558 ECR 972961766 ], Length 1436
17 : 11 : 42.516597 IP 223.226 . 200.34 . 42567 > 223.226 . 200.200 . 6888 : Flags [P.], seq 55617 :57053 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val 2003558 ECR 972961766 ], Length 1436
......
17 : 11 : 42.517263 IP 223.226 . 200.34 . 42567 >223.226 . 200.200 . 6888 : Flags [P.], seq 64233 : 65669 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val 2003558 ECR 972961766 ], Length 1436
17 : 11 : 42.517437 IP 223.226 . 200.34 . 42567 > 223.226 . 200.200 . 6888 : Flags [P.], seq 65669 : 67105 , Ack 1 , Win 64240 , Options [NOP, NOP, TS Val 2003558 ECR 972961766 ], Length1436
17 : 11 : 42.555104 IP 223.226 . 200.200 . 6888 > 223.226 . 200.34 . 42567 : Flags [.], Ack 67105 , Win 2 , Options [NOP, NOP, TS Val 972961778 ECR2003558 ], Length 0
17 : 11 : 47.457101 IP 223.226 . 200.34 . 42567 > 223.226 . 200.200 . 6888 : Flags [P.], seq 67105 : 68129 , Ack1 , Win 64240 , Options [NOP, NOP, TS Val 2003608 ECR 972961778 ], Length 1024
17 : 11 : 47.457116 IP 223.226 . 200.200 . 6888 > 223.226 . 200.34 .42567 : Flags [.], Ack 68129 , Win 0 , Options [NOP, NOP, TS Val 972963003 ECR 2003608 ], Length 0

We can see that the client continuously sends data to these packets on the server. The time difference between each two packets is relatively large, basically reaching a gap of more than Ms, therefore, it can be determined that the server sends an ACK packet too late, and the sender will send multiple packets consecutively Based on the congestion window size.

In addition, the serverCodeIs your ownProgramThere is no read data, so we will see that win is getting smaller and smaller. No data can be received until win is 0.

Reference: TCP/IP details

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.