TCP congestion control

Congestion is having more number of packets in the network than what can be managed or what can be transmitted to other end without any delay.

This happens when sender overflows the network with too many packets which result in a degraded quality of service(QoS).

Typical symptoms of congestion are:

  • Excessive packet delay.
  • Re transmission of packets.
  • Packet lost

Some of the common cause of congestion are:

  • Lack of bandwidth.
  • Buffer size less at the receiver side.
  • Small window size.
  • Poorly configured network and its infrastructure.

TCP congestion control techniques prevents congestion from happening or helps to mitigate the congestion once it happens.

There is a congestion window(Cwnd) in TCP and is maintained for each TCP session which defines the maximum amount of data which can be sent into the network without being acknowledgment.

MSS: Maximum segment size which defines the amount of data(bytes) which can be received by receiver in one segment. It is set inside the SYN packet. It is of 1460 bytes

TCP congestion control mechanism works in three phase:

  • Slow start phase
  • Congestion avoidance
  • Congestion detection

Slow start phase:

In this phase the congestion window size is increased exponentially with 1 MSS to 2 MSS and so on till it reaches a threshold called slow start threshold which is:

ssthresh = Current_window_size / 2

Slow start phase

Congestion Avoidance phase: Once the slow start phase reaches the slow start threshold, TCP switches to this phase and in this phase congestion window size increases linearly.

Congestion Detection phase: Congestion is detected by TCP when there is a packet loss that is it has to be transmitted.

Re transmission happens in two scenarios:

  • Re transmission after timeout(RTO)
  • Fast re transmission.

Re transmission after timeout(RTO)

Re transmission after timeout is a symptom of heavy congestion and once this is detected, threshold is set to half of the current window size and current window size is set to 1 segment/bytes and it enters slow start phase again.

Fast re transmission.

Fast re-transmission that is receipt of 3 duplicate ack is indication of mild congestion and here also threshold is set to half of the current window size and current window size is set to value of threshold and enters into congestion avoidance phase.

untitled image

TCP MSS 1460 Bytes Inside Ethernet Frame.

Categories: Networking

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: