Smart Architecture Energy Management through Dynamic Bin-Packing Algorithms on Cloud

: Smart Home Architecture is suitable for progressive and symmetric urbanization. Data being generated in smart home appliances using internet of things should be stored in cloud where computing resources can analyze the data and generate the decisive pattern within no time. This additional requirement of storage, majorly, comprising of unﬁltered data escalates requirement of host machines which carries with itself extra overhead of energy consumption; thus, extra cost has to be beard by service providers. Various static algorithms are already proposed to improve energy management of cloud data centers by reducing number of active bins. These algorithms are not able to cater to the needs of present heterogeneous requests generated in cloud machines by people of diversiﬁed work environment with adhering to the requirements of quality parameters. Therefore, the paper has proposed and implemented dynamic bin-packing approaches for smart architecture that can signiﬁcantly reduce energy consumption without compromising upon makespan, resource utilization and Quality of Service (QoS) parameters. The novelty of the proposed dynamic approaches in comparison to the existing static approaches is that the proposed approach dynamically creates and dissolves virtual machines as per incoming and completed requests which is a dire need of present computing paradigms via attachment of time-frame with each virtual machine. The simulations have been performed on JAVA platform and dynamic energy utilized-best ﬁt decreasing bin packing technique has produced better results in maximum runs.


Introduction
The invention of smart frameworks has fascinated the manual day-to-day activities and has resulted in escalation of raw digital data being generated via internet of things (web of sensors, electronic devices and software that are connected using internet for amplification of the automation process of devices) [1] and its interlinked and symmetric smart architectural devices. This unprecedented demand of technology driven service extraction has led to production of enormous data which has subsequently arisen a need to propose better energy management solutions. The most prominent adoption to internet of things (IoT) service can be witnessed with the usage of smart home appliances and has become the major contributing raw data generation source. With the rapid and positive development in society, "home" term cannot suffice the term "building with necessary appliances" but it represents the "smart and intelligent building". Smart home comprises of appliances like Amazon Echo, Philips Hue, TP-Link HS220, Ecobee Smart Thermostat, LG Smart TV, NetGear Arlo Q and many more that are connected in symmetry via internet and can communicate with each other [2] for facilitation of automated services. The smart appliances in smart building can be categorized as scheduled and non-scheduled [3]. Scheduled devices are thermostatic devices like iron, television, etc. are need based devices and their energy requirements are non-predictable and dynamic in nature. Non-scheduled appliances like refrigerator, lighting devices have predefined, predictable and static energy needs. The sensors connected with such smart home devices or appliances collect the raw data and transfer it to the cloud data centers via gateway. This data is further processed into patterns which are subsequently reverted to the respective appliance for responding to the desired service within limited time frame (as depicted in Figure 1). Hence, realizing the actual definition of smart appliance and making it more adaptive in making accurate decisions. Though, the concept of smart home is highly automated in its implementation and operation, still storage of generated massive data is a big challenge before service providers. The total cost of using the smart home architecture is directly proportional to the cost of energy used in storing and analyzing the raw data on cloud data centers. Mitigation of this cost highly depends upon the usage of number of active servers or bins in cloud data centres and can be efficaciously reduced by turning off extra bins, limiting the usage of extra bins for service extraction [4]. Therefore, a bin-packing algorithm comprehends best solution to easy adoption to smart architectures besides reducing the energy consumption on cloud. It is also anticipated to be a best remedy to United Nation's sustainable development goal initiative.
Perhaps, the increasing count of cloud clients on the remaining limited active server bins have deviated from the actual objective of user satisfaction and can lead to distrust of clients on cloud paradigm. This has given birth to the concept of virtualization [5] that creates virtual machine instances on physical server and provides the requisite service on the pay-per-use basis as shown in Figure 2.
All the virtual machines created on any physical host share its computing resources. Virtualization not only reduces the total energy but also helps in proper resource utilization. However, it has increased the task of system administrator to handle many virtual machines on one server. The virtualization concept is primarily being implemented to reduce the number of active servers to save energy consumption and can be well achieved by employing the techniques of bin-packing. Therefore, the term that is coined as bin-packing packs virtual machines into active bins and delivers the usage-based services to multiple clients simultaneously. The process is inclined towards minimizing number of active bins to reduce energy consumption. Following heuristic based bin-packing algorithms are prevalent in the cloud paradigm [6]: • First-Fit Algorithm-It assigns the job to the first available virtual machine (VM) on physical host which can provide the required computing capacity. • Best-Fit Algorithm-It assigns the job to the VM with minimum computing capacity which can provide the required computing capacity. • Worst-Fit Algorithm-It assigns the job to the VM with maximum computing capacity which can provide the required computing capacity. • First-Fit Decreasing (FFD), Best-Fit Decreasing (BFD) and Worst-Fit Decreasing (WFD) algorithms-These algorithms arrange all virtual machines in decreasing order of computing capacity before assigning the job.
The research work carried out primarily focuses on identifying and exploring solutions in the domain of bin-packing for leveraging the benefits it offers in the paradigm of cloud computing, primarily, energy mitigation. Therefore, following are the underlying contributions of this research work: • Extensive survey has been conducted in direction of bin-packing. • The dynamic algorithms are proposed that can cater to the heterogeneous service fulfillment considering the today's client requirements.  • Workflow defining the processing of data generated from IoT devices till it reaches the cloud and application of energy mitigation effects is proposed and discussed. • For adjudging the performance of the proposed system, makespan and resource utilization parameters have been calculated.
The arrangement of contribution in the paper is as follows: Section 2 presents the related works done in area of bin packing techniques and smart home architecture. Section 3 contains the proposed algorithms to implement bin-packing technique using best fit decreasing concept. Section 4 represents the results and discussion details about proposed approaches and Section 5 contains the concluding remarks and future scope.The extensive survey conducted is presented in next section.

Related Works
The detailed literature review on bin-packing algorithms in cloud computing and energy management in smart home appliances is mentioned below: Madumathi, R. et al. [7] proposed "Drip Based Resource Allocation" for assigning user job to the virtual machine using bin-packing technique on cloudSim simulator. It has reduced the number of active physical servers along with higher resource utilization as compared with First-Come-First-Serve (FCFS) and Round Robin Algorithms. Gbaguidi, F.A.R. et al. [8] proposed VM placement algorithm using bin-packing algorithm to use minimum number of active machines. The algorithm was compared with the brute force method. VMware hypervisorESXi 5.5 was used for virtualization. Kumaraswamy, S. et al. [9] addressed the virtual machine placement issue. Three algorithms were designed "Approximation algorithm", "Polynomial Time Approximation Scheme (PTAS) algorithm" and "Randomized algorithm". Berndt, S. et al. [10] considered fully dynamic bin-packing problem to minimize number of servers and amount of repacking. The term "migration factor" was defined as total size of repacked items divided by size of an arriving or departing item. Gupta, N. et al. [11] discussed the use of virtualization and VM migration in cloud computing. The paper compared the existing bin-packing algorithms and concluded that "EUBFD-Energy utilized BFD Packing Algorithm" is more efficient in reducing the number of physical servers and hence, the total energy consumption of the system. Karwayun, R. et al. [12] proposed dynamic resource allocation scheme for cloud computing which includes first-fit bin-packing for allocating VM, VM migration scheduler and energy consumption calculator.
Gua, L. et al. [13] addressed the resource allocation strategies in cloud and proposed "Multi-dimensional cloud resource dynamic allocation model (MDCRA)" based on vector bin packing problem. "MinTotal Dynamic Bin Packing problem" was explored in [14] explored that aims to minimize the total cost of the servers. They also proposed "Hybrid First Fit" algorithm which uses the different size of objects. Ren, R. et al. [15] solved the "MinUsageTime DBP problem" and established a new improved upper bound. They concluded that first fit is best suited for the mentioned problem. Kamali, S. [16] proposed "HarmonicMix" which used live migration to improve packing of user job on servers. The algorithm was compared with "Bin Packing with Variable Sized Items (VISBP)" to prove its effectiveness. Gupta, K. et al. [17] presented the algorithms used for virtual machine migration techniques. The paper also compared these algorithms in terms of energy consumption.
A new architecture "micro controller based smart home energy management system (SHEMS) architecture" was proposed by [18] whose purpose is to switch off the devices when they are not used. They also suggested that use of renewable resources can improve energy utilization. TAÅTAN, M. [19] presented "Smart Energy Management (SEM) system", based on NodeMCU and Android for decreasing energy use by monitoring the electrical devices time to time and report the suitable time of appliance usage. Singh, P.P. et al. [20] discussed the importance of electrical appliance energy management. The paper also discussed the future scope of smart home architecture along with data security and energy consumption. Artificial intelligence role in IoT was also explained.
An approach "smart home energy management system (HEMS)" was studied in [21] which can monitor the current usage of electrical appliances and their history records as well through meta-heuristics algorithms. The scheme can decrease the energy consumption. Al-Ali, A.R. et al. [22] combined the uses of IoT and Big data analysis. The paper proposed Energy Management System where each home appliance is connected with IoT device that acts like data acquisition module and transfer data to server for processing.
Ali, S.A. et al. [23] presented the review of energy consumption issues and probable solutions that can happen in cloud data centers. The paper analyzed various energy efficient techniques like VM selection, VM placement, VM allocation etc. with their findings. The various issues with dynamic energy management in cloud data centers were well explained in [24]. The paper suggested using some hybrid solution that can combine hardware and resource management concepts to affect the energy consumption.
Arshad, R. et al. [25] discussed the energy requirement by IoT devices, their drawbacks and use of Green-IoT in the area. The paper also discussed the strategies for designing energy efficient data centers, energy efficient transmission of data from sensors and design of energy efficient policies. Kanwal, S. [26] presented "Genetic Algorithm (GA) based leader election (GLEA)" approach to analyze the nodes in cloud data centers and found the approach to be memory efficient with minimum execution time. A hybrid approach "Integration of VMs Auto-Scaling with Live Migration" was proposed in [27] to combine auto-scaling and live-migration to calculate the total cost of dynamic VMs. This approach is also able to predict the VM workload for better performance.
As discovered from literature review, the cloud environment can process the raw data to derive useful conclusions for problem at hand and it is imperative to reduce the enormous heat exhibited from the devices. Among the various techniques used to reduce the energy consumption and thus, the cost of using cloud environment, bin packing techniques are majorly used. So next section explicates the proposed bin-packing approaches.

Proposed Algorithms
Envisioned with the aim to offer better solutions that can mitigate energy consumption, dynamic approaches are proposed and has been discussed in this section. The proposed approaches have following characteristics: Inputs to all the approaches are CPU capacity and power requirement of each server, CPU capacity and execution time frame for each virtual machine.
The terminologies used in algorithms are shown in Table 1.  The mathematical illustration of the used equations is as follows: • Computation of Utilization Factor [17]: The utilization factor refers to the utilization of servers and it is calculated by dividing the CPU capacity used by all VMs running on server and total CPU capacity of server. The formula of utilization factor for server i is computed as a function of placement 'F' and time 't' as shown in below: CPU_util i is the total CPU capacity used by all VMs on i th server and CPU i is the CPU capacity of the server.

•
Computation of Power Consumption [17]: It refers to the energy consumed by N servers in data centers and is calculated for one server at a time and gets summed up for computing total power consumption of a data centre and is computed after VM allotment 'F' at a specific time 't' as shown below: where, Power consumption of a server is calculated by using maximum power requirement of server and utilization factor of the server.

•
Computation of Resource Utilization [28]: It refers to total time the servers have been utilized efficiently in the data centre and is computed as shown below: where, M is the number of VMs executing on ith server • Computation of Makespan [28]: It refers to time frame between submission of 1st job entering the system till completion of last job and is computed by taking maximum time by any VM in each run R and makespan on server i is calculated as shown below: The mathematical equations have been used by following proposed approaches for calculation of energy consumption: Dynamic Low Perturbation Bin Packing (DLPBP)-In inception, the input is taken for N servers and M virtual machines and hypervisor creates virtual machines. Then, the approach of DLPBP gets initialized and makes allotment of M VMs onto N servers. Subsequently, after every T seconds, new job arrives into the system and energy is calculated for current requests being processed into the system. Once, the execution of all incoming requests is completed, resource utilization and makespan are calculated for computing the overall data center's performance. The approach does not consider any order for virtual machines and servers as a pre-step. The Algorithm 1 depiction for the proposed approach is as follows: Input CPU capacity and Power requirement for N Servers.

2.
Repeat steps 3 to 5 until no VM is left for execution.

3.
Input CPU capacity and execution time frame for M Virtual Machines.

4.
Assign VM to server on basis of CPU value of VM and server and create a Map <CPU of server, <CPU value of VM,Time value of VM .

5.
Compute energy/power utilized by data center for each run, overall resource utilization and makespan as ∑ N i=1 (P i (F, t), Resutil i , Makespan i ).

Dynamic Best Fit Decreasing (DBFD)-
The input is taken for N servers and M virtual machines. Servers are rearranged in ascending order of CPU capacity and virtual machines are rearranged in descending order of CPU capacity as a pre-step before allotment of M VMs onto N servers. For calculation of energy consumption of each server, it checks for incoming requests in each run after every T seconds. After completion of all runs, when no VM request is pending, resource utilization and makespan are calculated to know about overall data centers performance. The Algorithm 2 approach is presented below: Input CPU capacity and Power requirement for N Servers.

2.
Servers are arranged in ascending order of CPU capacity.

3.
Virtual machines are arranged in descending order of CPU capacity.

4.
Repeat steps 5 to 7 until no VM is left for execution.

5.
Input CPU capacity and execution time frame for M Virtual Machines. 6.
Assign VM to server on basis of CPU value of VM and server and create a Map <CPU of server, <CPU value of VM, Time value of VM . 7.
Compute energy/power utilized by data center for each run, overall resource utilization and makespan as ∑ N i=1 (P i (F, t), Res_util i , Makespan i ).

Dynamic Power and Computing Capacity Aware Best Fit Decreasing (DPCA-BFD)-
In comparison to the earlier depicted approaches, this heuristic considers the power re-quirement of machines as well. In inception, the input is taken for N servers and M virtual machines. Servers are arranged in ascending order of ratio of CPU capacity/power requirement and virtual machines are arranged in descending order of CPU capacity and makes allotment of M VMs onto N servers and calculation of makespan, energy and resource utilization is done. The Algorithm 3 is as follows: Input CPU capacity and Power requirement for N Servers.

2.
Servers are arranged in ascending order of ratio of CPU capacity/power requirement.

3.
Virtual machines are arranged in descending order of CPU capacity.

4.
Repeat steps 5 to 7 until no VM is left for execution.

5.
Input CPU capacity and execution time frame for M Virtual Machines. 6.
Assign VM to server on basis of CPU value of VM and server and create a Map <CPU of server, <CPU value of VM, Time value of VM . 7.
Compute energy/power utilized by data center for each run, overall resource utilization and makespan as ∑ N i=1 (P i (F, t), Res_util i , Makespan i ).

Dynamic Energy-Utilized Best Fit Decreasing (DEU-BFD)-
The input is taken for N servers and M virtual machines. Servers are arranged in ascending order of power requirement and virtual machines are arranged in ascending order of CPU capacity and makes allotment of M VMs onto N servers. Subsequently, makespan, energy and resource utilization are computed. The Algorithm 4 is as follows: Input CPU capacity and Power requirement for N Servers.

2.
Servers are arranged in ascending order of power requirement.

3.
Virtual machines are arranged in ascending order of CPU capacity.

4.
Repeat steps 5 to 7 until no VM is left for execution.

5.
Input CPU capacity and execution time frame for M Virtual Machines. 6.
Assign VM to server on basis of CPU value of VM and server and create a Map < CPU of server, <CPU value of VM, Time value of VM . 7.
Compute energy/power utilized by data center for each run, overall resource utilization and makespan as ∑ N i=1 (P i (F, t), Res_util i , Makespan i ).
The proposed approaches compute energy at the cloud level for the incoming requests that are generated by various clients via service providers. The basis of data collection for processing are the various devices that are deployed at user's end where massive and raw data is being generated and redirected to the cloud environment. The complete flow of this data redirection specifically for a smart home is shown in Figure 3, wherein the data originating from the sensor devices reaches to the cloud through gateway and is returned in the form of processed information by cloud data centres.
The sensors collect the raw data in symmetric and systematic form and forward it to the gateway on the edge of the smart home architecture. The gateway transfers this data to cloud data centers for further analysis. The server in cloud data center analyzes the pattern of data and proposed dynamic approaches compute energy consumption, resource utilization and makespan to know about the overall performance of data centres. The decisions made based on symmetric patterns of raw data is transferred back to the gateway which is further sent to smart home appliances for providing response to the user.

Results and Discussion
The static bin-packing algorithms are converted into dynamic to handle intermittent job request by the customers. The algorithms calculate the energy consumption, resource utilization and makespan for completing all the job requests on cloud data centers. The total cost of processing the data on cloud affects proportionally the total cost of using smart home architecture.
To calculate the results of algorithm, simulation is done on JAVA programming language. The initial values for simulation include minimum memory requirement of virtual machine as 4 MB. The configuration values of virtual machines and servers are: maximum computing capacity of a server is 5000, maximum computing capacity of a virtual machine is 1500 and maximum power capacity of a server is 450 joules. This configuration is constant for all proposed approaches. For the validity of algorithms, simulation runs for three different scenarios, have been carried out. The three different scenarios are: (1) l0 servers and 10 virtual machines, (2) 15 servers and 24 virtual machines and (3) 20 servers and 54 vir-tual machines. For all the scenarios, CPU capacity and power capacity of servers are taken from user. CPU capacity requirement and time duration needed for execution of virtual machines are taken from user. After rearranging servers and virtual machines according to algorithms, energy consumption, resource utilization and makespan are calculated.
The energy computation values for all scenarios in all algorithms is shown in Table 2 and percentage reduction is shown in Figure 4. Besides, energy computation, other factors like resource utilization and makespan affects the performance of a data centre and thus, are imperative to be considered. The resource utilization factor [28] is how the resources are well utilized for processing of data on cloud data centers. The higher the resource utilization factor, higher is the efficiency of resources. All the proposed bin-packing algorithms are evaluated in terms of resource utilization factor and results are presented in Table 3 and percentage increment is shown in Figure 5.The makespan is other parameter which acknowledges the utilization of servers by calculating the total working time of a server i.e., the time from first virtual machine allotment till the last virtual machine completion. Table 4 depicts the calculated makespan for all bin-packing algorithms for performed simulations and Figure 6 shows the percentage reduction.    In energy consumption analysis graph, reduction in energy is presented in a form of percentage. Out of three scenarios, DEU-BFD generates highest percentage reduction in 2 scenarios and DPCA-BFD in 1 scenario. In resource utilization analysis graph, increment in the utilization of server is presented in form of percentage. In all scenarios, DEU-BFD is utilizing the server better than other algorithms. In makespan analysis graph, reduction in makespan of server is presented in form of percentage. In all scenarios, DPCA-BFD is giving highest reduction in active time period of server. So the overall performance of DEU-BFD and DPCA-BFD is more effective than DLPBP and DBFD in respect to three parameters-energy consumption, resource utilization and makespan.
The existing algorithms for bin packing techniques are static [17] and does not fit in current heterogeneous and dynamic environment where job request can arrive at cloud data centers at any time. This has arisen a need to propose solutions that can cater to ever-lasting need of clients of service extraction in different time-zones without considering any geographical disparities. Thus, the present study has proposed dynamic mechanisms that offers following advantages over the static approaches: • The proposed dynamic approaches has associated a heterogeneous execution time frame with each virtual machine corresponding to each incoming request so that the virtual machine can exit the system once the job is completed which can make the server room available for another incoming request, thus, can lead to better utilization of the available server computing resources in real-time. The absence of such mechanism in static approaches has otherwise forced the system to turn on new server machines in case new jobs have popped in once all jobs have been executed.

•
The system permits entry of new job requests after a fixed interval of time. Each time a user issues a new request, a new virtual machine is created on demand and can be allocated to the available server machine as the dynamic proposed heuristic provisions flexibility of handling requests at different time-zones, thus reduces the problem of starvation upto some extent.
The summary of new features added in dynamic algorithms is presented in Table 5. Table 5. Comparison between static and proposed dynamic algorithms.

Existing Static Algorithms Proposed Dynamic Algorithms
Hypervisor has to dissolve the virtual machine on completion. Algorithm itself dissolve the virtual machine by regularly checking the execution time period. Hypervisor has to take care of new job requests entry and calling of algorithm for the execution of the same.
Algorithm itself asks for new job request after a specified time period.

Conclusions
Smart home architecture is the future of architecture design. The collaboration of smart home appliances with cloud computing can make data storage and analysis, an effortless and symmetric task. The raw data generated by smart home appliances need to be analyzed rapidly to get prompt response by them. If the task of storage and processing of data is shifted on cloud, then, the total cost of using smart home architecture can be minimized. As this increasing data requires huge resource management, so, it poses a threat of increased energy consumption. Therefore, envisioned with the aim to mitigate the effects of this ever-increasing energy needs of data centre, this paper proposes dynamic bin packing solutions for reducing energy consumption in a data centre capable of accepting massive data from smart architectures. The already existing and standard static bin packing are modified to get more scope of improvement. The main difference between existing and proposed algorithm is that the existing algorithms were static and were not according to current heterogeneous environment. All proposed heuristics are significant in reducing energy consumption considering the present heterogeneous service demands posed by various clients but in maximum runs, DEU-BFD is consuming less energy and is better utilizing the available resources and DPCA-BFD is generating better results in comparison to others in terms of makespan. Thus, the proposed approaches are scalable and suitable for smart building architecture. In future scope, an energy efficient switcher can be developed that can switch between algorithms to give best results in form of energy consumption. The switcher can choose the dynamic algorithm which allot the VM with minimum energy and finally implement the chosen one.

Conflicts of Interest:
Authors do not have any conflict of interest.