Open In App

AIMD Algorithm

Improve
Improve
Like Article
Like
Save
Share
Report

AIMD is a feedback control algorithm, it is used by TCP protocols in the transport layer of the TCP/IP stack. The AI phase is responsible for the linear growth of the sender’s congestion window where there is no congestion detected. The MD phase is responsible for the exponential cut-down of the sender’s congestion window when congestion is detected. There can exist multiple combinations of these two phases: additive and multiplicative.

AIAD, MIAD, and MIMD are three extra combinations. But they don’t ensure fairness. AIMD on the contrary ensures fairness while competing with other TCP flows for the network bandwidth. MIMD increases the congestion window exponentially when there is no congestion in the network, as a result, chances of congestion increase, and a major portion of the bandwidth is consumed by this particular flow, thus it hurts the performance of other flows. Due to its exponential growth, congestion occurs much more frequently. MIMD and AIMD don’t reach stability, all TCP flows don’t converge on using the network bandwidth.

Additive Increase Multiplicative Decrease (AIMD):

It is known as the Congestion Avoidance algorithm (but this is a misnomer). It doesn’t avoid congestion in the true sense. In fact, there is no congestion avoidance algorithm. It controls the growth of congestion window with extreme care such that chances of further congestion are the least. The congestion window (cwnd) is increased by ‘one’ segment ‘per’ RTT, this is the AI phase. Unlike Slow Start where cwnd is increased by ‘one’ segment per ‘ACK’ received. The cwnd is decreased by ‘half’ on detecting a packet loss, this is the MD phase. 

Example: See ‘Remaining time’ while downloading/uploading a file. Initially, the speed would increase exponentially and the remaining time would be less. Then a packet loss occurs and the speed decreases by half and the remaining time become approximately double. If further packet loss occurs, then speed further decreases and time becomes double again.

Main goal of AIMD:

AIMD probes ‘slowly’ as compared to the ‘Slow Start’ phase. Slow start increases the congestion window size exponentially (double per RTT) while AIMD increases cwnd linearly (by 1 per RTT). When TCP was introduced there was no congestion control mechanism. The TCP sender used to send the entire cwnd worth of packets at a time without caring about the packet loss at intermediary devices. The routers could not tolerate that burst of packets and thus lost the packets. Then slow start was designed to overcome this situation, and thus it was named a slow start. It starts slowly compared to the original TCP sending rate and criteria, which was careless about congestion state. 

The second goal of AIMD is to ensure fairness among flows competing for bandwidth. If there is a state of congestion in the network, then reducing cwnd by half, reduces the network usage by half or lesser and allows the other TCP flows(clients) to use them. When all the flows get an equal share of bandwidth, the system is called fair. 50% cwnd of 1000 segments is 500 segments, and that of 100 segments is 50 segments, thus congested TCP flow gives proper share of network to other TCP clients and ensures fair connection.

Algorithm:

On arrival of every ACK, increment the cwnd by (1 ÷ cwnd) and send 1 new segment in the network

  1. cwnd = cwnd + (1 ÷ cwnd)
  2. inflight = inflight – 1 + 1 // -1 because we received an ACK, +1 because we sent 1 new segment

Example: Assume that the cwnd = 10 when we receive an ACK

cwnd = 10 + (1 ÷ cwnd), since the cwnd increases by 1 per RTT, 
means when all the ACK comes. So, for 1 ACK, cwnd increases by 1/cwnd.

inflight = 10 - 1 = 9 + 1, inflight must be equal to cwnd, 
So, 1 new packet is send to compensate 1 ACK packet.

Thus, if all the segments are successfully ACKed, the cwnd will ‘eventually’ increment by ‘one’.

Example: Assume cwnd = 10 and inflight = 10. When one ACK arrives, the cwnd would become 10.1, when the second ACK arrives, the cwnd would become 10.2, …. when the tenth ACK arrives, the cwnd would become 11. So it started with 10 segments, and by the time all ACKs of these 10 segments arrive, the cwnd becomes 11.

 

Congestion Avoidance with SSR+AIMD

Congestion Avoidance with SSR+AIMD

Important:

When slow start reaches ssthresh value, it simply handover the control to AIMD.

When packet loss occurs in slow start phase, then ssthresh sets to half of cwnd and AIMD phase begins.

When slow start is idle for 1 second, then it restarts by cwnd=initcwnd=1 segment.

When there is a packet loss during AIMD phase, then ssthresh reduces to half and cwnd resets to inticwnd and slow start phase restarts.

Protocols using AIMD

Only TCP protocol uses the AIMD in addition to slow start restart for congestion detections and taking corrective measures.

AIMD is very compatible with Slow Start Restart. This combo is used together in almost all TCPs i.e. Tahoe, Reno, NewReno, and Cubic. When the flow starts SSR is used, when SSR reaches the threshold then AIMD begins. When congestion is detected, AIMD switches to SSR again. The AIMD is very effective in terms of network fairness. It doesn’t hurt other TCP flows.

Performance factor for AIMD

  1. Compatibility: Today every device is using some variant of TCP depending on the platform. AIMD is an integral part of every TCP. It is compatible with every TCP variant. The congestion avoidance is basically the feedback method to let the sender know that somewhere link or router is congested and dropping the packets. It focuses on ‘when’ rather than ‘if’.
  2. Effectiveness: AIMD is the most effective algorithm for congestion avoidance. It comes into action ‘when’ there is packet loss across the link. It slowly probes the network and takes effective measures to avoid further packet loss.
  3. Responsiveness: It is the most responsive in nature. As soon as the packet drop is detected, the previously running algorithm stops and hands over the control to the AIMD. When there is further packet loss during the AIMD phase, then it immediately hands over the control to the slow start restart.

Impact of AIMD algorithm

For Example, Assume cwnd is 1000 segments. A packet loss occurs and a slow start stops and the AIMD phase begins. The multiplicative decrease will bring the cwnd down to 500 segments (half of 1000). It will take (approximately) 500 RTTs for the cwnd to grow back to 1000 segments using the AI phase (increment of 1 per RTT). If one RTT is 100 ms: 500 RTTs will be 500 x 100ms = 50000 ms = 50 seconds! Thus, AIMD is affecting the client’s performance very badly.

Proposed solutions

A new category of congestion control algorithms, called high speed, evolved. HighSpeed TCP (cwnd = cwnd + a for AI and cwnd = cwnd x b for MD). Scalable TCP (fixed number of RTTs needed to get back to the original value of cwnd). Binary Increase Congestion control (BIC) [this was the precursor to CUBIC]. Yet another HighSpeed TCP (YeAH). CUBIC [designed to overcome the fairness problems with BIC].


Last Updated : 17 Apr, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads