# Router Activation Heuristics for Energy-Saving ECMP and Valiant Routing in Data Center Networks
## 5 Heuristic Algorithm for Energy-Aware Routing
### Algorithm of Next Hop Selection  
Assume that each node \(n\in N\) propagates information about current loads of its communication ports to all neighbors that form the set \(N_{n}\in N\), i.e., switches directly connected with \(n\). We define the accepted maximum load \(\lambda_{N_{n}}\) of ports of nodes from the set \(N_{n}\). This safe load guarantees required QoS, i.e., assures enough link capacity for the sudden surge in traffic. Let a set \(A_{n}\), and \(A_{n}\in N_{n}\) consists of currently active neighbors of the \(n\)-th node. Since the number of neighboring nodes in DCNs is usually not very large, greedy Algorithm 1 can be used to determine the next relay node in a path (next hop) for each flow transmission.  
```
1:Initial data: \(w_{m}\) the size of the flow \(m\), \(e_{im}\) the energy cost of transmission \(m\) via relay node \(i\), \(c_{ip}\) the capacity of the \(p\)-th port of \(i\), \(l_{ip}\) the current load of the port \(p\), \(r_{i}\) the energy cost of waking up the relay node \(i\).
2:Create a set \(N_{n}\) of neighbors of \(n\).
3:Create a set \(A_{n}\subset N_{n}\) of active neighbors of \(n\).
4:Create a set \(T_{n}\subset A_{n}\) of active neighbors \(i\in T_{n}\) which ports \(p\) linking neighbors with \(n\) meet the condition: \(l_{ip}<\lambda_{N_{n}}-w_{m}\).
5:if\((T_{n}\
eq\emptyset)\)then
6: Select the node \(i\)-th with the lowest \(e_{im}\) from the set \(T_{n}\).
7:else
8:if\((N_{n}-A_{n}\
eq\emptyset)\)then
9: Select and wake up the disabled neighbor \(i\) with the lowest \(e_{im}\).
10:else
11: Select the node \(i\) with the lowest \(l_{ip}\) from the set \(A_{n}-T_{n}\).
12:endif
13:endif
```  
**Algorithm 1**The next hop for \(m\)-th flow transmission calculation; \(n\in N\) is the current traffic source, \(p\) is the port linking \(n\) with the next node in the path.  
When several switches (the \(n\)-th node neighbors) with ports of the same load are available, the next node can be selected in several ways:  
* Random selection of the next hope;
* Selection of the switch with the smallest load on the required port;
* Selecting the switch with the smallest energy use;
* Switch selection leading to load balancing.  
In practice, suspending data transmission until a new node is activated may result in unacceptable delays. In a situation where the switch activation time cannot be ignored, one of the active switches is selected as the next node, despite exceeding the maximum port load limit. The node with the lowest load on the considered port is selected.  
With a heavy network load and the limited number of available active switches, more nodes may need to be waking up to transmit data with the assumed QoS. It may result in activating the number of nodes significantly higher than required for handling current traffic. Newly activated nodes can handle traffic in nonchronological order, especially when different node configurations are used. It can improve the network adjustment time in traffic peaks at the cost of energy usage efficiency. It should be noted that if more than one additional node needs to be woken up, the routing protocol activates the next node when the previously activated node is ready for operation. Its current load can handle the current traffic. It may result in the transmitted packet loss. Different values of the minimum expected capacity \(\alpha_{i}\) for various possible next hops \(i\in N_{n}\) and simultaneous multiple nodes activation may speed up network response during rapid network demand changes.  
Note that with multipath routing, enabling any additional node can affect routing throughout the network. The number of possible transmission paths usually increases.