An Optimal Task Assignment Strategy in Cloud-Fog Computing Environment

: With the advent of the Internet of Things era, more and more emerging applications need to provide real-time interactive services. Although cloud computing has many advantages, the massive expansion of the Internet of Things devices and the explosive growth of data may induce network congestion and add network latency. Cloud-fog computing processes some data locally on edge devices to reduce the network delay. This paper investigates the optimal task assignment strategy by considering the execution time and operating costs in a cloud-fog computing environment. Linear transformation techniques are used to solve the nonlinear mathematical programming model of the task assignment problem in cloud-fog computing systems. The proposed method can determine the globally optimal solution for the task assignment problem based on the requirements of the tasks, the processing speed of nodes, and the resource usage cost of nodes in cloud-fog computing systems.


Introduction
In the era of the Internet of Things (IoT), many emerging applications need to provide real-time responses and interactions. According to the report by market insights firm IoT Analytics, global IoT device connections are estimated to surpass non-IoT device connections and reach 11.7 billion in 2020 [1]. The International Data Corporation (IDC) predicts that 75% of 55.7 billion devices worldwide will be connected to an IoT platform by 2025. IDC also estimates that the data generated from the IoT devices will grow from 18.3 ZB in 2019 to 73.1 ZB by 2025 [2].
In various industries, such as transportation, oil and gas, manufacturing, mining, and utilities, a short response time plays a vital role in improving the output, boosting service levels, and increasing the safety. The data sensed from the IoT devices often requires a rapid and real-time analysis of the data. Consequently, an appropriate infrastructure must be designed to deal with the rapid growth of the IoT data for making a timely and correct decision during event detection [3]. Cisco [3] listed the main requirements for the processing of the IoT data; a well-designed task assignment strategy can satisfy the following requirements: • latency decrement • network bandwidth conservation • data movement to the best place for processing Although cloud computing has many advantages, the massive expansion of the IoT devices and the explosive growth of data may induce network congestion and add network latency. Conventional cloud computing architectures that transmit all data from the network edge to the central data center for processing cannot meet all of the above requirements. Transmitting the huge amount of data from the IoT devices to the cloud imposes a significantly heavy burden on network performance. This situation also results in unreliable network latency or uncertain response time for end-users [4,5].
Edge computing has a decentralized architecture that assigns processing tasks to the edge in the network to reduce the network delay. Fog computing transforms network edge devices into parts of a distributed computing architecture to implement IoT applications such as medical and healthcare, building and home automation, traffic control, environmental monitoring, energy management, transportation networks, etc. [3,4]. Compared to pure cloud computing, edge computing and fog computing perform better within the aspects of data transmission speed, privacy and security, limited bandwidths, and data control [6]. Due to the advancements in information technology, conventional network edge devices-for instance, routers, gateways, workstations, and personal computers-have become increasingly powerful in the context of the processing capability, storage space, and communication capability. The resources not only can be utilized by their owners but help to push data handling to the network edge [5].
This paper focuses on the optimal task assignment strategy that minimizes the execution time and operating costs in a cloud-fog computing environment. Nguyen et al. [4] constructed a nonlinear mathematical programming model to treat the task assignment problem in a cloud-fog computing environment for the IoT. The model consists of an objective function that involves a parameter to control the trade-off between task completion time and total cost. They also developed evolutionary algorithms to solve the problem. However, their methods cannot guarantee the global optimality of the obtained solution. This study proposes a method to transform the nonlinear problem into a linear model and then guarantees to find a globally optimal solution of the task assignment problem.
The rest of this paper is organized as follows. Section 2 presents a review of the related research on the optimal task assignment strategy in the cloud-fog computing environment. Section 3 introduces the task assignment problem by considering the execution time and operating costs in the cloud-fog system. The proposed method is described in Section 4. Finally, Section 5 provides the conclusions.

Literature Review
Due to the exponential increase of data generated by network devices, the conventional cloud computing architecture cannot meet the level of low latency and quick response required by IoT applications. Therefore, fog computing has received increasing attention in recent years. Cisco first proposed fog computing that can transform network edge devices into parts of a distributed computing infrastructure for supporting IoT applications [3]. Shi et al. [7] investigated the fundamental characteristics of fog computing for healthcare systems. Yi et al. [8] discussed the definition of fog computing and similar concepts, introduced three representative applications, and identified various issues when designing and implementing fog computing systems. Yousefpour et al. [9] developed a fog-node policy that considered queue lengths and various types of requests with different processing times to minimize service delays for IoT nodes. Lee et al. [10] explored the security threats and privacy issues for implementing the IoT in a fog computing environment. Hong et al. [11] proposed an architecture to deploy IoT applications across various devices, from the edge devices to the cloud. Mahmud et al. [12] proposed a taxonomy of the fog computing environment and discussed possible challenges and features.
Cloud-fog computing allows some cloud services to be executed on the edge of the network. How to select the appropriate nodes for the tasks to be processed is critical to the performance of the cloud-fog computing architecture. Deng et al. [13] investigated a workload allocation problem considering power consumption and delay in a cloud-fog computing system. They approximately decomposed the problem into three subproblems and then solved each subproblem by existing optimization techniques. The simulations and numerical results indicated that fog computing can complement cloud computing in bandwidth conservation and transmission latency reduction. Pham and Huh [14] discussed the task scheduling problem in a cloud-fog environment. They developed a heuristic-based algorithm for task scheduling to achieve the balance between the execution time and the monetary cost of cloud resources. Nikoui et al. [15] proposed a cost-aware geneticbased task scheduling algorithm to enhance the cost efficiency for real-time applications in a fog-cloud environment. Guevara and da Fonseca [16] developed task scheduling algorithms based on integer linear programming techniques for multiclass services in cloud-fog computing systems.
Nguyen et al. [4] investigated the main techniques and the improvement criteria of the developed task assignment algorithms for cloud computing or fog computing. However, in the hybrid cloud-fog computing environment, the cloud nodes and fog nodes are different in processing capability and resource usage costs. Therefore, the tasks may not be equally assigned to all nodes [4]. The tasks should be allocated to different nodes according to the requirements of the tasks, the processing speed of nodes, and the resource usage cost of nodes. Since existing methods are not suitable for the hybrid cloud-fog computing architecture, Nguyen et al. [4] constructed a mathematical programming model to investigate the task assignment problem and developed evolutionary algorithms to solve the problem.

Proposed Method
Although Nguyen et al. [4] developed evolutionary algorithms to solve the task assignment problem, their methods cannot guarantee the global optimality of the obtained solution. This study transforms the nonlinear model of the task assignment problem into a linear model that is solvable by the general linear programming technique to derive a globally optimal solution.
The optimal task assignment problem in the cloud-fog computing environment discussed in this study, referring to Nguyen et al. [4], can be described as follows. Assume T k be the kth task, then n independent tasks in T are required to be completed in the system and expressed as follows: The cloud-fog computing system includes cloud nodes and fog nodes; the nodes of the same type have similar characteristics, such as CPU processing power, CPU usage cost, memory usage cost, and bandwidth usage cost. Typically, the cloud nodes have higher capabilities in computing and storage than the fog nodes, but running the tasks on the cloud nodes must pay higher costs. Assume that m nodes consisting of cloud and fog nodes in a set can be expressed as: where N i is the ith processing node. Each task T k will be assigned to one processing node N i , which is represented as T i k . Each processing node N i (i = 1, 2, 3, . . . , m) can be assigned multiple tasks, expressed as: The task assignment problem considered in this study could be formulated as a node assignment of the tasks in T: The execution time for node N i to complete all assigned tasks in N T i can be expressed as: where L T i k is the number of instructions of task T i k , and CPUrate(N i ) is the CPU clock rate of node N i . E_Time T i k = L(T i k ) CPUrate(N i ) is the execution time of T k assigned in node N i . Assume Timespan is the total time to complete all tasks in T. Timespan can be derived by the following formula: Let Cost(T i k ) be a monetary amount that must be paid for executing task T i k in node N i , consisting of the processing cost C p (T i k ), memory usage cost C m (T i k ), and bandwidth usage cost C b (T i k ). Cost(T i k ) can be expressed as: The above three costs can be defined as: where cost_p i is the usage cost of CPU per time unit in node N i , cost_m i is the usage cost of memory per data unit in node N i , Memory T i k is the memory required by task T k in node N i , cost_b i is the usage cost of bandwidth per data unit, and Bandwidth T i k is the amount of bandwidth required by transmitting task T k to be processed in node N i .
The total cost for all tasks to be completed in a cloud-fog system can be expressed as below: Since the optimal task assignment problem considers the execution time and operating costs, Nguyen et al. [4] used an objective function to compute the trade-off between Timespan and Total_Cost as follows: where α ∈ [0, 1] is the trade-off coefficient between the execution time and operating costs. If α > 0.5, the task assignment strategy concentrates on minimizing the execution time with a higher priority than the total operating costs. If α < 0.5, minimizing the total operating costs is more important than the execution time. The value of α depends on the amount of the budget or the level of the required response time. Nguyen et al. [4] used evolutionary algorithms to find the optimal trade-off task assignment strategy between the execution time and operating costs. Since the heuristic approaches cannot guarantee the quality of the obtained solution, this study derived the optimal assignment strategy based on the globally optimal solution by a deterministic approach. The original mathematical programming model of the task assignment problem in a cloud-fog system can be expressed as follows [4].
Model OTA1: subject to: where α, L(T k ), CPUrate(N i ), E_Time T i k , Memory T i k , Bandwidth T i k , cost_p i , cost_m i , and cost_b i are the same as described before. The decision variables are T i k and T i k ∈ {0, 1}. Constraint (14) means that the task T k must be assigned to only one node for execution.
After linearly expressing the constraint (17) in the above model OTA1, the original model can be transformed as follows.
Model OTA2: subject to: Model OTA2 is a mixed-integer linear model that can be solved by the optimization solver to obtain a globally optimal solution. The obtained solution may be different when the trade-off coefficient α changes.

Numerical Experiments and Results
This study discusses the optimal task assignment problem in a cloud-fog computing environment; several numerical experiments are presented to demonstrate the effectiveness of the proposed method. The experiments were conducted on a Notebook with a 2.6 GHz Intel Core i5-7300 CPU and 24 GB memory. All reformulated models were solved by a mathematical programming solver GUROBI 9.1.1 with default settings.
In a cloud-fog computing environment, each node has its own processing capacity, memory, and bandwidth usage cost. This study randomly generated several problems according to the parameters suggested by Nguyen et al. [4]. Table 1 lists the characteristics of the nodes used to execute the tasks in a cloud-fog computing environment. Table 2 lists the characteristics of the tasks.  [10,100] In our experiments, α = 0.5 is adopted, which means that the time and cost have identical priorities in the objective. Three datasets are used in our experiments. Referring to the research of Nguyen et al. [4], datasets 1 includes three cloud nodes and 10 fog nodes. To explore the impact of different numbers of cloud and fog nodes on the solution speed of the proposed method, dataset 2 includes five cloud nodes and 12 fog nodes, and dataset 3 includes seven cloud nodes and 14 fog nodes. Cloud nodes are more powerful for processing tasks, but the cost of using them is higher. In each dataset, 10-50 tasks are assigned to different nodes according to the globally optimal solution of Model OTA2 solved by GUROBI. For each case, ten instances with identical numbers of cloud nodes, fog nodes, and tasks are randomly generated. The average CPU time is the average running time of GUROBI to solve each instance.
As seen in Tables 3-5, the average CPU time increases as the number of tasks increases under identical numbers of cloud nodes and fog nodes. For small cases, the results can be obtained within several seconds. Comparing the average CPU time for solving the case with the same number of tasks in the three datasets, the difference is more significant as the number of cloud nodes and fog nodes increases. Since the number of cloud nodes, fog nodes, and tasks determines the number of binary variables in Model OTA2, more cloud nodes, fog nodes, or tasks results in more CPU time for solving the task assignment problem. Since Model OTA2 involves an SOS1 constraint, the technique for treating the SOS1 constraint with fewer binary variables can be considered to improve the computational efficiency of the large-scale task assignment problems in a cloud-fog computing environment.