Efficient Bin Packing Algorithms for Resource Provisioning in the Cloud Shahin Kamali Massachusetts Institute of Technology, Cambridge, MA 02139, USA skamali@mit.edu Abstract. We consider the Infrastructure as a Service (IaaS) model for cloud service providers. This model can be abstracted as a form of online bin pack- ing problem where bins represent physical machines and items represent virtual machines with dynamic load. The input to the problem is a sequence of opera- tions each involving an insertion, deletion or updating the size of an item. The goal is to use live migration to achieve packings with a small number of active bins. Reducing the number of bins is critical for green computing and saving on energy costs. We introduce an algorithm, named HarmonicMix, that supports all operations and moves at most ten items per operation. The algorithm achieves a competitive ratio of 4/3, implying that the number of active bins at any stage of the algorithm is at most 4/3 times more than any offline algorithm that uses infi- nite migration. This is an improvement over a recent result of Song et al.[12] who introduced an algorithm, named VISBP, with a competitive ratio of 3/2. Our ex- periments indicate a considerable advantage for HarmonicMix over VISBP with respect to average-case performance. HarmonicMix is simple and runs as fast as classic bin packing algorithms such as Best Fit and First Fit; this makes the algorithm suitable for practical purposes. 1 Introduction We consider Infrastructure as a Service (IaaS) model in the cloud which has received increasing attention in the past few years. In this model, a cloud service provider such as Amazon EC2 rents virtual machines (VMs) to clients. Each VM is capable of running several applications with dynamic loads that vary by the time. The total load of appli- cations encapsulated in a VM defines the load of the VM. The applications are unpre- dictable in the sense that their load and the pattern of their changes cannot be predicted in advance. In other words, the load of VMs is not known beforehand and changes over time. A service provider has to assign VMs into physical machines (PM’s) so that the total load of all VMs in each machine is no more than the uniform capacity of PM’s. In other words, servers should not be overloaded in order to avoid bottlenecks in the sys- tem and to balance the load between PMs. Moreover, the number of PM’s that are used to host VMs is desired to be as small as possible. This objective is important for green computing and reducing energy costs. Particularly, inactive PMs which do not host any VM can hibernate in fractions of a second [10] and hence save on energy costs. The IaaS model, as described above, is closely related to the classic bin packing problem. In the bin packing problem, the input is a set of items each having a size in the range (0,1]. The goal is to place these items into a minimum number of bins of uniform