TCP Congestion Control

Learn via video courses
Topics Covered

Overview

TCP congestion window and congestion policy are used to avoid network congestion. As the network is the main component in wireless communication, any congestion in a network must be avoided. If the data sent by the sender is not delivered by the network, it must inform the sender about it. The network, other than the receiver also helps in determining the sender's window size.

What is TCP Congestion Control?

Before understanding what is TCP congestion control, let’s first understand what you mean by congestion in the TCP network.

Congestion is an important factor in packet switched network. It refers to the state of a network where the message traffic becomes so heavy that the network response time slows down leading to the failure of the packet. It leads to packet loss. Due to this, it is necessary to control the congestion in the network, however, it cannot be avoided.

TCP congestion control refers to the mechanism that prevents congestion from happening or removes it after congestion takes place. When congestion takes place in the network, TCP handles it by reducing the size of the sender’s window. The window size of the sender is determined by the following two factors:

  • Receiver window size
  • Congestion window size

Receiver Window Size

It shows how much data can a receiver receive in bytes without giving any acknowledgment.

Things to remember for receiver window size:

  1. The sender should not send data greater than that of the size of receiver window.
  2. If the data sent is greater than that of the size of the receiver’s window, then it causes retransmission of TCP due to the dropping of TCP segment.
  3. Hence sender should always send data that is less than or equal to the size of the receiver’s window.
  4. TCP header is used for sending the window size of the receiver to the sender.

Congestion Window

It is the state of TCP that limits the amount of data to be sent by the sender into the network even before receiving the acknowledgment.

Following are the things to remember for the congestion window:

  1. To calculate the size of the congestion window, different variants of TCP and methods are used.
  2. Only the sender knows the congestion window and its size and it is not sent over the link or network. The formula for determining the sender’s window size is:

Sender window size = Minimum (Receiver window size, Congestion window size)

Causes and Costs of Congestion

Following are the causes of congestion in a network:

  • Excessive consumption of bandwidth- There might be certain devices that require more bandwidth as compared to other devices. This can sometimes put a strain on the network and its components like routers etc and can cause congestion of the network.
  • Improper subnet management- In order to manage a larger network efficiently, the network is divided into different subnets. If these subnets are not scaled and managed effectively then network congestion takes place.
  • Multicasting- Multicasting is when a network allows several computers to use and communicate using that network at the same time. If two packets are sent at the same time, a collision can occur and if these collisions occur frequently then the network gets congested.
  • Outdated hardware- Transmission of data might get hampered if old routers, switches, or servers are used for communication.
  • Border gateway protocol- All traffic in a network is routed by BGP by using the shortest path. While routing, it doesn’t consider the amount of traffic present at a route. In a situation like this, there can be a possibility that the packet is routed via the same route and can cause congestion in the network.

Approaches for Congestion Control

Approaches for congestion control

Congestion in TCP is handled by using these three phases:

  1. Slow Start
  2. Congestion Avoidance
  3. Congestion Detection

Slow Start Phase

In the slow start phase, the sender sets congestion window size = maximum segment size (1 MSS) at the initial stage. The sender increases the size of the congestion window by 1 MSS after receiving the ACK (acknowledgment). The size of the congestion window increases exponentially in this phase. The formula for determining the size of the congestion window is Congestion window size = Congestion window size + Maximum segment size

slow start phase congestion control

Round trip timeCongestion window sizeresult
After a round trip of 1(2)12 MSS
After a round trip of 2(2)24 MSS
After a round trip of 3(2)38 MSS

This is how you calculate the size of the congestion window and it goes on for n number of values. The general formula for determining the size of the congestion window is (2)round trip time

This phase continues until window size reaches its slow start threshold.

The formula for determining the threshold is given:

  1. Congestion Avoidance Phase

In this phase, after the threshold is reached, the size of the congestion window is increased by the sender linearly in order to avoid congestion. Each time an acknowledgment is received, the sender increments the size of the congestion window by 1. congestion avoidance phase

The formula for determining the size of the congestion window in this phase is Congestion window size = Congestion window size + 1

This phase continues until the size of the window becomes equal to that of the receiver window size.

  1. Congestion Detection Phase

In this phase, the sender identifies the segment loss and gives acknowledgment depending on the type of loss detected.

Case-01: Detection On Time Out

  1. In this, the timer time-out expires even before receiving acknowledgment for a segment.
  2. It suggests a stronger possibility of congestion in a network
  3. In this, there are chances that a segment has been dropped in the network

Reaction in response to Detection on time out:

  • Setting the threshold to start at half of the current size of the window
  • Decreasing the size of the congestion window to MSS
  • Slow start phase is resumed

Case-02: Detection Of Receiving 3 Duplicate Acknowledgements

This case suggests the weaker possibility of congestion in the network. In this, the sender receives three duplicate acknowledgments for a network segment. The chances are that fewer segments have dropped while the one sent later might have reached.

Reaction on receiving 3 duplicate acknowledgments:

  • Setting the threshold to start at half of the current size of the window
  • Decreasing the size of the congestion window to that of the slow start threshold
  • The congestion avoidance phase is resumed

Fairness in Congestion Control

The fairness metric in networking is used to determine whether the application or user is receiving a fair share of the system’s resources. In congestion control, the mechanism for transmission using the new protocol must be well aligned with the TCP protocol. TCP fairness determines that the new protocol receiver has a no larger share of the network as compared to TCP flow. This is an important factor because if a new protocol acquires unfair capacity then it leads to congestion in the network.

From protocols to architecture, our Free Computer Networks course covers it all. Join now and learn Computer Networks from industry experts!

Conclusion

This was all about TCP congestion control. Here are a few key takeaways from this article:

  • Congestion is an important factor in packet-switched networks. It refers to the state of a network where the message traffic becomes so heavy that the network response time slows down leading to the failure of the packet.
  • TCP congestion control refers to the mechanism that prevents congestion from happening or removes it after congestion takes place.
  • Receiver window size shows how much data can a receiver receive in bytes without giving any acknowledgment
  • Congestion window state of TCP that limits the amount of data to be sent by the sender into the network even before receiving the acknowledgment.
  • Causes of congestion in a network:
    1. Excessive consumption of bandwidth
    2. Improper subnet management
    3. Multicasting
    4. Outdated hardware
    5. Border gateway protocol
  • TCP congestion control 3 phases:
    1. Slow start
    2. Congestion avoidance
    3. Congestion detection
  • Fairness metric in networking is used to determine whether the application or users are receiving a fair share of the system’s resources.