TCP flow control and congestion control

As mentioned before, since it is inefficient to return Ack each time a TCP segment is received, TCP is not required to return Ack until a specified amount of TCP segments are received.That mechanism is called Window .

"Specified amount" can be notified by TCP syn or syn/ack, which is sent to the opponent. Specifically, it is determined by "Window" Field and optional "Window Scale".

For example, if "Window: Ox2000 = 8192 Byte = 8 KB" and "Window Scale: Ox08 = 2
to the 8th power = 256 times", 8 KB * 256 = 2 MB.

In this case, you do not have to return ACK until you receive 2 MB of data. In addition, these numbers are determined by themselves depending on their own "reception buffer".

First of all, data transmission/reception is started with this initial value, but each time data reception is performed, the number of buffers that can receive decreases.

Sliding Window tells the situation in real time.

Sliding Window

Sliding Window is a mechanism to inform its own buffer to the opponent in real time , and it is an implementation of flow control. It can tell the opponent using the same "Window" field the value subtracting the buffer in use for processing from the specified amount of Window that was first determined.

The opponent receiving the Window field can also send the corresponding data without Ack. This kind of operation makes communication more efficient.

However, please be aware that this is only for the host , that there is only this host's receive buffer .

Slow Start Algorithm

In the previous example, if you send suddenly 2 MB, you may get over capacity of the network (not the host). If it is, you need to think about the convenience of the network . Slow Start Algorithm is an implementation of congestion control that takes into account the circumstances of the network. It is defined in RFC 5681.

There are the following two parameters to manage this algorithm. Both units are Byte.

  1. Congestion Window (CW)
  2. Slow Start Threshold (SST)

CW is basically an integer multiple of MSS . It transmits packets as many as [Initial value]/MSS and increases the transmission data by a factor of 2 until the transmission data reaches the value of SST.

When the threshold is exceeded, it increases by several packets until it detects congestion. If congestion is detected, CW returns to the initial value and SST is set to half of CW just before RTO occurrence.

There are two timing(methods) of detecting congestion, one is when it does not return Ack for RTO time, the other is when packet loss is detected by Dup Ack within RTO.

In Windows 10, the initial value of CW seems to be 10 * MSS .(4 * MSS until Windows 8.1)

For studying TCP / UDP, the following books are recommended.

To share

  • このエントリーをはてなブックマークに追加

To follow