Keywords

1 Introduction

With the rise of cloud services, it is becoming increasingly common for enterprises to build their own cloud platforms. Typically, there are two phases in the resource allocation process of modern cloud platforms [2], being virtual machine selection (VMS) and virtual machine placement (VMP), respectively. The VMS phase aims to select proper VMs to process the tasks, and the VMP phase places the selected VMs on proper PMs.

Although such a division of roles provides a clear organization of cloud resources and is widely used in existing public clouds, it is actually not very suitable for private clouds. For a public cloud, VMS scheme is decided by users or their brokers and VMP by the platform, therefore, they have to be separated. However, for a private cloud, where the platform has the opportunity to decide the VMS scheme, such a functional division only results in inefficient resource utilization. We use the following example to demonstrate our point of view.

Fig. 1.
figure 1

VM selection and placement in clouds

Suppose there is a simple private cloud platform, where there are two different types of VMs and PMs, with their parameters of CPU, memory, task processing capability and cost shown in Fig. 1(a). In particular, different PMs have different costs, when the same VM is placed on different PMs, it has different task processing capabilities due to the different hardware configurations of PMs. Now, there are 13 tasks is to be processed, and we need to figure out a VM selection scheme and a VM placement scheme so that all the tasks can be processed with a minimum cost. We compare the possible schemes in Fig. 1(b).

  • VMS-Optimal Scheme. This scheme first makes sure VM selection is optimal, and the VM utilization rate is \((3+5+5)/13=100\%\). While the average PM utilization rate is \((6/10+6/9)/2 = 63.33\%\). The total cost is \(2+3=5\).

  • VMP-Optimal Scheme. This scheme first makes sure VM placement is optimal, and the average PM utilization rate is \(100\%\). While the resulting VM utilization rate is \(13/18=72.22\%\). The total cost is \(2+2+2=6\).

  • Global-Optimal Scheme. This scheme solves the problem from a global perspective. Although both VMS and VMP scheme are not locally optimal, it gives a global optimal solution. The resulting VM utilization rate is \(92.86\%\), and the average PM utilization rate is \(91.67\%\). The total cost is 3.

From the above example, we observe that a separated consideration of VMS and VMP may lead to significant resource wastage in either of the two stages. Even if these two stages can individually achieve their own local optimal solutions, they can not guarantee a global optimal solution.

In this paper, we convert the original joint VM selection and placement (JVMSP) problem into two independent sub-problems Max-Capability and Min-Cost, making it decoupled as a result, by our proposed Resource-Decoupling algorithm. By applying this algorithm, we can obtain the global optimal solution of entire JVMSP problem by solving the two sub-problems independently. In summary, the main contributions of this paper can be summarized as follows.

  1. 1.

    We propose a novel approach that considering VMS and VMP jointly for resource allocation in private clouds, and formulate the resulting JVMSP problem. We prove that the JVMSP problem is a NP-hard problem.

  2. 2.

    We propose the Resource-Decoupling algorithm which can obtain the global optimal solution of the JVMSP problem. It decouples the JVMSP problem into two independent sub-problems Max-Capability for maximizing task processing capabilities of PMs and Min-Cost for minimizing the cost.

  3. 3.

    We propose the efficient Max-Balanced-Utility algorithm by considering both variance and utility to solve the Max-Capability sub-problem, and the efficient Extent-Greedy algorithm to solve the Min-Cost sub-problem.

2 Related Work

The VMS and the VMP mechanisms are studied separately in previous researches. We briefly review these related studies as follows.

Virtual Machine Placement. The related algorithms proposed to solve the VMP problem can be categorized by their mathematical ideas. Among them, solving VMP problem by bin-packing algorithms [1] is the most straightforward way. Besides, linear programming and stochastic integer programming strategy [4] are other common methods. Finally, a large part of the research works use the heuristic strategy [5], from the simple best-fit strategy and greedy-based method to the genetic algorithm and PSO-based algorithm. As the comparison algorithm used in this paper, the authors applied the classic PageRank algorithm in VMP problem in [10]. They compared many state-of-the-art heuristics and showed the proposed PageRankVM brings very good performance.

Virtual Machine Selection. The VMS problem involves many aspects in resource management of clouds. Usually, it is regarded as a sub-problem of the whole dynamic VM consolidation process, where it is used to select VMs for migration [11]. Besides, VMS strategy is also used by the cloud brokers to select proper VMs among multiple cloud resource providers [8]. VMS problem also exists in pay-per-use related deployments, where proper resources are to be selected for specific applications and are charged to application providers [3]. In this paper, VMS helps to decide a set of VMs with different types and quantities, so that the tasks can be processed with minimum VM resource wastage.

3 Problem Statement

3.1 Problem Formulation

We firstly list the notations used in problem formulation in Table 1. Particularly, we use the PM’s market price as the cost in this paper, which aims to help the private cloud owners process the tasks with minimum economic expenses.

Table 1. Notations for problem formulation

The JVMSP problem is formed through jointly considering VMS and VMP problem. In order to analyze their relationship from the mathematical point of view, we first formulate VMS and VMP problems, and then jointly consider them to formulate the JVMSP problem.

VMS Formulation. The VMS problem aims to select proper VMs N to process all the tasks T with minimum cost, as shown in Eq. (1). The optimization goal shows the total cost of all the selected VMs, where \(f(s_v)\) is the cost of VM with scale v. The constraint shows the selected VMs’ capabilities are enough for all the tasks.

$$\begin{aligned} \mathop {min.}\limits _{{\{N\}}} \quad \sum _{v=1}^{V}{n_v \cdot f(s_v)} \quad \quad \textit{s.t.} \quad \sum _{v=1}^{V}{n_v \cdot t_{v}} \ge T \end{aligned}$$
(1)

VMP Formulation. The VMP problem aims to find a PM scheme M and the mappings G so that all the VMs N can be placed on PMs with minimum cost, as shown in Eq. (2). We optimize the total cost of all the PMs, where \(f(S_p)\) is the cost to use a \(p_{th}\)-type PM. The constraints shows all the VMs are needed to be placed, and for every PM, the placed VMs can not exceed its resource capacity.

$$\begin{aligned} \mathop {min.}\limits _{{\{M, G\}}} \quad \sum _{p=1}^{P}{m_p \cdot f(S_p)} \quad \quad \textit{s.t.} \quad \sum \limits _{i=1}^{|M|}{g_i^v} = n_v \quad and\quad \sum \limits _{v=1}^{V}{g_i^v \cdot s_v^d \le S_{\hat{i}}^d} \end{aligned}$$
(2)

JVMSP Formulation. The optimization goal for JVMSP problem is formulated in Eq. (3), where we aim to decide proper VMs N and proper PMs M as well as the placement method G so that all the tasks can be processed and the total cost is minimum.

$$\begin{aligned} \mathop {min.}\limits _{{\{N, M, G\}}} \quad \sum \limits _{p=1}^{P}{m_p \cdot C_p} \end{aligned}$$
(3)

The constraints are shown in Eq. (4). The first constraint shows the selected VMs’ capabilities are enough for all the tasks. The second one shows the selected PM’s quantity of each type is limited by its maximum available number. The third one makes sure all of the selected VMs are placed on PMs. The last one shows every PM’s resources should be enough for all the VMs placed on it.

$$\begin{aligned} \sum \limits _{i=1}^{|M|}{\sum \limits _{v=1}^{V}{g_i^v \cdot t_v^{\hat{i}}}} \ge T \quad \quad m_p \le K_p \quad \quad \sum \limits _{i=1}^{|M|}{g_i^v} = n_v \quad \quad \sum \limits _{v=1}^{V}{g_i^v \cdot s_v^d \le S_{\hat{i}}^d} \end{aligned}$$
(4)

3.2 Complexity Analysis

It is easy to know that VMP problem is NP-hard as Eq. (2) is equivalent to a multidimensional bin-packing problem, and VMS problem is also NP-hard as Eq. (1) is equivalent to a dual problem of a bin-packing problem. We now show the complexity of JVMSP problem by proving the theorem below.

Theorem 1

JVMSP is NP-hard, and it is harder than either VMP or VMS.

Proof

The theorem can be proved by a reduction from both VMP problem and VMS problem to JVMSP problem.

Firstly, we show that VMS can be reduced to JVMSP. Suppose we apply a placement scheme for PMs (i.e., fix G), and use \(T_p\) to denote the capability for each type of PM. Then, the last constraint in Eq. (4) is satisfied and the first constraint becomes \(\sum _p{T_p \cdot m_p} \ge T\). Moreover, variable N can be canceled by removing the third constraint. That finally becomes a VMS problem. Therefore, VMS problem is nothing but a special case of the associated JVMSP problem where variable G is set to be a constant.

Secondly, we show that VMP can be reduced to JVMSP. Similarly, suppose we apply a selection scheme for VMs (i.e., fix N) so that all the tasks can be processed, which essentially makes M a function of G. Then, the problem becomes determining M and G to optimize Eq. (3) under Eq. (4) without the first constraint (N is fixed to meet this constraint), which is obviously a VMP problem. Therefore, VMP problem is also a special case of the associated JVMSP problem where variable M is set to be a function of variable G.

4 Joint VM Selection and Placement

4.1 JVMSP Problem Conversion

Traditional solutions greedily split resource allocation into VMS and VMP phases. In this way, even if VMS and VMP can individually achieve their own optimal solutions, it does not guarantee a global optimal solution.

We propose the Resource-Decoupling algorithm to derive the global optimal solution, as shown in Algorithm 1. Specifically, the Resource-Decoupling algorithm converts the JVMSP problem into two sub-problems Max-Capability and Min-Cost. Max-Capability aims to determine an optimal placement scheme for a given PM so that it has the maximum task processing capability. And Min-Cost aims to select the well-placed PMs to process tasks so that the cost is minimum. Line 2 in Algorithm 1 shows we obtain the placement scheme \([\hat{n}_p^1,\cdots ,\hat{n}_p^v]\) and the maximum capability \(\hat{T}_p\) for a PM of type p by solving the Max-Capability problem. Line 4 shows we obtain the PM selection scheme \([\hat{m}_1, \cdots , \hat{m}_p]\) to process all the tasks with a minimum cost by solving the Min-Cost problem.

The Resource-Decoupling algorithm decouples the JVMSP problem into two independent sub-problems. Now, we prove that the optimal solutions of the two sub-problems guarantees the optimal solution of the JVMSP problem.

figure a

Theorem 2

Resource-Decoupling will give an optimal solution for JVMSP problem if the Max-Capability and Min-Cost sub-problems’ solutions are optimal.

Proof

We use \(\{\hat{T}_p\}\) and \(\{\hat{m}_p\}\) to denote the optimal solutions of the Max-Capability and Min-Cost sub-problems, and \(\hat{C} = \sum _{p}{\hat{m}_pC_p}\) to denote the corresponding cost. Now, we only need to show that \(\hat{C}\) is minimum among all other \(C'=\sum _{p}{m_p'C_p}\) which satisfies \(\sum _{p}{m_p'T_p' \ge T}\), where \(m_p'\) and \(T_p'\) are the constant results obtained from any other strategies.

Let’s first consider the optimization problem shown in Eq. (5). Now \(x_p\) becomes a variable to be optimized. We use \(m_p^s\) to denote the optimal solution for \(x_p\), and \(C^s\) to denote the corresponding optimal cost. Then, it’s obvious that \(C^s \le C'\), because \(m_p^s\) is the optimal case among all other \(m_p'\).

$$\begin{aligned} min. \quad \sum _{p=1}^{P}{x_p \cdot C_p} \quad \quad \textit{s.t.} \quad \sum _{p=1}^{P}{x_p \cdot T_p' \ge T} \end{aligned}$$
(5)

Let’s now consider another optimization problem shown in Eq. (6). Now \(y_p\) is also a variable to be optimized, and we can see the optimal solution for \(y_p\) is just \(\hat{m}_p\) (by the definition of \(\hat{m}_p\)), and the corresponding optimal cost is \(\hat{C}\). As \(\hat{T}_p \ge T_p'\) for any PM type p (by the definition of \(\hat{T}_p\)), it’s not hard to see that the optimal cost of Eq. (6) is smaller than or equal to the optimal cost of Eq. (5), i.e., \(\hat{C} \le C^s\). Therefore, we have \(\hat{C} \le C^s \le C'\).

$$\begin{aligned} min. \quad \sum _{p=1}^{P}{y_p \cdot C_p} \quad \quad \textit{s.t.} \quad \sum _{p=1}^{P}{y_p \cdot \hat{T}_p \ge T} \end{aligned}$$
(6)

4.2 Algorithm for Max-Capability Sub-problem

The Max-Capability problem takes a PM with scale \(S_p\), a VM candidate set with different scales \(\{s_v^d\}\) and the task processing capabilities \(\{t_v^p\}\) as inputs. It needs to choose proper VMs to place on the PM, where we use \([\hat{n}_p^1,\cdots ,\hat{n}_p^v]\) to denote the selected VM quantities of different types, and \(\hat{T}_p\) to denote the corresponding task processing capability of this PM after the placement.

The Max-Capability is essentially a bin-packing problem and can be optimally solved by the dynamic programming method. However, the time complexity is very high. In this paper, we propose a heuristic algorithm, where two main factors the balance of PM and the utility of VM are considered. The balance of PM aims to avoid using resource excessively in one dimension. Specifically, for each type of VM, we define \(V(v)=Var ({R^d+s_v^d}/{S^d} )\) to measure the equilibrium effect it brings to the PM, where \(S^d\) and \(R^d\) is the PM’s total and remaining resource, and \(s_v^d\) is the \(v_{th}\)-type VM’s resource on dimension d. The utility of VM aims to choose the VM which brings more task processing capability while consuming less PM resource. We define \(U(v)={t_v}/{\root d \of {\prod _{d=1}^{D}{s_v^d}}}\) to measure the utility of a given VM, where \(t_v\) is the \(v_{th}\)-type VM’s capability.

figure b

The Max-Balanced-Utility algorithm is described in Algorithm 2, which works in the following steps. Firstly, for a given PM, it calculates V(v) and U(v) for each type of VM (lines 4–5). Secondly, it sorts the VMs’ types by descending V(v), retain the best VM types in a certain proportion, and assign a possibility for each type of VM according to their U(v) (lines 7–8). Thirdly, it randomly chooses a VM according to the probabilities and repeat the above process until the PM is fully placed. Finally, for the same PM, it repeats the placing strategy R times to get the best scheme.

4.3 Algorithm for Min-Cost Sub-problem

The Min-Cost problem aims to determine a PM selection scheme from the well-placed PMs to process all the tasks with minimum cost. Specifically, it takes the capabilities \(\{\hat{T}_p\}\), costs \(\{C_p\}\), and maximum PM numbers \(\{K_p\}\) as inputs. The goal is to determine the quantities \(\{m_p\}\) for each type of PM.

figure c

We propose the Extent-Greedy algorithm to solve the Min-Cost problem, as shown in Algorithm 3. It firstly divides the task processing capability of each PM by its cost to get its extent \(\{ext_p\}\) and then uses the extent to decide the selection order of the PMs (line 1–2) until the selected PMs are enough for tasks. Note that for the selection of the last PM, on the premise that its resources are enough for the remaining tasks, we select the one with the minimum cost rather than the one with the maximum extent to avoid resource wastage.

Actually, the Extent-Greedy algorithm will give a solution for M in Eq. (7) if Max-Capability is optimally solved, where \([s\_1, s\_2, \cdots , s\_P]\) is the sorted PM types in Algorithm 3, K is the maximum number and T is the capability for a certain type of PM. In Eq. (7), \(s\_a\) is a boundary of the sorted PM types, ahead of which all the PMs are selected with the maximum available number (\(m_{s\_x}\)), behind of which only one PM with the least enough capability is selected (\(m_{s\_b}\)). Use C to denote the cost derived from Eq. (7), we have the Theorem 3.

$$\begin{aligned} \begin{aligned} M =&\left\{ \ \begin{aligned} m_{s\_x}&= K_{s\_x}, \quad x \,\ for \ any\ 1 \le x < a\\ m_{s\_a}&= \lfloor {(T-\sum _{i=1}^{a-1}{K_{s\_i}T_{s\_i}})/T_{s\_a}}\rfloor \\ m_{s\_b}&= 1, \quad a \le b \le P \\ \end{aligned} \right. \\ \end{aligned} \end{aligned}$$
(7)

Theorem 3

\(C^o\) is a lower bound of the global minimum cost for JVMSP.

$$\begin{aligned} C^{o} = C-C_{s\_b}+\frac{C_{s\_a}}{T_{s\_a}}(T-\sum \limits _{i=1}^{a}{m_{s\_i}T_{s\_i}}) \end{aligned}$$
(8)

Proof

Firstly, it is easy to see that \(C^{o} = C\) when \(T = \sum _{i=1}^{a}{m_{s\_i}T_{s{}\_i}}\). Because the PMs are selected by the sorted extent order and no extra capabilities are wasted. Secondly, we consider the general case where \(T > \sum _{i=1}^{a}{m_{s\_i}T_{s{}\_i}}\). We know that \(C-C_{s\_b}\) is the global minimum cost for \(\sum _{i=1}^{a}{m_{s\_i}T_{s{}\_i}}\) tasks as stated above. For the remaining tasks, the extent of the most efficient available PMs is \(C_{s\_a}/T_{s\_a}\). Therefore, at least another \((T - \sum _{i=1}^{a}{m_{s\_i}T_{s{}\_i}})C_{s\_a}/T_{s\_a}\) cost is needed to process the remaining tasks, which finally explains the lower bound of the minimum cost show in the above theorem.

In the evaluation part, we will evaluate algorithms by comparing their costs with the lower bound of global minimum cost \(C^o\).

5 Performance Evaluations

5.1 Datasets

The data in our datasets is made up of two parts, VM scales and PM scales, respectively. For VM scales, we combine the VM sizes in the trace-based dataset Google-Cluster [12] and the VM sizes in public cloud Amazon EC2 [7]. For PMs, we configure a number of servers with different specifications, and use their marked prices [6] as their costs. The PMs and VMs are with different ratio types (general type, high-performance type, large-memory type, large-storage type), and for each type there are different sizes of resources. We then divide the PMs and VMs into 9 different PM sets and 9 different VM sets so that they can form different datasets. Their types and quantities are recorded in Table 2.

Table 2. PM and VM sets used in experiments

5.2 Compared Algorithms

To evaluate the performance of our proposed framework and algorithms, we construct four different schemes to solve the JVMSP problem in Table 3, where

  • Scheme1 uses our proposed framework and algorithms. It is our proposed scheme for efficient resource allocation in private clouds.

  • Scheme2 uses the PageRankVM as the placement strategy. We use it as a comparison scheme to evaluate the different placement strategies.

  • Scheme3 uses the Function-Separated framework. We use it as a comparison scheme to evaluate the different resource allocation frameworks.

  • Scheme4 uses the Function-Separated framework, and it adopts the First-Fit-Decreasing strategy for placement. It is treated as the baseline.

Table 3. Comparison schemes to solve JVMSP problem

5.3 Results and Analysis

We perform the different schemes in Table 3 to solve the JVMSP problem by applying them on the dataset formed by PM set 5 and VM set 5 in Table 2. We perform 50 groups of simulations on the dataset by setting each simulation a different available PMs quantities and tasks inputs. We define the Cost Optimality Ratio as \(C^o/C_{alg}\) to measure the proximity of the algorithm-derived cost to the global optimal cost, where \(C^o\) is the lower bound of minimum cost shown in Theorem 3 and \(C_{alg}\) is the algorithm’s cost. The results are shown in Fig. 2

By comparing scheme2 and scheme3 in Fig. 2(b), we can see that the Feedback-Decoupling framework improves the performance of JVMSP’s solution up to \(15.5\%\) in average compared with the traditional resource management method Besides, by comparing scheme1 and scheme2, we can see that our proposed Max-Balanced-Utility placement strategy improves the solution another \(10\%\) when compared with PageRankVM. Overall, our proposed scheme improves the resource allocation efficiency \(43\%\) compared with the baseline.

Fig. 2.
figure 2

Four compared schemes’ cost results to solve the JVMSP problem

We further evaluate the adaptability of our proposed framework and algorithms by applying the schemes on different datasets, and their results are shown in Fig. 3. The results show that scheme1 and scheme2 remain more stable and higher performance in all of the cases compared with scheme3 and scheme4, which illustrates that our proposed framework and algorithms outperform the traditional separated resource allocation methods in different datasets. In particular, with the number of PM and VM types increasing, our algorithms derive better allocation schemes, while the traditional methods tend to have more uncertainty on their performance. Finally, increasing PM types reduces the cost more significantly compared with increasing VM types for our proposed framework, and increasing both PM and VM types is to some extent equivalent to combining the effects of increasing them separately.

Fig. 3.
figure 3

Four compared schemes’ adaptability on different distribution of datasets

6 Conclusion and Future Work

This paper presents a global perspective to optimize the resource allocation in private cloud platforms, where we combine the original separated VMS and VMP processes, and formulate the joint VM selection and placement (JVMSP) problem. We analyze the hardness of the JVMSP problem and convert it into two sub-problems. A theoretical proof is provided to show the relationship between the JVMSP problem’s optimal solution and its two sub-problems’. Besides, for each sub-problem, we provide a heuristic algorithm. Future work can be done to define other forms of cost function, so that this work can be applied to deal with other optimization goals more than economic expense in private clouds.