# Two-Level Congestion Control Mechanism (2 LCCM) for Information-Centric Networking
## 3 Design
### Switching Strategy  
Replica switching is related to many factors, analyzed as follows: (1) transmission interruption: if the receiver sends a request packet but does not receive any response packet from the sender within a certain time, we believe that the current sender is unable to provide service due to disconnection or service overload or other factors, then replica switching must be performed; (2) heavy congestion and a large amount of data remaining: if the receiver detects abnormally long RTT or continuous packet loss, it is believed that the queuing delay becomes longer due to network congestion, thus causing long RTT or even router packet loss. ICN is oriented to chunk transmission, after the receiver side starts to acquire data, the receiver side has the information of the size of the current chunk, and the amount of data that has been acquired currently is also recorded. Therefore, if at this time the received segments account for less than a certain proportion of the total chunk size, that is, still need to transmit a large proportion of data, it is believed that the replica switching will bring greater benefits, so it makes the decision to switch; (3) heavy congestion but a small amount of data remaining: if the receiver detects and determines that the network is under heavy congestion according to Equation (3), but only a small amount of data is remaining to be transmitted. The overhead of replica switching is greater than the benefit brought, thus the decision of replica switching is not executed.  
The amount of remaining data is an important factor in determining whether to switch replica nodes under heavy congestion. The principle of determination is shown in Equation (4) in detail.  
\[SwitchTime\ <\ \frac{ChunkSize\ -\ ReceivedSize}{CurrentRate}-\frac{ChunkSize\ -\ ReceivedSize}{FutureRate} \tag{4}\]  
where _SwitchTime_ is the time cost of a replica switching (that is, due to the switch brings a brief rate reduction), _ChunkSize_ is the size of the chunk, _ReceivedSize_ is the current amount of data received, the result of the difference is the amount of data remaining, _FutureRate_ is the estimated transmission rate after the replica switching, _CurrentRate_ is the transmission rate of the current replica node, this is used to judge whether the transmission time saved after the replica switching is greater than the switch time to perform the replica switching.  
The operation process of the receiver is shown in Algorithm 1. If no packet is received before the timer timeout, the transmission is considered interrupted and replica switching is executed. When the receiver receives a response packet, it first judges whether the current transmission is under heavy congestion. If it is, it further judges whether replica switching is necessary based on the received data volume. If it is under heavy congestion and still necessary to switch, replica switching is executed. Otherwise, the network state is considered good enough or only under light congestion, and the congestion control algorithm is used to adjust the request sending rate. We can see that this algorithm is simple, and the time complexity of this proposed algorithm is O(1).  
```
1:if timeout to receive any packet then
2: switch to another replica
3:elseif receiver receives a response packet then
4: heavy_congestion_flag or light_congestion_flag\(\leftarrow\) Equation (3)
5:if heavy_congestion_flag\(==1\)then
6: switch_flag\(\leftarrow\) Equation (4)
7:if switch_flag\(==1\)then
8: switch to another replica
9:else
10: adjust current request sending rate
11:elseif light_congestion_flag\(==1\)then
12: adjust current request sending rate
```  
**Algorithm 1**Operation Process in Receiver