Efficient Resource Allocation in Fog Computing Using QTCS Model

: Infrastructure of fog is a complex system due to the large number of heterogeneous resources that need to be shared. The embedded devices deployed with the Internet of Things (IoT) technology have increased since the past few years, and these devices generate huge amount of data. The devices in IoT can be remotely connected and might be placed in different locations which add to the network delay. Real time applications require high bandwidth with reduced latency to ensure Quality of Service (QoS). To achieve this, fog computing plays a vital role in processing the request locally with the nearest available resources by reduced latency. One of the major issues to focus on in a fog service is managing and allocating resources. Queuing theory is one of the most popular mechanisms for task allocation. In this work, an efficient model is designed to improve QoS with the efficacy of resource allocation based on a Queuing Theory based Cuckoo Search (QTCS) model which will optimize the overall resource management process.


Introduction
The fog computing is a modern yardstick for the vibrant provision of the amenities of calculating recent data cores which naturally exercises the technology of virtual machine (VM) amalgamation and environment severance [1]. This type of computing is used because cloud computing is not feasible for many Internet of Things (IoT) applications [2]. The distributed approach of fog computing addresses IoT and industrial IoT (IIoT) needs, as well as the enormous amount of data produced by smart sensors and the IoT devices, which otherwise would be expensive and time-consuming for processing and analyzing in the cloud [3,4]. Fog computing decreases the amount of data sent to the cloud, thereby reducing the use of the bandwidth and its associated costs. Recently, allocating the resources in the virtualized data cores have reached substantial consideration, which hold notable influence on the expertise of energy in the data core [5]. Fog computing has altered the manner in which people utilize the IT resources at present. Now, as a replacement of acquiring their precise IT resources, they utilize the facilities proffered by a sensible price reliant on a "pay-per-use" model [6]. Fog computing extends pay per employ services of IaaS, PaaS and SaaS through diverse full-service provider (FSP) [7].
The basic difference between the fog computing and classical approach is that fog uses every service on the web whereas classical approach uses fixed infrastructure. In the classical approach, organizations first invest certain amount on hardware and software for providing services based on their customer requirements [8]. However, it is a challenging task to predict the customers' service or dynamic workload in a short period of time. The organizations may discourage potential clients because of the low QoS [9]. Various challenges like scaling, security, competent load balancing, data-center energy consumption, service availability, data lock-in, resource scheduling, and QoS management are encountered during fog computing deployment. Efficient fog resource management can offer various benefits namely, energy efficiency, network load reduction, profit maximization, load balancing, and minimization of Service Level Agreement (SLA) violations. The scheduling approaches reduce SLA violation risks and optimize revenues in resource allocation [10]. It can lead to Green Fog Computing by providing workload consolidation and reduction in carbon emissions [11,12]. Adaptive agent-based SLA monitoring model assures the customers of maximum optimized QoS requirements [13].
Fog computing has a greater role in controlling the flow of data from large and complex networks. To boost the overall efficiency and minimize energy consumption, dynamic and efficient load balancing mechanisms can be implemented. Using load balance technology, loads can be transferred or exchanged between computer nodes. The key emphasis has therefore been the design of energy-efficient load balancing solutions for edge and fog environments [14][15][16]. Resources are collections of physical or virtual components within a computer structure of limited availability. Any connected device, and any internal system components are regarded as a resource. Resource allocation in fog computing varies from the traditional to distributed computing environment due to the presence of various QoS metrics such as CPU memory, speed, and stability. In dealing with resource allocation, multiple requests will be in the queue, waiting to be served at various stages. To solve this type of situation, queuing methods are therefore required. A mathematical formulation to demonstrate how a system's throughput and time delay will differ between a single server system and a multiple server system in a fog computing environment using queuing system technique is the need of the hour [17]. Also, an optimal resource allocation is required in highly congested queueing systems.

Motivation
Major challenge in the cloud computing are the network delay and the resource allocation. Fog computing solves these challenges by deploying the load balancing mechanism concentrated on edge nodes. This has motivated us to implement a novel method using entropy based queuing theory optimization approach for addressing specific QoS metrics such as resource availability, allocation time, and energy consumption.

Contributions
The resources are allocated to the applications that run on the virtual environment. The order and time play major role in the efficient allocation of resources. The contributions of this work are as follows: • The proposed queuing theory model helps in managing the resources based on priority or requirement of the fog computing services.
• The proposed model improvises QoS metrics of fog computing such as resources classification, allocation, and energy consumption. • The suggested model provides the distribution of resources in a uniform manner for the users in the environment.
Our primary motivation is to efficiently manage resource allocation operations in fog environment. Hence, we propose a QTCS model in fog computing which efficiently manages resource allocation with respect to the task schedule. This would improve the QoS metrics such as efficiency of the fog services and also reduce the overall cost.

Organization of the Paper
The rest of the paper is organized as follows: Section 2 presents a survey on existing works. Section 3 discusses the proposed work and addresses open issues in resource allocation based on QTCS model. Section 4 includes experimental results and discussions. Section 5 describes the significance of our proposed model. The paper concludes in Section 6 with future directions.

Literature Survey
In this section, the summary of existing works on QoS and resource allocation in fog computing are discussed. Assigning the virtual resources to physical resources in a cloud environment is a major challenge as the QoS needs to be effectively managed. Akintoye, Samson Busuyi et. al. [18] analyzed the task assignment and virtual machine deployment issues for a fog computing scenario. The authors proposed an improvised task assigning method and a genetic algorithm for efficiently implementing the virtual machines. The QoS metric considered in this work is the assignment cost which has been improved significantly by implementing the proposed method [19].
The fog computing technology through its infrastructure-as-a-service has improvised QoS for resource management. Li et al. [20] implemented a fog queuing system with a constrained infrastructure for deploying real time applications with variations in the categories of the task and run time. In order to achieve this, a parallel virtual queue method is deployed to store every category of task in specific queue. The resource allocation is balanced and the task completion ratio is improvised by implementing the parallel algorithms such as offloading and buffering.
The emergence of IoT in all spheres of life has increased the data being generated at a fast rate. The processing delay and scalability issues restrict this data to be computed in the cloud. The scheduling mechanisms in fog computing service take care of resource allocation. Battula et al. [21] implemented a novel technique for efficient resource utilization in fog computing namely Support and Confidence (SC) technique. The proposed technique was deployed with real time traffic and it is inferred that resource consumption is lesser than the traditional methods. Majority of the cloud services are deployed over the Internet and are thus prone to network delay. Swain et al. [22] implemented a fog computing architecture to execute real time IoT tasks at the edge nodes. The devices in the IoT network can increase their battery life by distributing the tasks to nearby fog nodes. The architecture also implements a novel method called METO, which is an effective strategy for distributing the tasks in the IoT fog network. This lessens the battery consumed and task failure rate. Fog computing nodes use edge network deployment for efficient communication, especially in an IoT scenario. Huang et al. [23] discussed the energyefficient resource allocation issue in the fog computing networks with respect to the fog nodes and implemented an efficient method for load balancing keeping in mind the network resource limitations. Fog computing technology is used for deployment of real time applications in IoT.
Suri et al. [24] introduced the resource provisioning scheme by considering acceptable intensity levels. The existing problems are rectified through Virtual Machine-Physical Mapping. The authors achieved up to 32% of power consumption under the host of 1000 VMs that automatically turn off the unnecessary servers in the fog environment. This proposed approach compact the VMs into a single entity by correlating resource requirements and the results achieved are better when compared to the existing applications. An approach for extending the capacity of fog resource provisioning to local clusters by considering scheduling, resource brokering, and dispatching the sequences in the fog is proposed in this work [25].
Task scheduling expresses a central role in fog computing environments. Subsequently cost of every single task in the fog resources is diverse amongst themselves. Scheduling of client tasks in the fog is not similar considering conventional scheduling methods. Tasks scheduling is not done under single criteria but under several rules and regulations, which are in the contract between users and FSPs. And also providing good QoS to the users in conferring to the agreement is a decisive task [26].
Resource allocation comprises of three functions: resource mapping [27], resources execution, and resources monitoring [28,29]. Scheduling mechanism is extremely necessary to enrich the server and usage of resources to boost the functioning of servers [30][31][32]. When the fog resources are requested by numerous tasks, a proficient task scheduling procedure is specifically significant [33]. Workflow scheduling in fog computing assigns every task to a pertinent fog service by gathering the implementation of several resources to attain suitable QoS [34]. The successive phases of a cuckoo basically form a random walk procedure which pursues a control law step length allotment with a hefty tail [35]. In the recent trend, Green Fog (GC) computing approach is used to improve the resources utilization. It reduces energy consumption and thereby improves power efficiency [36]. The summary of some of the significant works are listed in Tab. 1.  [11] Task allocation using genetic algorithm QoS-Allocation cost Network delay in cloud services [14] Support and Confidence method for resource monitoring Resource consumption Energy consumption in case of IoT devices, deployment of VM [15] Matching theory based efficient task offloading strategy Total system energy and number of outages Priority task execution, task allocation [21] Clustering the jobs based on burst time

Reduced fragmentation and starvation
Processing delay and latency in cloud [26] Cost-aware workflow scheduling approaches Performance and system functionality Processing delay in cloud

Proposed Resource Allocation Model-QTCS
Tasks are collected as a task pool in the proposed framework. Those will be graded, and compute resources have been disseminated in fog computing (FC). The available resources are allotted based on the relative weights of the tasks. The QTCS is employed in the allocation of resources in FC. The queuing theory is used to prioritize the task and helps fog admins to allocate the resources available optimally using QTCS. The cuckoo search is used to optimize the resource selection. As illustrated in Fig. 1, the proposed model comprises of four phases such as assessment of task measure values, entropy computation, priority wise entropy assortment, and entropy based QTCS optimization. These phases are discussed in detailed in the following sub-sections.

Assessment of Task Measure Values
Task programming and resource allocation optimization are vital, exigent and core components in fog application services and systems. The proficiency of the allocation openly effects the functioning of the entire FC services. To evade this situation, it is better to compute the task loss, delay, utilization, and reliability which are considered as the task measure values before applying the QTCS optimization.

Task Loss-Let us consider values R and T, where
The above Eqs. (1) and (2) are two finite sets. Grounded on the industrial genesis of the issue, 'R' is known as resource and 'T' denotes as task.
Let X denote the set of every sequential assignment of tasks to the resources, likewise every task is carried out by every resource precisely once; where the elements x∈ X are written as NxM matrix which follows First in First Out (FIFO), in which column 'i' (where i= 1,2,3,. . .,n) lists the tasks order of that resource R. Here, resource R1 will perform three tasks T1, T2, T3 in the sequence T2, T3, T1 whereas the resource R2 will perform in the sequence T1, T2, T3 (Eq. (3)).
Let us assume there is some cost function(C) involved in resource allocation process which is depicted in Eq. (4), The Eq. (4) relates cost function to the total processing time where the value lies between 0 to ∞. The cost function matrix correlates to NxM which is given in Eq. (5), The task-loss is to accomplish an assignment of job 'x' where x ∈ X , to the resources R which means the cost function of 'x' i.e., C(x) is minimum.
Let the total task available before scheduling be T (n) and the total tasks that are scheduled be T (m) , then the task loss TL is computed in Eq. (6).

Task Loss
Delay-The task delay is proportionate to the task length. L(t) is extra time taken to finish the task and P(t) is the time taken to transfer the task within the allocated period. Then the formula is given in Eq. (7), where, the transfer time is calculated by using the formula in Eq. (8) and bandwidth (BW) is calculated in Eq. (9), where, N signifies the number of requests and total BW represents available bandwidths.
Utilization-Let m(t) denote the task completion time, VM's denotes current virtual machine, TL signifies the task loss and 'T' denotes the task. Then the formula for utilization is given in Eq. (10), Reliability-The reliability of the task is computed by means of reliability coefficient that is used to calculate the correlation of two group values. Assume N as the number of existing tasks, S(v) as the individual variance's sum and V(t) as the total variance, then the expression for the reliability coefficient is expressed as (Eq. (11)), Let 't' be the time period interval then the reliability is calculated using the following formula in Eq. (12) and failure time F(t) is given in Eq. (13),

Entropy Computation
Entropy is a degree of the anticipated information matter or uncertainty of a probability distribution [37]. Moreover, it is defined as the grade of chaos in a system or the ambiguity regarding a partition. Let T i stands for a task that is a set of inputs and let p k be the probability of task T i . Let there are n tasks such as T 1 , . . ., T n with probabilities p 1 ,. . .p n adding up to 1. As the incidence of tasks with lesser probability generates more information as they are less predicted, a computation of information 'E' which represents the entropy is a declining function of p k . This decreases from infinity to 0, for p k ranges from 0-1. This function indicates the ability of task selection is lower. From these n task values, the anticipated information content 'E' termed as entropy is given in Eq. (14) and is obtained by weighting the task values existing by means of their relevant probabilities. (14) Let TL denotes the task loss, D(t) denotes the delay time, U refers the utilization time, R specifies the reliability moreover T ij gives the trust value which are already calculated in the above equations. Here, p i log 2 pi ≥ 0 describes p i lies between 0 ≤ p i ≤ 1, if e ≥ 0, where e = 0 if one of p i = 1 and remaining p i = 0.

Priority Wise Entropy Assortment
A priority queue is a deviation on the queue without FIFO, as it is not precisely evocative of the behavior of the data structure. The queuing theory follows many standard queuing structures; one among them is FIFO. Assume entropy as {E1, E2, and E3, . . ., En} for the tasks {T1, T2, and T3, . . ., Tn}. The tasks are arranged on the basis of queuing techniques and the maximum entropy value. As a result, with the queuing theory the tasks are arranged based upon the time arrival which classifies the equivalent entropy values based on the task with maximum of the entropy too. As depicted in Algorithms 1 and 2 the entropy values are prearranged, subject to the priority of queuing theory with the maximum values attained.

Entropy Based QTCS Optimization
The assorted entropy values based on the queuing theory is taken as input to the cuckoo search (CS) algorithm. Therefore, the intended queuing theory-based optimization technique tasks are allotted based on the precedence of entropy values. After this allocation, it checks if the information concerning the resources accessibility is present or not. The CS optimization algorithm updates the entropy values reliant on which the resources are scheduled in a proficient manner.

Fitness Calculation
The fitness is calculated by means of the fitness function (Fi) in Eq. (17) to attain an optimum solution. Choose an arbitrary nest 'j'. While calculating the fitness function, if the current nest fitness value (F i ) is lesser than the fitness value of arbitrarily picked nest (F j ) (that means Fi < Fj) then the arbitrarily picked nest (j) is supplanted by the new solution. On the off chance that the value of the fitness function of the cuckoo egg is not exactly or equivalent to the fitness function value of the arbitrarily picked nest (that means Fi < Fj) then the arbitrarily picked nest (j) is supplanted by the new solution. Here, to achieve the optimal result fitness functions is calculated as, where, Cbest represents current best solution and Pbest represents previous best solution for selecting the number of resources. When the information is extant then the system assesses the sort of workload of tasks, whether it is CPU or memory intensive with their necessities. Algorithm 3 helps to find the optimum resources using cuckoo search and with the obtained optimum resources, the quality score will be calculated. Here, the considered QoS parameters are resource availability, resource allocation time, and energy. The quality score (QS) is calculated among matched resources as in Eq. (18),

Queuing Theory Based Cuckoo Search (QTCS) Working
where, i = 1, 2, . . ., n, QS denotes the Quality Score, QS(i) is quality score for i th resource. The highest quality score can be obtained using the Eq. (19).
Maximum_QS is the highest score that shows the best quality among various resources. The highest QS value is selected in term of high resource availability, less response time, and energy for resource allocation.

Experimental Results and Discussion
CloudAnalyst simulator, which is developed on top of the CloudSim simulator, is used for simulating the proposed model. A data center with 50 heterogeneous physical nodes having CPU with performance more than 2000 million instructions per second, 8-GB RAM, and 1 TB of storage is created. When the user submits a request, it is processed and the capacity of the resource is simulated under the data center. This can be used as a model for creating the utilization of CPU according to the requirement randomly. Each experiment is simulated more than 10 times and the results are analyzed. The XEN server is the virtual server used to simulate the processing. In the simulation, 1000 requests/hour are taken as arrival rate of the requests in peak hours and 50 requests/hour are taken as arrival rate of the requests in non-peak hours with execution times of 60 min duration. At a regular interval of time, the simulator generates a set of requests and manages the traffic.
Since the numbers of users' requests are more at the same time, choosing the resources is also more in terms of QS. The number of matching (selected) resources is not constant for all the iterations. It depends on the availability of the resources and QS. The QS of the resource can be calculated by investigating the time taken to allocate the resource, energy consumption, resource availability etc. Using this QS, the appropriate resource can be chosen, which can provide better performance in the fog environment.
From the obtained results, it is clear that when request from user increases, the time taken for resource allocation also increases. The time taken to allocate the resources depends on the resource availability, distance between the resources and the client (request place).  Energy consumption is directly proportional to the increasing number of requests. To allocate the resources, fog entity needs some amount of energy. A resource needs certain amount of energy for each state like active, service, and live etc. When a resource is investigated, it should be active and involved in the job. Fig. 4 clearly depicts that while the number of resource requests increases, simultaneously the time taken for resource allocation also increases.  It is also simulated for large sized problems such as 50, 100, 200, 500, and 1000 requests and the performance is evaluated. The energy savings are in a range from 96% to 99% when the user requests are among 50-1000. When the numbder of requests increase, the number of resources that are matched for the requests also increases. The resources availability can be verified dynamically while evaluating the fog user request by comparing the request-based resources by the multiple fog services. Since multiple services are working simultaneously, the time complexity does not affecting the fog computing-based resource allocation. Here, Fig. 5., describes the number of requests arrived and allocated by matched resources in the fog environment.
From the experimental simulation results, the proposed QTCS model improves the response time and energy consumption by 20.39% and 12.55% respectively when compared to the existing energy based K-means hybrid method resource allocation (EBKHRA) model [11]. The simulation results illustrate that the proposed approach is efficient and has a good potential for the large data center in the fog.
Here, Tab. 2. and Fig. 6., describe the comparison of energy consumption of existing EBKHRA model and proposed QTCS model.

Significance of the Proposed Work
The proposed QTCS is compared with the EBKHRA model to evaluate the performance of the proposed work.
• The proposed QTCS model helps in assigning the resources efficiently using priority-based resource allocation. • The priority-based QTCS helps to reduce the energy consumption.
• The proposed QTCS model reduces the overall time for the resource allocation process.

Conclusion and Future Direction
The proposed QTCS model was implemented in real time fog environment for allocating the resources quickly and dynamically. After a thorough survey, we infered that the QoS parameters needs to be improved during resource allocation. In our proposed model simulation results, the evaluation of QoS metrics such as resource allocation, response time, and the energy consumption were performed. By using the derived results, it is evident that the average response time has increased by 20.39% and average of energy consumption got reduced by 12.55%, when compared with existing approaches. Based on the experimentation results, it is infered that the proposed method is efficient for resource allocations dynamically even when the numbers of user requests are high. The QTCS approach also improves QoS parameters in terms of response time and energy consumption. Deploying a large application in a fog environment and managing the resource allocation with respect to the edge nodes still has major challenges. This work can be enhanced further by incorporating Markovin model into a fog node in order to produce an optimal solution during resource allocation.
Funding Statement: The authors revived no funding for this work.

Conflicts of Interest:
The authors declare that they have no conflicts of interest to report regarding the present study.