TCP Slow Start algorithm

Source: Internet
Author: User
Tags ack

slow start definition

Slow start is a blocking control mechanism used by the transmission protocol. Slow start is also called exponential growth period. Slow start means that each time the TCP receive window receives confirmation, it will grow. The increased size is the number of confirmed segments. This situation is maintained until either no segment is received or the window size reaches a predefined threshold. If a loss occurs, TCP considers it to be a network congestion and takes steps to mitigate the congestion on the network. Once a loss event or threshold is reached, TCP enters the linear growth phase. At this point, a segment is grown for each of the RTT windows.

Slow start parsing

The sender sends multiple segments of the packet to the network at the outset until the window size advertised by the receiver is reached. This is possible when both the sender and receiver are on the same LAN. However, if there are multiple routers and slow links between the sender and the receiver, some problems may occur.
Some intermediate routers must cache packets and potentially run out of memory space.
Now, TCP needs to support an algorithm called slow start (slow start). The algorithm works by observing that the rate at which the new packet enters the network should be the same as the rate at which the other end returns confirmation.
Slow start adds another window to the sender's TCP: The Congestion window (congestion windows), which is recorded as CWnd. When a T-C p connection is established with the host of another network, the congestion window is initialized to 1 segments (that is, messages advertised at the other end)
Segment size). Each time an ACK is received, the Congestion window adds a message segment (c w n d in bytes, but the slow start is incremented in the packet segment size). The sender takes the congestion window with the minimum value in the notification window as the sending upper limit. Hold
The plug-in window is the traffic control used by the sender, and the notification window is the traffic control used by the receiver. The sender begins by sending a message segment, and then waits for a C K. When the A C K is received, the congestion window increases from 1 to 2, which means that two segments of the message can be sent. When a C K is received for these two segments, the congestion window is increased to 4. This is an exponential increase in the relationship.

The capacity of the Internet may be reached at some point, so the intermediate routers start dropping the packets. This informs the sender that its congestion window is too large. When we discuss the timeout and retransmission mechanisms for T C p in the next chapter, we will see how they work for the congestion window. Now, let's look at a slow start in action.


example of a slow network


Represents the data that will be sent from host Sun to host vangogh.cs.berkeley.edu. This data will pass through a slow slip link, which is a bottleneck on the TCP connection (we have removed the process of connection creation on the time series).

We observed that the sender sent a segment with a length of 5 1 2 bytes, and then waited for an ACK. The ACK is received after 716 Ms. This time is an indication of a round trip time. The Congestion window then adds 2 message segments and sends two
The text section. When the ACK of message Segment 5 is received, the congestion window is increased to 3. At this point, although up to 3 segments can be sent, only 2 segments are sent before the next ACK is received.

Normal Network Example

In a normal network, the server in the public network, the client is a virtual machine, through the client 223.226.200.34, each send size of 102400 size data to the server 223.226.200.200, the number of cycles is 1000 times. The two sides of the network good, at the beginning of the time can reach the client each send a data, the server sends an ACK, as follows:

17:11:42.437707 IP 223.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, Options [Nop,nop,ts Val 97 2961748 ECR 2003558], length 0
17:11:42.437805 IP 223.226.200.34.42567 > 223.226.200.200.6888:flags [P.], seq 1025:2485, ack 1, Win 64240, options [n Op,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, Options [Nop,nop,ts Val 97 2961748 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, options [Nop,nop,ts Val 9 72961756 ECR 2003558], length 0


We can see that the time difference between two messages is not more than 50ms, generally 20ms.

But later, it could be that some intermediate routers have to cache packets and potentially run out of memory space. Causes the service side to be unable to respond in time, confirms 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 Val 2003558 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, options [Nop,nop,ts Val 9 72961766 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 Val 2003558 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], length 1436
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 97 2961778 ECR 2003558], length 0
17:11:47.457101 IP 223.226.200.34.42567 > 223.226.200.200.6888:flags [P.], seq 67105:68129, ack 1, 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 97 2963003 ECR 2003608], length 0


You can see here the client continuously send data to the service side of these messages, the time difference between each of the two messages is relatively large, basically reach the gap of more than 100ms, so it can be determined that the server sent an ACK message too late, the sender will be based on the congestion window size, continuously send multiple pieces of message.

In addition, here the service-side code is its own program, and no read data, so meet to win less and less. Until the last win is 0, no data can be received.

TCP Slow Start algorithm

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.