Two-stage cloud service optimisation model for cloud service middleware platform

In this study, a cloud service optimisation model is presented for resource adaptation control, in which the cost to the user, various levels of virtual machine efficacy, and rental price are considered. A cloud service middleware that supports flexible web services by using heterogeneous platforms is proposed. Developers can conveniently register web services and deploy them to the middleware. The middleware provides an energy-minimisation load balance (EM-LB) mechanism, which considers the temperature of the machine, its power consumption, and the computing resources of virtual machines. The EM-LB mechanism maintains a safe temperature threshold and minimises power usage, thereby reducing hotspots and conserving energy. Furthermore, a two-stage cloud service optimisation model is proposed to analyse users’ requirements and existed computing resources for finding the Pareto optimality, and the aspirational level is found in accordance with the Pareto optimality for the lower cost and lower execution time. The simulation results show the efficiency of the proposed cloud service optimisation model and EM-LB mechanism. Finally, the proposed EM-LB mechanism is implemented to prove the feasibility of the model.


Introduction
In recent years, the cloud computing industry has flourished. Worldwide enterprises are actively promoting and developing cloud services that reduce business costs and increase profits [1]. Cloud computing services are divided into infrastructure as a service (IaaS), platform as a service (PaaS), and software as a service (SaaS). The PaaS market is the smallest segment of the cloud computing industry, but it creates a large environment of partners and developers, producing products that are easy to use, customise, and develop. More than 150 companies currently offer PaaS products. Service-oriented architecture (SOA) is the most popular type of paradigm, and it comprises some web-service standardised components that provide a flexible and uniform interface, integrating software from multiple sources. Web service is a basic tool that applies to open data formats (e.g. XML, XML Schema) and defines the standard service interfaces of web communications protocols. However, traditional middleware architecture cannot supply dynamically adaptable computing resources based on the demands of the cloud service without wasting resources and reducing the quality of service. The rapid growth of the cloud computing industry has increased network traffic, information, and the need for data storage capacity, and the energy consumption of data centres has increasingly become a concern.
A cloud service middleware (CSM) platform is proposed that integrates an energy-minimisation load balance (EM-LB) mechanism to disperse user service requests, maintain system stability, and reduce energy consumption. According to the variation in user requests, the cloud service optimisation model optimises the computing resources. Furthermore, previous studies focused to find the Pareto optimality according to the limited resources [2][3][4][5][6][7][8][9], but the aspirational level has not been investigated. This study proposes a two-stage cloud service optimisation model to analyse users' requirements and existed computing resources for finding the Pareto optimality, and the aspirational level is found in accordance with the Pareto optimality for the lower cost and lower execution time.
This paper is organised as follows: In Section 2, this study provides background knowledge of SOA and load balancing mechanisms. In Section 3, this study proposes the architecture of CSM. This study gives the experiment results and discussions in Section 4. Finally, this study summarised the contributions of this paper in Section 5.

Literatures review
This section discusses the previous studies of SOA and load balancing mechanisms.

Cloud computing and service-oriented architecture
SOA is a flexible and software platform architecture. In serviceoriented computing (SOC), basic services are used to construct rapid, low-cost, secure, and reliable applications. It reduces the need to develop new system components each time a new business process arises, making enterprises more competitive. Web service definition language provides service calculations to execute complicated programmes in distributed environments, whereas simple object access protocol (SOAP) and representational state transfer (REST) link with external communication interfaces. In a cloud computing environment, working with SOC is challenging. Therefore, a cloud web service that can be used to simultaneously operate and communicate between clients and servers without a platform is proposed [10]. Although the performance of REST may be higher than the performance of SOAP [11], several online systems based on SOAP which existed to obtain services in Taiwan [12,13] could not be replaced with REST for cost issues, Therefore, the frameworks for composing SOAP, non-SOAP and non-web services were proposed based on enterprise service bus (ESB) or business process execution language [14][15][16]. This study gives a case study of SOAP-based services for the evaluation of the proposed two-stage cloud service optimisation model, and the REST-based services or non-web services can be adopted as the other case studies in the future.
Some studies developed the SOAs based on cloud computing and virtualisation techniques. For instance, the publish-subscribe mechanism was adopted into a middleware framework in cloud computing environments for the dynamic orchestration [17]. Furthermore, the issues of fault tolerant and execution performance were discussed and solved [18,19]. However, these studies focused to find the Pareto optimality according to the limited resources, but the aspirational level has not been investigated. Therefore, this study proposed a two-stage cloud service optimisation model to find the aspirational level to provide web service solutions with higher performance and lower cost.

Load balancing and scheduling techniques for cloud computing
Load balancing is one mechanism that distributes the dynamic workload evenly across the nodes in a computer network, and it can be adapted and scaled to various systems. In load balancing, multiple computers or computer resources are connected to increase the capacity of the system and reduce response time, facilitating a high ratio of user satisfaction to resource utilisation. Moreover, load balancing enables scalability, avoids bottlenecks and overprovisioning, reduces response time, and facilitates the implementation of fail overs [20]. To achieve green, or environmentally friendly, cloud computing, the load balance must reduce the overall energy consumption and carbon emissions. Regarding energy consumption, a balanced load and workflow prevents overheating the nodes of a cloud, reducing the amount of energy consumed. A system that consumes a large amount of energy emits a large amount of carbon. When the energy consumption is reduced using load balancing, carbon emission is reduced and green computing can be achieved.
Task assignment and workflow scheduling are the important issues for the design of load balancers in cloud environments [21,22]. Therefore, some studies proposed task assignment and scheduling techniques to analyse the optimisation of waiting time, cost, or task profits. For instance, a cost-effective load balancing technique was proposed to analyse the demands of tasks and fixed limited resources (e.g. the number of processors and the communication bandwidth ability) for finding the Pareto-optimality of solutions with lower cost (i.e. single-objective) [2]. For the optimisation of waiting time, a particle swarm optimisation was proposed to perform the Pareto optimal task scheduling based on function fitness with given fixed resources [3,4]. Moreover, a Pareto distribution model and the Bayes theorem were proposed to maximise the total of profits based on the constraint of given resources [5,6]. Although these studies could find the Pareto-optimality of solutions, they only considered the optimisation of single-objective (e.g. waiting time, cost, or profits). Therefore, some studies discussed the multi-objective task assignment and scheduling techniques for the complex practical environments. For example, the Pareto optimality of cloud bursting was proposed to analyse the optimisation of the makespan and the total cost based on fixed limited resources [7]. Furthermore, the particle swarm optimisation and the entropy optimisation were proposed to find the Pareto optimality solutions based on given fixed resources for minimising the processing time and the total cost [8,9]. However, these studies assumed unchangeable resource pools to find the Pareto optimality solutions for the scheduling and load balancing in cloud environments. The aspirational-level solutions have not been investigated. Therefore, this study proposed two-stage cloud service optimisation model to analyse the multi-objective optimisation based on changeable resource pools and dynamic recontracting with virtual machine providers for reaching aspirational level.

Cloud service middleware platform
The proposed CSM platform supports web service and operates independently of other services or interfaces. Fig. 1 shows the architecture of CSM platform, which is divided into the client application, service load balance middleware, web service, and virtual machine layers.

Client application layer
Standard web service user applications are developed by programmers based on the demands of users. Programmers compile codes into executable files that are supplied to clients. If the service needs change or adjustments, programmers create new codes and updated executable files. This development approach is difficult to maintain. The CSM model provides users with rich internet applications, allowing them to use a web browser to customise their cloud service.

Service load balancing middleware layer
In the service load balancing middleware layer, the CSM provides an EM-LB mechanism for redirect servers. The redirect server possesses a temperature, power consumption, and virtual machine clusters for computing resources and loading. By using servicelevel agreement (SLA) and this information to disperse user service requests, the CSM assigns users an available location. Figs. 2 and 3 depict the EM-LB mechanism and the physical and virtual machine selection phases. In the physical machine selection phase, the CPU thermal model is used, which is described in (1) and includes the dynamic section ( − x 0 /x 2 ) × e −x 2 t , static section (x 1 /x 2 ) × P, and ambient temperature E 0 [23]. According to the calculated oscillatory power consumption, the CPU temperature E, with time t, is used to determine the safe temperature range for a physical machine. The values of constants x 0 , x 1 , and x 2 are measured and determined by historical records. Furthermore, the values of other constants (e.g. E 0 and P max ) are determined in accordance with [23,24] The power model was used to determine the current power utilisation of a physical machine [24]. The model is described in (2), where k is the power ratio of idle status, y is the usage percentage of the CPU, and P max is the maximal power of a physical machine In the virtual machine selection phase, a virtual machine is selected from the physical machines. The virtual machine is configured based on various resources. Formula (3) describes the resource use (U vm ) of a virtual machine The service time (T service ) of a web service is described in (4) and includes the million instructions per second (MIPS) usage of the service (MIPS service ) and the virtual machine surplus of MIPS. In this phase, an SLA for service time is established, and the T service must be less than the SLA

Web service layer
The web service layer is the computing unit of the CSM model. In this layer, service providers register and deploy web services to virtual machine layer by using the service load balancing middleware layer. Service providers can quickly delete and update their web services because the middleware allows for flexibility. To accommodate high web service loads, the multiple service locations were used and the redirect server assigns an appropriate service location (e.g. a uniform resource identifier) based on the demands of the user.

Virtual machine layer
In the virtual machine layer, the virtualisation software, e.g. Virtualbox, VMware, and Xen, is used to divide the physical machine resources into several virtual machines. The virtual machine is a complete system platform of the operating system and application environment. The total budget (B) is used calculate the execution time (T execute ) based on the constraints in (5).
(i) u l is the number of levels of the virtual machine (ii) n l is purchased the virtual machines (iii) t l is the execution time of the virtual machine (iv) r l is the allocation of demand According to these parameters, the batch processing number r l u l is calculated, and the longest execution time t l × r l u l is calculated for various levels to determine the minimal T execute value. For instance, Fig. 4 shows that the minimal value results from the longest execution time. In this case, Type 1 is the cheapest type of virtual machine (i.e. c 1 , c 2 , ··· , c L ), but the execution time of Type 1 virtual machine is the longest for each demand (i.e. t 1 . t 2 . ··· . t L ). There are eight demands (i.e. the value of q is 8), and these demands are distributed to four types of virtual machines (i.e. the value of L is 4). One virtual machine is purchased for each type (i.e. n 1 , n 2 , ··· , n L ). The resource adaptation strategies of Stage (1) include the following distributions: (1) one demand is distributed to Type 1 virtual machine (i.e. the value of r 1 is 1), and the total execution time of Type 1 virtual machine is t 1 1 ; (2) one demand is distributed to Type 2 virtual machine (i.e. the value of r 2 is 1), and the total execution time of Type 2 virtual machine is t 2 1 ; (3) three demands are distributed to Type 3 virtual machine (i.e. the value of r 3 is 3), and the total execution time of Type 3 virtual machine is t 3 3 (i.e. t 3 3 = t 3 + t 3 + t 3 ); (4) three demands are distributed to Type 4 virtual machine (i.e. the value of r 4 is 3), and the total execution time of Type 4 virtual machine is t 4 3 (i.e. t 4 3 = t 4 + t 4 + t 4 ). The longest execution time is t 1 1 , so the value of T execute is equal to t 1 1 . Furthermore, the total cost C ′ in Stage (1) is shown as follows: Stage (2): Finding the aspirational level according to the cost in Stage (1).
In this stage, the longest T execute time and total cost C ′ were calculated in (5) and (6), where the minimal cost C ′′ in Stage (2) is based on constraints. For finding the aspiration level, the number of various virtual machine levels u ′ l was calculated using (7). For instance, Fig. 5 shows the adaptation controls that are used when the costs are expensive or there is an excess amount of virtual machines. In this case, the cost of Type 4 virtual machine is very expensive. In Stage (2), a contract is negotiated with the cloud computing provider to purchase more Type 1 virtual machines (i.e. the value of n 1 is increased up to 4) and release the Type 4 virtual machine. The resource adaptation strategies of Stage (2) include the following distributions: (1) four demands are distributed to the four Type 1 virtual machines (i.e. the value of r 1 is 4), and the total execution time of Type 1 virtual machine is t 1 1 ; (2) one demand is distributed to Type 2 virtual machine (i.e. the value of r 2 is 1), and the total execution time of Type 2 virtual machine is t 2 1 ; (3) three demands are distributed to Type 3 virtual machine (i.e. the value of r 3 is 3), and the total execution time of Type 3 virtual machine is t 3 3 (i.e. t 3 3 = t 3 + t 3 + t 3 ). Therefore, the longest execution time which is t 1 1 is same with the execution time of the Pareto optimality in Stage (1). Furthermore, the minimal cost (C ′′ ) in Stage 2 is lower than the cost C ′ in Stage (1) if the cost of Type 4 virtual In (8), u ′ l and n l are used to obtain the adapted resource value a l , where a l . 0 is required to add this level virtual machines and a l , 0 is required to decrease the overage of virtual machines

Implementation and experiments
In this section, the EM-LB and cloud service optimisation model are discussed. In addition, an EM-LB is developed and implemented for the CSM platform.

Energy-minimisation load balance
The CloudSim toolkit is an open source tool that simulates the operation of physical and virtual machines in a cloud computing centre [25,26]. The datacentre models, host, VM, and EM-LB were modified to be used in CloudSim. For the simulation, relevant CPU thermal model studies were referenced, and the ambient temperature was defined as 45°C [27,28]. Table 1 shows the environmental parameters. Tables 2 and 3 show the parameters for physical and virtual machines. Two quad-core CPUs were used: a 2933 MIPS machine and a 3067 MIPS machine. Both machines possessed 8 GB of RAM, and a network bandwidth of 1 Gbit/s. Each VM had a distinct amount of CPU and memory, and all machines operated on a 100 Mbit/s network bandwidth.
In this simulation, the daily energy consumed by the host, availability of datacentres, and the variation of average temperature were estimated. Formula (9) was used to calculate the total daily energy consumption Host i,energy (9) The datacentre host availability was calculated using (10), which verified that the EM-LB mechanism maintained a high level of host datacentre availability Host Availability = 1 − Host violation time Host total time (10) The relationship between the temperature and energy of a host is positive. Formula (11) calculates the variation of average temperature to facilitate the verification of energy consumption and the analysis of host availability The CloudSim migration mechanism was used to analyse the EM-LB mechanism. Pursuant to the presence of a migration mechanism, the location of the virtual machines is not fixed, which will migrate between each physical machine because of physical machine use and energy consumption. Figs. 6-8 show the migration mechanism used to evaluate the proposed EM-LB mechanism. Fig. 6 shows that the energy   consumptions of random, round-robin and EM-LB mechanisms.
The results indicate that the proposed EM-LB mechanism performs the optimised load balances and reduces unnecessary power consumption for each machine, so the total energies of the proposed EM-LB mechanism are lower than other methods. Furthermore, the proposed M-LB mechanism combined with a migration mechanism can provide higher availability based on the consideration of physical machine status. However, the status of physical machine is not considered by other methods, so the availabilities of these methods are lower. For the analyses of temperature, Fig. 8 shows that increased energy consumption causes temperatures to rise.

Cloud service optimisation model
The cloud service optimisation model was calculated using LINGO software. Hourly rental prices and various levels of virtual machine efficiency were referenced to differentiate the service time from Amazon EC2. Table 4 shows the parameters for the cloud service optimisation model. Assuming the hourly total cost is $15 US dollars per hour, the maximal demand is 140 units and the minimal demand is 60 units. The results show (1) the purchase of virtual machines is considered in the minimal cost; (2) the total cost is considered in the minimal cost; and (3) the total cost is considered in the highest efficiency. Fig. 9 shows that the purchase of virtual machines is considered in the analysis of minimal cost. If the purchase of virtual machines is considered in resource adaptation, the maximal virtual machine demand must be obtained. The results show that the longest execution time is 1.5 s with a demand of 140 units of virtual machines. When the demand is reduced to 120, 100, 80, or 60 units, the longest execution time is 1.5 s. The second phase of resource adaption can effectively reduce the overall cost. Fig. 10 shows that total cost is considered in the analysis of minimal cost. If the resources are adapted according to the total cost, the combination of various virtual machine levels is based on demand. In the first phase of resource adaptation, the execution times vary as demand increases or decreases. With a demand of 140 units, the longest execution time is 1.5 s, and the costs are less than the cost on demand 120 units. Since the high-level virtual machines can adapt to the low-level virtual machine, the overall efficiency will be improved. On the contrary, their cost will increase. Fig. 11 shows the most efficient model according to the total cost analysis. The purchase of virtual machines was not considered in this analysis. In the first phase of resource adaptation, the longest execution time for demands of 60, 80, 100, 120, and 140 units, was 0.75s, 1s, 1.25, 1.25, and 1.5 s, respectively. The overall total time efficiency for demands of 60, 80, 100, 120, and 140 units, was 30, 56, 85, 90.75, and 139.25 seconds, respectively. The second phase of resource adaptation was used to improve the overall efficiency, raising the total time for demands of 60, 80,100, 120, and 140 units, to 25.75, 44.5, 65.75, 89.5, and 120.75 s, respectively.

Conclusions and future work
Cloud computing organisations strive to achieve green computing, and optimising energy consumption in datacentres is the current focus of this trend. The cloud service optimisation model is proposed for resource adaptation and control, guaranteeing that the cloud service is in agreement with the service level. The model combines various levels of virtual machine resources based on demand and reduces costs and the waste of resources. Furthermore, the energyminimisation load balancing mechanism is proposed to efficiently allocate the requests of users, reduce energy consumption, and improve machine availability. Furthermore, this study proposes a two-stage cloud service optimisation model to find the aspirational level to provide web service solutions. In Stage 1, the Pareto optimality is found according to the limited resources. In Stage 2, the aspirational level is found according to the cost in Stage 1. Therefore, the solutions of the proposed two-stage cloud service optimisation model can be provided with higher performance and lower cost.
In the experimental results, migration proved a useful mechanism in the cloud environment. However, the virtual machine migration process increases energy consumption. In the future, a solution mechanism should be designed that balances energy consumption and host availability, and the real-time demands should be analysed to adapt accordingly. Furthermore, the detection of deteriorating physical machine [29] and the optimised service composition in the cloud [30][31][32] can be investigated.

Acknowledgment
The research was supported by the Ministry of Science and Technology of ROC under the grant no. MOST 105-2221-E-020-024.