# A Replica-Selection Algorithm Based on Transmission Completion Time Estimation in ICN
## 4 Algorithm Description
### Overview of TCTE Algorithm  
Compared with the traditional IP network, ICN enables users to obtain content from a closer location through the cache replica in the network, which not only improves the user experience, but also effectively reduces the traffic of the core network, which is conducive to improving the overall performance of the network. Implementing a replica-selection algorithm based on transmission completion time estimation can improve user experience, but the replica node with the smallest estimated transmission completion time may also be a far-away replica node, which will increase traffic in the core network. In addition, it is extremely difficult and expensive to maintain replica node information within the entire network. Therefore, we implement the approach based on transmission completion time estimation within the ENRS [13] domain. On the one hand, a set of replica nodes returned  
Figure 2: ENRS schematic diagram. by ENRS is in the same ENRS domain as the user, without obtaining a replica node that is far away. On the other hand, the overhead of maintaining replica node information in the ENRS domain is controllable. TCTE performs more complex replica-selection operations within the ENRS domain. If no replicas can be found within the ENRS domain, the TCTE will take the replica nodes obtained from the GNR. In this case, we use the nearest-replica selection algorithm as in Mobilityfirst to avoid increasing the traffic in the core network. Performing replica selection requires better awareness of the network, but the information that the client can perceive is limited. Edge routers [37] can aggregate user requests, while, due to the large number of data passing through they can better perform passive measurements on the network. Furthermore, because of the support of late-binding technology, it is a reasonable choice to run the replica-selection algorithm on the edge nodes. Inspired by the work of [12], we maintain the status of the replica nodes in the ENRS domain at the edge nodes. When a replica node is selected, we try to estimate the transmission completion time \(T\) for the NDC. \[T=a*RTT+b*\frac{ChunkSize}{Rate}\, \tag{1}\]  
where \(RTT\) is the round-trip time between the edge node and the replica node. For a replica node in the ENRS domain, we set a timeout value of 10 s (or other reasonable values) for its RTT. When the RTT of a replica node expires, five REQ packets forwarded to the replica node will be marked for re-measurement. Take the minimum value among the measured values as the RTT of the replica node. \(ChunkSize\) is the size of NDC, and \(Rate\) is the expected transmission rate of the replica node. Parameters \(a\) and \(b\) are adjustable coefficients. \(Rate\) is calculated based on passive measurements of edge nodes and will be described in detail in Section 4.3. \(ChunkSize\) needs to complete the transmission of at least one DATA packet before it can be obtained. Therefore, before estimating the \(T\) value, it is necessary to first select a replica node to obtain a DATA packet. In order to obtain \(ChunkSize\) as soon as possible, the first REQ packet of NDC will be forwarded to the replica node with the smallest RTT. After the edge node receives the first DATA packet and obtains the \(ChunkSize\) of the NDC, it reselects the replica node with the smallest \(T\) value for NDC transmission, and saves the selection result in the replica-selection completion list. When receiving the REQ packet of the transmission process again, the edge node will directly obtain the replica node NA in the replica-selection completion list to forward the REQ packet. The TCTE algorithm runs on the edge nodes. Algorithm 1 is the operation when TCTE receives the REQ packet. When receiving the REQ packet, TCTE first checks whether there is information about the completion of the replica selection of the NDC transmission process. If it exists, it means that the replica selection has been completed, and it then obtains the selected replica node NA and forwards the REQ.