In this chapter we have introduced concepts supporting subsequent technical chapters. We discussed techniques to model and solve combinatorial problems. The efforts car- ried by the research community to optimise often inefficient cloud infrastructures was then reviewed with a particular focus on workload consolidation. Finally, we showed through an example tackling a setting in which data centres are spread over several dis- tant locations how to use statistical modeling and optimisation techniques. The basis of our analysis is an approach to forecasting on the basis of a time-series representing energy prices over time, and an approach to controlling the effect of forecast errors. An assumption has been that the more distant a pair of data centres, the less correlated are their local energy prices.
Chapter 3
A Generalisation of Bin Packing as a
Core Consolidation Problem
Summary. This chapter formalises a packing problem that emerges as
a core sub-problem for managing workload consolidation in data centres. As a generalisation of the bin packing (BP) problem, it considers a set of tasks (items) to be assigned to a set of machines (bins) under capacity
constraints on each machine. Unlike classic BP settings, items have a
lifespan in the bins. We define the cost of using a bin as the product of the bin’s capacity and the time it will be used for. We refer to this problem as the Temporal bin packing problem (TBP).
We formalise the problem using mathematical modeling and present opti-
misation models using Mixed Integer Programming (MIP) and Constraint
Programming (CP) for two contrasting but equivalent viewpoints on the
problem. The packing model (PA) extends traditional BP models while
the temporal model (TP) explicitly models time with a sequence of pack-
ing problems. In addition, two ad-hoc symmetry breaking techniques are developed. Finally, we introduce both a lower bound and an upper bound on the objective function.
Our empirical results suggest that the TBP is a challenging problem for
complete solvers to prove optimality. While breaking symmetry consid-
erably reduces the computational effort for both PA and TP models, the
packing model usingCPshould be considered for solving larger instances
As a first step to model consolidation problems in cloud systems we use the formalism of the previously discussed bin packing problem (BP). Informally, we are given a set of machines (bins) and a set of tasks (items). Each task is associated with a resource requirement (i.e. CPU cycles) and the duration for which it will exist in the system. The goal is to assign all the tasks to machines while minimising the overall allocated resources. This allows us to switch off those machines that are spared by achieving better workload consolidation across the pool of machines. Motivated by this, we define the cost of using a machine as the product of its resource capacity and the time it will be used for. We refer to this problem as the Temporal bin packing problem (TBP). Although, TBP has strong connections with BP, the cost of using a bin captures the notion of time to live the bin.
As highlighted in Chapter 2, cloud providers often build and maintain over-provisioned infrastructures. As such, it is reasonable to consider that at any point in time, there are enough available machines for the workload to be addressed without any delay due to the lack of available resources. A desirable aspect of workload allocation policies is to implement workload consolidation in order to spare machines not needed to tackle the workload [BB10a]. This is usually achieved by minimising the allocated resources across the data centre. In the context of our application, minimising the sum of the machines usage cost as defined later is equivalent to minimising allocated resources across the infrastructure. In our model, we thus aim to minimise the allocated resources under the assumption that each task will be assigned and processed as soon as it arrives. Our model focuses on an offline formulation of this variant of the bin packing problem. The remainder of the chapter is structured as follows: We provide the motivation for defining TBP in the context of workload consolidation for data centres and develop a mathematical model in Section 3.1. Section 3.2 describes how the time dimension can be either implicitly or explicitly modelled with bothMIPandCP. In order to strengthen the models, Section 3.3 introduces symmetry breaking techniques. In Section 3.4, both a lower and upper bound on the objective function are derived. Finally, Section 3.5 compares the performance of the various models introduced in the chapter.
3.1
The Temporal bin packing Problem
Assigning items to bins while respecting capacity constraints is a core problem in workload consolidation problems faced by cloud providers. Servers in data centres
3. A GENERALISATION OFBINPACKING AS A
CORECONSOLIDATIONPROBLEM 3.1 The Temporal bin packing Problem
RAM and I/O capacity or network communication [GHMP08]). We will focus on a
single dimension as CPU cycles are typically reported to be a bottleneck in such sys-
tems [RTG+12]. For all the tasks submitted to the system, it is desirable to minimise
the gap from submission time to the time the task starts running on the system. Under the assumption that the infrastructure is over-provisioned, we consider this gap to be negligible as it is always possible to allocate more machines if needed. Also, we make the assumption that once a machine is powered-up the number of VMs assigned to it does not make a difference, only the maximum duration of items assigned to it does. Although workload consolidation problems are usually seen as online problems, we model an offline problem that should be solved sequentially in order to provide solu- tions to the online problem. We provide a formalisation of this core offline problem in which the allocation of tasks to servers may be seen as a generalisation of the bin packing problem. To the best of our knowledge this problem has not been described in the literature. For related packing problems, refer to Section 2.3.4.
Let J = {1, . . . , n} be the set of items (tasks to be assigned) and each item i ∈ J be defined by a pair (qi, ri) where qi ∈ {1, . . . , Q} denotes its size and ri ∈ N+ denotes
the duration for which it will be assigned to a bin. Let M = {1, . . . , m} be the set
of bins. A bin j ∈ M is defined by a capacity Cj ∈ {1, . . . , Q}. A bin is said to
be opened if it contains at least one item. The cost of using a particular bin j is a
linear function Cj × lj, where lj is the maximum duration of all the items assigned
to it. The problem is to find an assignment from items to bins subject to capacity
constraints while minimising the sum of the bins usage costsP
j∈MCj × lj. We refer
to this problem as the Temporal bin packing problem (TBP). Throughout the rest of
the chapter we will fix the bins capacity to the constant Q such that ∀j ∈ M : Cj = Q
with Q being the size of the overall largest item.
In such a context, we note that minimising resource wastage and minimising allocated resources are equivalent problems if all bins have the same capacities Q. We define the energy as duration times requirement Let the required energy be the sum over all items
of the product of each item resource requirement and its duration, i.e. R =P
i∈J qi×ri.
This energy is constant for any instance of TBP. Indeed, R does not depend on the assignment of items to bins. Let the allocated energy depend on the items assignments
and be expressed as A = P
j∈MQ × lj. Finally, the wasted energy is the difference
between the allocated energy and the required energy W = A − R. Minimising wasted
energy is: minP
j∈M(lj∗Q)−Pi∈J(ri×di) ≡ minPj∈M(lj∗Q). Since R is constant
and we consider that all bins have the same capacity, minimising the wastage energy is equivalent to minimising the allocated energy. The required energy, allocated energy and wasted energy are illustrated on Figure 3.1. The figure shows two contrasting
10 10 3 3 40 l0= 90 20 l1= 100 Required Energy Wasted Energy Allocated Energy
(a) An optimal BP solution which uses only 2 bins. Non optimal for TBP. Its cost is 1900.
10 10 10 l0= 100 l1= 40 l2= 20 3 6 7 7
(b) A non optimal BP solution using 3 bins in- stead of 2. An optimal solution for TBP with a cost of 1600.
Figure 3.1: An optimal solution for BP does not necessarily yield a good solution for TBP.
solutions to the assignment of 4 items.
Furthermore, we provide the intuition TBP is a generalisation of BP where ∀(i, i0) ⊆
J × J : ri = ri0 = r. In that case the objective function reduces toPj∈MQ × lj with the domain of lj is reduced to D(lj) = {0, r}. The items duration being all equal, we
can guarantee that lj = r for all opened bins reducing the problem to a simple packing
problem over one dimension.
Although TBP is closely related to BP, an optimal solution for BP does not necessarily yield a good solution for TBP. Consider an empty state of the bins with capacity
Q = 10. Let the following four items form an instance of TBP: J = {(3, 100), (3, 90),
(7, 40), (7, 20)} where each tuple stands for size and duration (i.e. (qi, ri)). As seen in
Figure 3.1a, finding a feasible assignment for the four items can be done using a BP approach. This solution uses the minimum number of 2 bins. Nevertheless, when the notion of time (ri) is introduced in the problem, the objective function we are interested
in is evaluated as the sum of the allocated energy (i.e. 10 × 100 + 10 × 90 = 1900). In contrast, as shown on Figure 3.1b, an optimal TBP solution uses 3 bins with a cost
3. A GENERALISATION OFBINPACKING AS A