# Reducing the Operational Cost of Cloud Data Centers through Renewable Energy
## 4 Workload Assignment and Migration
Notice some main differences with respect to the traditional EcoMultiCloud formulation. First of all, since only one key target is identified, no normalization is needed. Second, the assignment function can assume also negative values. Indeed, when the consumption is lower than the green production, \(C_{i}<E_{i}\), there is an extra production of energy; the cost of allocating some workload to the DC is null. Conversely, when the consumption is higher, \(C_{i}>E_{i}\), the green energy production is not sufficient for all the assigned workload; some energy has to be purchased from the power grid at the price \(P_{i}\), turning into the cost \(\left(C_{i}-E_{i}\right)P_{i}\). Despite these differences between the traditional EcoMultiCloud formulation in (1) and the adapted version (2), the decision on the VM allocation is still taken considering the minimum among the values \(f^{i}_{assign}\). For positive values, this means the minimum cost; for negative values, this corresponds to taking the DC with the largest cost saving. The energy consumption term, \(C_{i}\), is computed taking also into account the efficiency of the DC in terms of PUE. Denoting by \(C^{(c)}\) the consumption for a VM that has to be assigned in terms of computation and storage, the consumption in DC \(i\) is given by:  
\[C_{i}=PUE_{i}\cdot C^{(c)} \tag{3}\]  
Although the value of PUE may vary with the load, in this paper, for simplicity, we assume that the PUE value of each DC is known and constant, but no modification of the algorithms is required if the PUE changes with the load, as long as it is known. The consumption of a VM, \(C^{(c)}\), is assumed to be the same on all the servers of any data center. For the coordination of the upper layer, each DCM transmits to the other DCMs the following vector of values, which corresponds to the state of the DC:  
\[s_{i}=\left\{C_{i},E_{i},P_{i}\right\} \tag{4}\]  
Figure 3 reports the pseudo-code used by a DCM to choose the target data center, among the \(N_{DC}\) data centers of the system, for a VM originated locally. First, the DCM requests the values of \(C_{i}\), \(E_{i}\) and \(P_{i}\) for all the remote data centers; the amount of exchanged data is very low, but it can be refreshed periodically to reduce the amount of information exchange when the flow of VMs is large. Then, it computes the assign function according to (2) for any data center that has some spare capacity, i.e., for which the utilization of the bottleneck resource has not exceeded a given threshold \(U_{T_{i}}\). Finally, the VM is assigned to the DC that has the lowest value of (2). Once assigned to the target DC, the VM is allocated to a physical host using the local assignment algorithm. The assignment algorithm optimizes the distribution of the VMs on the basis of energy cost, taking into account the available RE. The effect of the assignment process is that the values of the \(f_{assign}\) for the various DCs tend to converge. This convergence accomplishes the performance maximization objectives. One of the advantage of the approach is that it naturally and smoothly adapts to changing conditions, i.e., variations of energy price or renewable energy production. However, the dynamicity of VM arrivals and departures determines the speed at which the system adapts to variations of energy production, consumption and price. To speed up adaptation and mitigate  
Figure 3: The EcoMultiCloud assignment algorithm, executed by the DCM of each data center. temporary inefficiencies in the VM distribution due to changing conditions, inter-DC VM migrations are performed. Migrations redistribute part of the workload so as to adapt to new conditions. The migration algorithm is triggered when the values of the \(f_{assign}\) function of two DCs differ by more than a predetermined threshold.