Resource allocation in cloud using simulated annealing

0 downloads 0 Views 258KB Size Report
efficient resource allocation algorithm using simulated annealing. Our approach can be ... In this paper, resource allocation problem is modeled in terms of multi ...
2014 Applications and Innovations in Mobile Computing (AIMoC)

Resource Allocation in Cloud using Simulated Annealing Diptangshu Pandit, Samiran Chattopadhyay

Matangini Chattopadhyay

Department of Information Technology, Jadavpur University Kolkata, India

School of Education Technology, Jadavpur University Kolkata, India

have n number of computing resources each with m number of parameters such as CPU, RAM, Storage, Bandwidth etc. Several requests arrive where each request comprises specific amounts of each or some of these parameters. Thus, the resource allocation problem can be mapped to m parameter bin packing problem where, each cloud service request contains m parts and each resource in the provider side can be considered to be a bin, each having m parameters. When one request is served, a bin is filled with the request. This means, the resource has enough capacity to allocate the required amount of each of the parameters as mentioned in the request. In terms of bin packing problem, a servicing bin should have enough capacity to allocate the requirement of a request, parameter by parameter. This also means, if the capacity of one parameter of the bin is full, the whole bin is considered to be full regardless of availability of capacity of other parameters of the bin. We propose to find out fast algorithm to allocate resources to cater dynamically arriving requests maintaining a very high utilization. Our methodology utilizes a variation of multidimensional (multi-parameter) bin packing to model the problem whereas many others have modeled the problem using generalized knapsack problem. We have used simulated annealing to derive an algorithm for efficiently allocating resources. Moreover, our approach can be generalized to solve resource allocation problem at multiple layers of cloud computing services. Finally, we have carried out experiments to demonstrate that our proposed algorithm provides better resource utilization than commonly used First Come First Serve (FCFS) method. Moreover, our algorithm is linear in terms of number of resources. The remainder of the paper is organized as follows. In section II, we discuss different layers of cloud architecture and have identified types of resources and kinds of parameters at each layer. In section III, we further formalize the problem as a modified multi parameter bin packing problem. We discuss the proposed algorithm in section IV. In section V, experimental results are presented. Finally, we conclude with possible future works and usage in section VI.

Abstract: One of the major problems in the domain of cloud computing is to allocate requests to resources maintaining high resource utilization. Many researchers have used heuristic algorithms, statistical methods, stochastic knapsack problem, and soft computing techniques to solve this problem. In this paper, we have utilized a variation of multi dimensional (multi parameter) bin packing to model the problem. We have also presented an efficient resource allocation algorithm using simulated annealing. Our approach can be generalized to solve resource allocation problem in multiple layers of cloud computing. Furthermore, we have carried out experiments to illustrate efficiency of our algorithm with respect to commonly used First Come First Serve (FCFS) resource allocation method. Keywords: Cloud Computing, Resource Allocation, Bin Packing, Soft Computing, Simulated Annealing.

I. INTRODUCTION Cloud computing services [1][2] have become very popular recently because of its main three features: (1) Cost Effectiveness, (2) On demand/dynamic nature, (3) Ease of accessibility. Cloud computing paradigm is composed of main three service models, namely, Software as a Service (SaaS), Platform as a Service (PaaS) and Infrastructure as a Service (IaaS). Cloud offers data as a service, hardware as a service and even everything as a Service (which is called “XaaS”, where X is the offering of Cloud provider). Any cloud infrastructure has multiple fundamental computing resources which are provisioned while servicing requests. Resource allocation is considered to be one of main problems at the cloud provider side. A good resource allocation strategy aims to achieve zero fragmentation which leads to maximum utilization of resources and in turn, maximum profit is generated. A lot of research is already done on static Virtual Machine (VM) provisioning [3], [4], [5], [6] and dynamic VM allocation [7], [8], all of which deals with general resource allocation problem in cloud computing domain. [3] models the problem in terms of geometrical properties. Algorithms in [4], [5], [6] have used heuristics. [9] uses modified algorithms already available for solving bin packing. The algorithm in [10] uses statistical multiplexing. [11] uses stochastic multi dimensional knapsack problem for modeling. Some researchers have also used soft computing techniques [12], [13] to solve this problem. In this paper, resource allocation problem is modeled in terms of multi parameter bin packing problem. Suppose, we

978-1-4799-3880-3/14/$31.00 ©2014 IEEE

Nabendu Chaki Department of Computer Science & Engineering, University of Calcutta Kolkata, India

II. CLOUD ARCHITECTURE There are three main models of cloud. In Software as a Service (SaaS) model, the consumer runs a thin client to access the requested application running on a cloud infrastructure by the provider. The consumer or client does not have any control over cloud infrastructure i.e. underlying Operating System or the platform on which the software is running. Also, software

21

is maintained by cloud service provider except user specific application configuration. In Platform as a Service (PaaS) model, consumer deploys supported applications on cloud infrastructure. Here, applications are maintained by the client but clients have no access to underlying infrastructure on which application is deployed and is maintained by the cloud provider. In Infrastructure as a Service (IaaS) model, the fundamental computing resources (e.g., Processor, Storage) are provided and client can deploy their software (e.g., Operating System and other applications)[1]. The hierarchy of the basic cloud architecture for a single physical machine is shown in figure 1. Software runs on a platform and platforms in turn run on virtual machines and virtual machines run on top of physical machines (hosts). To create a cloud architecture, we need physical machine(s) and virtualization software like Xen Cloud Platform[14], OpenStack[15], VMware vCloud® Hybrid Service™[16] etc.

At this layer, requests are for platforms and the platforms are to be deployed on virtual machines. Some examples of parameters at this layer are operating system, Java Runtime Environment, VC++. These requests are served by finding out a virtual machine which supports the platform request and has enough capacity in terms of space, computation, bandwidth etc. If no compatible virtual machine can be found out then a new virtual machine has to be set up to serve the platform request. Software as a Service: At this layer, client requests for application software such as image manipulation software, word processor, compiler etc. The provider of this request must have the software and an appropriate platform on which the software can run. A close scrutiny revels that an SaaS request automatically imposes some requirements (processing speed, memory, storage etc.) on the platform on which it runs. In turn, the choice of the platform imposes several constraints on the virtual machines on which the platform can be deployed. So, in general, at each level, the cloud providers have resources and they have to serve requests which are specified in term of a number of parameters. The objective of the provider is to serve as many requests as possible using minimum number of resources.

Host 1 Virtual Machine 1 Platform 1

Platform 2

Virtual Machine 2 Platform 3

Virtual Machine 3 Platform 4

III. THE PROBLEM Software 1

Software 4

Software 2

Software 5

Software 6

Platform 5

As already stated, each cloud service request, regardless of its type, has multiple parameters (e.g., No. of Processing Units, Processing Unit Speed, Architecture, Main memory, System Bus Speed, Storage etc.). When these requests are served or allocated to resources having same parameters and adequate capacity, some parameters are only used for checking compatibility (e.g., Architecture, Platform) and some others are to be consumed (e.g., RAM, Disk Space). Table 1 shows a few of available resources with some typical parameters. Resource No. CPU RAM Storage No. 8 16 GB 1 TB 1 4 2 GB 500 GB 2 8 4 GB 500 GB 3 2 1 GB 500 GB 4

Platform 6

Software 3 Fig. 1.

Basic Cloud Architecture

A data center might have multiple hosts and for each host the architecture is similar to Figure 1. At each different layer, several parameters can be identified as explained in the following. Infrastructure as a Service: Resources at cloud provider side are physical machines and virtualization software. Some typical parameters of a particular resource include:  Number of Processing Units (Cores)  Processing Unit Speed (Instructions /second)  Architecture (64 bit or 32 bit)  Main memory (RAM)  System Bus Speed (Gb/second)  Storage (Secondary Memory)  Network Speed (Mb/second) Request at this layer for virtual machines will include some of these parameters and they are to be fulfilled by one physical machine where the request is to be served.

Table 1: Examples of some available resources

Table 2 shows sample requests with three parameters. Request No. 1 2 3 4 5 6 7

No. CPU

RAM

Storage

2 1 1 1 2 4 2

512 MB 1024 MB 512 MB 1024 MB 1024 MB 512 MB 1024 MB

100 GB 200 GB 200 GB 200 GB 400 GB 100 GB 400 GB

Table 2: Examples of some requests

Platform as a Service:

22

Let us consider these requests as items each having three parameters and the resources as bins each having the same parameters. In the single dimensional bin packing problem i.e., when the number of parameter is one, the goal is to pack n items with sizes s1,... sn into bins of capacity c such that all items are packed into the fewest number of bins and the sum of the weights of the items in each bin is no greater than the capacity. It is also a well-known NP Hard problem. In our case, we have multiple parameters/parts/dimensions in each bin. So, our problem is similar to bin packing problem where each bin contains multiple fixed numbered sub-bins. Each sub-bin has a different size. In our problem if any sub bin of a bin reaches its capacity, then we consider the bin also reaches its capacity. When we want to pack an item into a bin, the sub parts of the item must be accommodated into corresponding sub-bins. If any part/parameter of the item cannot be accommodated in the corresponding sub-bin, it is considered that the item cannot be accommodated in the bin itself. To explain this point, we consider a 2D bin packing problem with X axis represents number of CPUs and Y axis represents RAM as shown in Figure 2.

V4

V 5

V2

minimum unallocated portion of any available resource parameter. 1

Parameters>

2

4

3

5

Request 4 Request 3 Request 2 Request 1

Resource

Multi-parameter bin packing.

Fig. 3.

This packing problem can be mathematically formulized as stated in the following. Suppose, we have total X ≥ 0 number of requests and Y ≥ 0 number of resources and each request and resource has N

V2

number of parameters/dimensions. Let

Rxp be the requirement

of the request x in p-th dimension (parameter) and capacity of V1

V3

Standard 2D Bin Packing

requests can be served by a single resource. The resource requests (x) should be grouped into sets such that each set of requests requires same type of resource (and each group of requests will be assigned to a single resource). The Objective is to,

Our 2D Bin Packing

N

Fig. 2.

C yp . Single or multiple

resource y in p-th dimension is

V1

Maximize

Two variants of 2D bin packing problem

Y

X

 A p 1 y 1 x 1 N Y

C p 1 y 1

The largest container (grey) in Figure 2 represents a Physical Machine and the small boxes represents virtual machines hosted in it. Same resources of a physical machine cannot be used by different virtual machines. So, once V1 is hosted reserving an amount of RAM and CPU, no other virtual machine can be hosted sharing CPU and the RAM of V1. Therefore, the packing represented by standard 2D bin packing in Figure 2 is not a correct depiction of the problem in hand. The packing presented in the right side of Figure 2, however, is a feasible allocation. This shows that the model of our problem is different than general multi-dimensional bin packing problem. For better understanding, a diagrammatic representation is shown in Figure 3 using four requests and one resource having five parameters. After they are packed, the multi-parameter bin is full as one of the bin parts (parameter 2) has reached its capacity. So, the aim of an optimization algorithm is to arrange and allocate resources in such a way that there will be

Rxp

xy p y

X

p Axy Rxp  C yp

Subject to,

x 1

Where Axy = 1 if x request is allocated to resource y

Axy = 0 otherwise. If we consider the best case (i.e. utilization is 100%) the N

equation becomes

Y

 C yp p 1 y 1

N

Y

X

 A p 1 y 1 x 1

xy

Rxp = 0

Otherwise, some resources are not completely utilized and the problem turns out to be an optimization problem where goal is N

to make

Y

p 1 y 1

23

N

Y

X

 C -  A p y

p 1 y 1 x 1

xy

Rxp as less as possible.

X

The optimization problem can be generalized to multiple levels.

Qy   Axy Qxy ---- (2) x 1

IV. PROPOSED ALGORITHM

The Soft Constraint makes sure the cost of each resource reduces in each iteration. Hard Constraint is defined as follows

Classical Bin Packing problem is one of the oldest problems of computer science which is studied thoroughly [17], [18]. But the traditional algorithms including dynamic bin packing [19], multi-dimensional bin packing, are not much useful to solve our problem as we have shown in the last section that there is a difference between conventional multi dimensional bin packing and the current resource allocation problem. Our resource allocation problem is also NP Hard like the conventional multi dimensional bin packing. Simulated Annealing (SA) is a soft computing technique to find optimal or near optimal solution of NP Hard problems. It is motivated by an analogy to annealing (cooling of material in a heat bath) in solids. When we heat a solid past its melting point and cool it, the structural properties of the solid depend on the rate of cooling. Sufficiently slow cooling results large crystal. However, quick cooling yields imperfect crystals. Table 3 shows relationship between Physical Annealing and Simulated Annealing as applied to optimization algorithms by mapping parameters of each other [20]. Thermodynamic Simulation System States Energy Change of State Temperature Frozen State

X

p Axy Rxp  C yp ----- (3) x 1

Algorithm Priority_Fit_SA Input:  Request Buffer x[] (Array of incoming requests equivalent to items in bin packing problem) 

Resource List y[]. (Each item in Rs represents a resource equivalent to bin in bin packing problem and available capacity )



Number of Iterations T (Temperature)



Ignore Probability P

Output: Allocation []. Steps 1. For each resource y( in y[]) do 2. Create initial solution by adding random requests from request buffer to the current resource until it reaches capacity. a. While (true) do b. Try to add a random resource request to current resource y. c. If Success then d. Update allocation e. Continue f. Else break g. End If h. End While 3. Temp = T 4. While (Temp > 0) do 5. Find the highest cost (using Equation (1)) request which is assigned to current resource y 6. Find a random request from request buffer and calculate cost (using Equation (1)) 7. If (cost of second request < cost of first request) do 8. Remove first one and try allocating latter one without breaking hard condition (using (3)). If failed, reallocate previous and continue 9. Else 10. Remove first one and allocate latter one with probability P. If failed while allocating new request reallocate previous and continue 11. End If 12. End While 13. End For

Combinatorial Optimisation Feasible Solutions Cost Neighbouring Solutions Control Parameter Heuristic Solution

Table 3: Correspondence between Physical and Simulated Annealing

We have used SA to design our algorithm to achieve near optimal solution without compromising performance. First, we take an initial solution by considering random requests until one of the parameters in current bin is filled up and initialize the number of iterations (i.e., temperature in the parlance of SA). Then, we calculate cost function and swap the costliest item from bin allowing violation of the soft constraint with very low probability but maintaining the hard constraint. Soft constraint refers that we only allow better solution than the previous in terms of resource cost. Hard constraint implies that the capacity of a resource cannot be exceeded. This swapping process is repeated until the number of iterations reaches a predefined threshold or the system stability is achieved. The algorithm is applied for single layer but can be applied repeatedly on each layer. Before we describe the algorithm in detail we are going to define some standard simulated annealing parameters. Suppose a resource has N number of parameters. Cost of a request x can be formulated with respect to resource y as follows

Rxp 1 N Rxp '   p ' ---- (1) p n p ' 1 C y p 1 C y N

Qxy  

Cost of the resource y while serving the requests can be calculated as

14. Return Allocation[]

24

15. Wait for next time slot 16. Go to step 1 V.EXPERIMENTAL RESULTS We have implemented a Java simulator to compute the resource utilization when requests are served by several allocation strategies. In our experiments, resources have 4 parameters as shown in Table 4. Each resource parameter has a minimum value which can be increased in steps to a maximum value. We have generated 100 resources randomly using the ranges of the parameters mentioned in Table 4. Similarly, requests also have 4 parameters as shown in Table 5. Each request parameter also has a minimum value which can be increased in steps to a maximum value. Requests are dynamically generated until size of all requests reach 1.5 times the total resource capacity at every time slot. The experiment is continued for 200 time units.

Fig. 4.

Resource utilization using FCFS

Resource

No. RAM Bandwidth Storage CPU Maximum 8 32 GB 10 GB 5 TB Minimum 2 2 GB 2 GB 500 GB Steps 1 250MB 1 GB 100 GB Table 4: Resource parameters and their range

Requests

No. RAM Bandwidth Storage CPU Maximum 8 16GB 10GB 1TB Minimum 1 250MB 1GB 100GB Steps 1 250MB 1GB 100GB Table 5: Sample request and their range

Fig. 5.

Resource utilization using Priority_Fit_SA

The diagrams in Figure 6 show results of using these two algorithms on three different random runs using the same set up. The three graphs on the left side of Figure 6 show the result of FCFS algorithm and three graphs on the right side of Figure 6 show the result of our proposed algorithm.

We have plotted graphs to show utilizations of CPU, RAM, System Bandwidth, and Storage by allocating requests to resources according to (i) First Come First Serve (FCFS) algorithm and (ii) our algorithm. In each graph, the Y axis represents resource usage in % and the X axis represents simulation time. Red, Green, Yellow and Blue lines represent CPU, RAM, System Bandwidth, Storage utilizations. The black line in the graph indicates the average % of usage of all resources in that entire duration of simulation. We ran the simulator with the same input using Priority_Fit_SA and got significantly better results. Figures 4 and 5 show resource utilization as obtained by running FCFS and our algorithm, Priority_Fit_SA respectively. Test run shows better performance of our algorithm than the FCFS algorithm in terms of resource usage. Though FCFS is the fastest algorithm, our algorithm Priority_Fit_SA doesn’t compromise speed very much as most of its time consuming operations (like sorting) are done on small subset of the given input.

25

ACKNOWLEDGMENT This work is partially supported by the project “Mobile Computing and Innovative Applications” under UGC UPE Phase II, Jadavpur University. REFERENCES

Fig. 6.

[1] "The NIST Definition of Cloud Computing". National Institute of Science and Technology. Retrieved 24 July 2011 [2] R. Buyyaa, C.Yeoa, S.Venugopala, J.Broberga, and I. Brandicc, Cloud computing and emerging IT platforms: Vision, hype, and reality for delivering computing as the 5th utility, Future Generation Computer Systems, Volume 25, Issue 6, June 2009, pp 599-616.. [3] M. Mishra and A. Sahoo, On Theory of VM Placement: Anomalies in Existing Methodologies and Their Mitigation Using a Novel Vector Based Approach, Proceedings of the 4th IEEE International Cloud Computing Conference, 2011. [4] M. Sindelar, R. Sitaraman and P. Shenoy, Sharing-Aware Algorithms for Virtual Machine Colocation, Proceedings of the23rd Annual ACM Symposium on Parallelism in Algorithmsand Architectures, 2011. [5] C. Isci, J. Hanson, I. Whalley, M. Steinder and J. Kephart, Runtime Demand Estimation for Effective Dynamic Resource Management, Proceedings of the 12th IEEE/IFIP Network Operations and Management Symposium, 2010, 381-388. [6] S. Lee, R. Panigrahy, V. Prabhakaran, V. Ramasubrahmanian, K. Talwar, L. Uyeda and U. Wieder, Validating Heuristics for Virtual Machine Consolidation, Microsoft Research, MSRTR2011-9, January 2011. [7] M. Chen, H. Zhang, Ya-Yunn Su, X. Wang, G. Jiang, Yoshihira K., Effective VM sizing in virtualized data centers, IFIP/IEEE International Symposium on Integrated Network Management (IM), 2011. [8] R. N. Calheiros, R. Ranjan, and R. Buyya, Virtual Machine Provisioning Based on Analytical Performance and QoS in Cloud Computing Environments, 2011 International Conference on Parallel Processing, 2011, pp. 295-304. [9] Y. Ajiro and A. Tanaka, Improving packing algorithms for server consolidation, Proceedings of the International Conference for the Computer Measurement Group (CMG), 2007. [10]S. Govindan, J. Choi, B. Urgaonkar, A. Sivasubramaniam, andA. Baldini, Statistical profiling-based techniques for effective power provisioning in data centers. In Proceedings of the 4th ACM European conference on Computer systems, pp. 317-330, 2009. [11]B. B. Nandi, A. Banerjee, S. C. Ghosh, and N. Banerjee. Stochastic vm multiplexing for datacenter consolidation. In IEEE International Conference on Service Computing, 2012. [12]P. Campegiani, A Genetic Algorithm to Solve the Virtual Machines Resources Allocation Problem in Multi-tier Distributed Systems, Second International Workshop on Virtualization Performance: Analysis, Characterization, and Tools (VPACT’09), Boston, Massachusett, April, 2009. [13]H. Nakada, T. Hirofuchi, H. Ogawa and S. Itoh, Toward Virtual Machine Packing Optimization Based on Genetic Algorithm, Proceedings of the 10th International Work-Conference on Artificial Neural Networks: Part II: Distributed Computing, Artificial Intelligence, Bioinformatics, Soft Computing, and Ambient Assisted Living, Salamanca, Spain, 2009, pp. 651 – 654.

Resource utilization Comparison

VI.FUTURE WORKS AND CONCLUSION This algorithm works well with high temperature value depending on the size of bin (resource) and availability of items (requests), although, what should be exact temperature before we start algorithm is just assumption and there is no formal procedure described in this work. The Ignore Probability Pin algorithm determines whether in next iteration it will accept a worse solution or not. So, allowing higher ignore probability might yield bad result. In contrast to that, Ignore Probability also helps overcome the local minima problem where solution might stick to a state which is locally considered optimal but better global state exists. Again, in our algorithm, we initialized P = 0.1 for better results, although, a better way is to form a mechanism to determine P as it should be variable according to SA algorithms and it should be function of both the temperature of the system and of the change in the cost function. Another improvement scheme could be suggested varying cooling speed. If we initialize temperature too high the algorithm will look for better solution but this process might take long time which might not be acceptable in different situations. So, in those cases, acceptable solution will be a faster cooling by changing cooling rate from linear to nonlinear if needed. Finally, the multi-layer implementation of this algorithm on top of cloud architecture is yet to be done. That task is not as easy as it looks like as not only resource allocation algorithm needed to be implemented, but also we will need a deployment algorithm to deploy prerequisite layer before allocation resources on top of it. This multi-layer implementation will add a different dimension to the problem and efficiency will go down exponentially depending on number of layers.

26

[14]Xen Project: Open Source Hypervisor, High Performance Clouds, December 2013. URL : http://www.xenproject.org/ [15]Open stack open source cloud computing software, December 2013. URL:http://www.openstack.org [16]VMware virtualization software for desktops, servers and virtual machines for a private cloud, December 2013. URL: http://www.vmware.com/ [17]E. G. Coffman, M. R. Garey, and D. S. Johnson, Approximation algorithms for bin packing: A survey, Approximation algorithms (D. Hochbaum, ed.), PWS Publishing Company, 1997. [18]J. Csirik, G. J. Woeginger, On-line packing and covering problems, in: A. Fiat, G.J.Woeginger (Eds.), Online Algorithms: The State of the Art, in Lecture Notes in Computer Science Volume 1442, 1998, pp 147-177. [19]E.G. Coffman, M.R. Garey, D.S. Johnson, Dynamic bin packing, SIAM Journal on Computing 12, 1983, pp. 227–258. [20]K.A. Dowsland, Simulated Annealing. In Modern Heuristic Techniques for Combinatorial Problems (ed. Reeves, C.R.), McGraw-Hill, 1995.

27