An Online Secretary Framework for Fog Network Formation with Minimal Latency
Fog computing is seen as a promising approach to perform distributed, low-latency computation for supporting Internet of Things applications. However, due to the unpredictable arrival of available neighboring fog nodes, the dynamic formation of a fog network can be challenging. In essence, a given fog node must smartly select the set of neighboring fog nodes that can provide low-latency computations. In this paper, this problem of fog network formation and task distribution is studied considering a hybrid cloud-fog architecture. The goal of the proposed framework is to minimize the maximum computational latency by enabling a given fog node to form a suitable fog network, under uncertainty on the arrival process of neighboring fog nodes. To solve this problem, a novel approach based on the online secretary framework is proposed. To find the desired set of neighboring fog nodes, an online algorithm is developed to enable a task initiating fog node to decide on which other nodes can be used as part of its fog network, to offload computational tasks, without knowing any prior information on the future arrivals of those other nodes. Simulation results show that the proposed online algorithm can successfully select an optimal set of neighboring fog nodes while achieving a latency that is as small as the one resulting from an ideal, offline scheme that has complete knowledge of the system. The results also show how, using the proposed approach, the computational tasks can be properly distributed between the fog network and a remote cloud server.
The Internet of Things (IoT) is expected to connect over 50 billion things worldwide, by 2020 . To handle such massive and diverse data traffic, there is a need for distributed computation which can be effectively handled using the so-called fog computing paradigm . Fog computing allows overcoming the limitations of centralized cloud computation, by enabling distributed, low-latency computation at the network edge, for supporting IoT applications. The advantages of the fog architecture comes from the transfer of the network functions to the network edge. Indeed, significant amounts of data can be stored, controlled, and computed over the fog networks that are configured and managed by end-user nodes . However, to reap the benefits of fog networks many architectural and operational challenges must be addressed [3, 4, 5, 6, 7, 8, 9].
To configure a fog network, the authors in  propose the use of a device-to-device (D2D)-based network that can efficiently support networking between a fog node and sensors. When tasks must be computed in a distributed way, there is a need for resource sharing between fog nodes. For instance, the work in  proposes a task allocation approach that minimizes the overall task completion time by using a multidimensional auction. Moreover, the authors in  study the delay minimization problem in multilayer scenario with both fog and cloud, in which each layer’s node has a different delay. Also, the authors in  investigate the problem of minimizing the aggregate cloud fronthaul and wireless transmission latency. In , a task scheduling algorithm is proposed to jointly optimize the radio and computing resources with the goal of reducing the energy consumption of users while satisfying the delay constraint. The problem of optimizing power consumption is also considered in  subject to the delay constraint using a queueing-theoretic delay model at the cloud. Moreover, the work in  studies the power consumption minimization problem in an online scenario for which future arrivals of tasks is uncertain.
In all of these existing task distribution fog works [4, 5, 6, 7, 8], it is generally assumed that information on the formation of the fog network is completely known. However, in practice, the fog network can be spontaneously initiated by a fog node when other neighboring fog nodes start to dynamically join and leave the network. Hence, the presence of a neighboring fog node can be uncertain. Indeed, it is challenging for a fog node to know when and where another fog node will arrive. Thus, there exists an inherent uncertainty stemming from the unknown locations and availability of fog nodes. Further, most of the existing works [6, 7, 5] typically assume a simple transmission or computational latency model for a fog node. In contrast, the use of a queueing-theoretic model for both transmission and computational latency is necessary to capture the realistic latency. Consequently, unlike the existing literature [4, 5, 6, 7, 8] which assumes full information knowledge for fog network formation and rely on simple delay models, our goal is to design an online approach to enable an on-the-fly information of the fog network, under uncertainty, while minimizing computational latency, given a realistic delay model.
The main contribution of this paper is a novel framework for online fog network formation and task distribution in a hybrid fog-cloud network. This framework allows any given fog node to dynamically construct a fog network by selecting the most suitable set of neighboring fog nodes in the presence of uncertainty on the arrival order of neighboring fog nodes. This fog node can jointly use its fog network as well as a distant cloud server to compute a number of tasks. We formulate an online optimization problem whose objective is to minimize the maximum computational latency of all fog nodes by properly selecting the set of fog nodes to which computations will be offloaded while also properly distributing the tasks among those fog nodes and the cloud. To solve this problem without any prior information on the future arrivals of fog nodes and their performance, we propose a new approach based on the exploration and exploitation structures from the online k-secretary framework . By using the algorithm, a given fog node can observe the unknown environment in the exploration stage. Then, in the exploitation stage, the fog node can determine how to offload its computational tasks between other, local fog nodes and a cloud server. Simulation results show that the proposed online algorithm can minimize the maximum latency by suitably distributing tasks across fog nodes and a cloud server while achieving a performance that is near-optimal compared to an offline solution that has full information on all neighboring fog node arrivals.
Ii System Model
Consider a fog network consisting of a sensor layer, a fog layer, and a cloud layer as shown in Fig. 1. In this system, the sensor layer includes smart and small-sized IoT sensors that do not have enough computational capability. Thus, these sensors offload their task data to the fog and cloud layers for remote distributed computing purposes. We assume that the various kinds of sensors send their task data to a fog node , and the size of this data will be packets per second. Here, fog node assumes the roles of collecting, storing, controlling, and processing the task data from the sensor layer, as is typical in practical fog networking scenarios .
In our architecture, fog node must cooperate with other neighboring fog nodes and the cloud data center. It is assumed that there is a set of fog nodes. For a given fog node , we focus on the fog computing case in which fog node builds a network with a set of neighboring fog nodes. Also, since the cloud is typically located at a remote location, fog node must access the cloud via wireless communication links using a cellular base station .
When fog node receives tasks, each node on a fog-cloud network will locally compute a fraction of that is received from the initial fog node . The fraction of tasks locally computed by fog node will be given by . Then, the number of tasks offloaded from fog node to fog node will be . Therefore, the number of tasks processed at the fog layer will be . The number of remaining tasks that are offloaded to the cloud will be . When fog node makes a decision on the distribution of all input tasks , the task distribution variables can be represented as vector with where . Naturally, the total number of tasks that arrive at fog node is equal to the number of tasks assigned to computation nodes in the fog and cloud layers. Since is the sum of packets from various sensors, it is assumed that follows a Poisson arrival process . When the tasks are distributed according to , , and , , the tasks offloaded to each node , , and will also follow a Poisson process while the task are scheduled in a round robin fashion .
When the tasks arrive from the sensors to fog node , they are first saved in fog node ’s storage. Thus, there is a waiting delay before tasks are transmitted and distributed to another node. The delays related to the transmission from to or can be modeled using a transmission queue. Moreover, when the tasks arrive at the destination, the latency required to perform the actual computations will be captured by a computation queue. In Fig. 1, we show examples of both type of queues. For instance, for transmission queues, fog node has transmission queues for each fog node and the cloud . For computation, each fog node has a computation queue. To model the transmission queue, we assume that tasks are transmitted to fog node over a wireless channel. Then, if a task has a size of bits, the service rate can be defined by
where is the channel gain between fog nodes and with being the distance between them. and are, respectively, the path loss exponent and path loss constant. is the transmission power of fog node , is the bandwidth of the channel, and is the noise power spectral density. Since the tasks arrive according to a Poisson process, and the transmission time in (1) is deterministic, the latency of the transmission queue can be modeled as an M/D/1 system :
where the first term is the waiting time in the queue at fog node , and the second term is the transmission delay between fog nodes and . Similarly, when the tasks are offloaded to the cloud, the transmission queue delay will be:
where the service rate between fog node and cloud is given by (1) where fog node is replaced with cloud .
Next, we define the computation queue. When a fog node needs to compute a task, this task will experience a waiting time in the computation queue of this fog node due to a previous task that is being currently processed. Since a fog node receives tasks from not only fog node but also other fog nodes and sensors, the task arrival process can be reasonably approximated by a Poisson process by applying the Kleinrock approximation . Therefore, the computation queue can be modeled as an M/D/1 and the corresponding latency of the fog node ’s computation can be given by
where the first term is the waiting delay in the computation queue, and the second term is the delay for fetching the proper application that is needed to compute the task. The delay of this fetching procedure depends on the performance of the node’s hardware which is a deterministic constant that determines the service time of the computation queue. In the first and second terms, is a parameter related to the overall hardware performance of fog node . is the actual computation time of the task where is a constant time incurred to compute a task. For example, can be proportional to the CPU clock frequency of fog node . Then, when fog node locally computes its assigned tasks , the latency can will be:
where is the hardware performance of fog node and is fog node ’s computing time. To model the computation time at the cloud, since the cloud has superior hardware performance compared to the fog node’s hardware, the waiting time at the computation queue can be ignored. This implies that the cloud initiates the computation for the received tasks without having queueing delay; thus, we only account for the actual computing delay. Thus, when tasks are computed by the cloud, the computing delay at the cloud can be defined by
In essence, if a task is routed to cloud , the latency will be
Also, if a task is offloaded to fog node , then the latency can be presented by the sum of the transmission and computation queueing delays:
Furthermore, when fog node computes the tasks locally, the latency is given by
since no transmission queue is necessary for local computing.
Iii Problem Formulation
Given the defined system model, our goal is to form a fog network and to effectively distribute tasks. To form a fog network and offload its tasks, a fog node must opportunistically find neighboring fog nodes. In practice, such neighbors will dynamically arrive and leave the system. As a result, the initial fog node will be unable to know a priori whether an adjacent fog node will be available to assist with its computation. Moreover, since the total number of neighboring fog nodes as well as their locations are unknown and highly unpredictable, optimizing the fog network formation and task distribution processes becomes a challenging problem. Under such uncertainty, selecting neighboring fog nodes must also account for potential arrival of new fog nodes that can potentially provide a higher data rate and stronger computational capabilities. To cope with the uncertainty of the neighboring fog node arrivals while considering the data rate and computing capability of current and future fog nodes, we introduce an online optimization scheme that can handle the problem of fog network formation and task distribution under uncertainty.
First, we formulate the following online fog network formation and task distribution problem whose goal is to minimize the maximum latency when computing a task that arrives at fog node :
where is the time cost for creating and managing the transmission queues for the various neighboring fog nodes and the cloud. For example, when fog node manages one queue for the cloud and queues for the fog nodes, will capture the additional time cost at fog node . In essence, in problem (10), the objective function is the sum of the maximum latency among different computation nodes and the time cost that increases with the number of nodes in the fog network. We determine the set of neighboring fog nodes when they arrive online and the task distribution vector so that the computing latency is minimized.
In (10), while the maximum number of neighboring fog nodes can be pre-determined by fog node , we assume that fog nodes arrive in an online and arbitrary manner. This implies that the information about each fog node is collected sequentially. For example, a smartphone can choose to become a fog node spontaneously if it wants to share its resources. Such case shows how the initial fog node that manages the fog network and distributes tasks is unable to know any information on future fog nodes. Therefore, in our problem, the arrival order can be represented by an index . At each arrival event, the arrival order increases by one; thus, index can be seen as the time order of arrival. When fog node arrives, we know the information of only fog node .
In our model, whenever fog node appears in the network, fog node must decide whether to select or not. If fog node is chosen, then it is indexed by and included in the set which is a subset of . Otherwise, fog node will no longer be able to select fog node since the latter can join another fog network or terminate its resource sharing offer to fog node . Under such incomplete information, finding the optimal solution of (10) is challenging and, as such, one has to seek an online, sub-optimal solution that is robust to uncertainty. Next, we develop an online algorithm to solve (10) and optimize the fog network formation and task distribution problems.
Iv Online Secretary Problem for
Fog Network Formation
To solve (10), we need to find the set of neighboring fog nodes and the task distribution vector that minimize the maximum latency. The decision about faces two primary challenges: how many fog nodes are required in the fog network and which fog nodes join the fog network. Finding the optimal in an online scenario can be challenging, so we relax the complexity of the problem by fixing the maximum number of neighboring fog nodes. Fog node can at most support a certain number of neighbors due to various resource limiations, e.g., limited memory or storage size. Then, our online algorithm can make a decision on which fog nodes are chosen in . Also, if set is determined, optimizing the task distribution vector becomes an offline optimization; thus, the problem can be minimized by using an effective optimization method such as the interior-point algorithm.
We can first observe that the first term in the objective function (10) decreases as the number of neighboring fog nodes increases since distributed computing can reduce latency. However, the value of (10) can increase if the wireless latency increases. Also, (10) can increase if the number of fog nodes becomes too large. For instance, the time cost required to manage the fog networking can limit the number of fog computing nodes. Thus, there is a tradeoff between the latency of distributed computation and the time cost of managing multiple queues when using more number of neighboring fog nodes. By considering this tradeoff, we assume that a practical size of distributed computing networks is predetermined and given as parameter in our algorithm.
We can first observe a property when the number of neighboring fog nodes is given.
For a given , if there exists such that , where is a constant, task distribution is the optimal solution of problem (10).
Let call as the initial distribution, and assume that any other task distribution different from is the optimal distribution. When is considered, we can find a certain node denoted by A satisfying where and . This then yields . Due to the constraint (11), there exists another node such that , , and where and . Since , we must decrease to minimize the maximum, i.e., . Hence, we can clearly see that is not optimal, and, thus, initial distribution is optimal. ∎
Since the optimal task distribution results in an equal latency at different nodes, if the maximum number of neighboring fog nodes is determined, the problem can be reduced to choosing the neighboring fog node that can minimize latency .
Due to the fact that in (8) can decrease when and increase, the problem of selecting the best fog nodes can then be written as:
This problem implies that our proposed solution must select the fog nodes whose data rate and computational capability are larger than those of the fog nodes when the information about the neighboring fog nodes are known to fog node in an online way. To find , we propose an online algorithm that builds on the so-called -secretary problem that is introduced in . In this problem, when there are job positions, a company interviews candidates sequentially in a random order. Right after finishing the interview, the company has to make a decision whether to accept the candidate or not, given that the company will not be able to recall a candidate later once this candidate has been rejected. Clearly, there is a direct analogy between our problem and the secretary problem as we seek to find neighboring fog devices which corresponds to filling job positions. Therefore, by modifying this online secretary framework, we propose Algorithm 1 to find and .
Algorithm 1 sequentially optimizes the network formation problem by determining and minimize the latency by determining the task distribution vector when the size of fog networking is given by . The parameter can be determined by trial and error. For example, we can set an upper and lower bounds of and use a bisection method to choose such that the total cost is close to optimal and the latency is minimized. Then, Algorithm 1 learns the uncertain environment of the online setting and determines during exploration and exploitation stages, respectively. Once the fog network is determined, the distribution of the tasks can be found in an offline manner using the interior point method.
In Algorithm 1, we need parameter that indicates the number of observations needed to learn the environment. First, we observe fog nodes that arrive sequentially, using which it is possible to build an observation set that consists of the observed values of . This observation procedure is called the exploration stage, and it provides the thresholds that can be used to make a decision in the subsequent exploitation stage. Therefore, through the exploration stage, we can have information on the uncertain neighboring fog nodes.
After constructing set with samples, we make a decision in an online manner during the exploitation stage. When fog node arrives online, we can know and . Then, we can compare this information about to the largest sample in set . If the arriving fog node’s performance is better than the largest sample , then we immediately include fog node in . When a new fog node joins the network, the task distribution problem for a given is an offline problem, so can be optimized by using a solver. By repeating this procedure and updating , the set of neighboring fog nodes can be determined. Consequently, the proposed algorithm will find a set having high and ; thus, Algorithm 1 ends by allowing fog node to form a latency-minimal fog network and distribute the tasks across fog and cloud layers.
V Simulation Results
For our simulations, we consider an initial fog node that can connect to neighboring fog nodes that are uniformly distributed within a 50 m50 m square area. The arrival sequence of the neighboring fog nodes follows a uniform distribution. Each fog node can use a subcarrier of bandwidth kHz. The power spectral density of the noise is -174 dBm/Hz and dBm. The channel gain is set to and with a channel gain of dB at the reference distance of 1 m. The packet size is set to bytes. The distance between fog node and the base station used to connect to the cloud is . All statistical results are averaged over a large number of simulation runs. We assume equal computation resources for fog nodes such that, i.e., packets per second, , and we set , and . For comparison, we use the offline, optimal algorithm that has complete knowledge of the system.
In Fig. 2, we show the total cost defined in (10) and the latency for different numbers of fog nodes with and or , . The simulation results in Fig. 2 are carried out in an offline setting, and we exploit this observation to determine a possible parameter to run Algorithm 1. For instance, we can first see that the computational latency decreases when the number of neighboring fog nodes increases. At the same time, Fig. 2 shows that the total cost is minimized by four neighboring fog nodes. From these observations, if the cost of a certain number of neighboring fog nodes is similar to the minimum, we may choose a greater number of neighboring fog nodes to minimize latency. In that sense, the range between 4 and 6 neighbor fog devices cloud be a potential value of . Note that the gap between the total cost and latency characterizes the time cost required to manage the fog network which naturally increases with the size of the network. Also, we observe that the total cost and latency decrease if the data rate of a fog node increases. For instance, if increases from to , then the total cost is reduced to for a network with neighboring fog nodes.
Fig. 3 shows the task distribution for different numbers of fog nodes with the same parameters used in Fig. 2 with . From Fig. 3, we can see that, when the number of neighboring fog nodes increases, the number of tasks computed by the fog layer increases, and the number of tasks offloaded to the cloud decreases. For instance, the percentage of tasks computed by the cloud is when there is no neighboring fog node, but it can decrease down to if six fog nodes join the fog computing.
Fig. 4 shows the total cost and latency for different numbers of neighboring fog nodes with when the proposed, online Algorithm 1 is used. For a given , we compare the performance of found by the proposed algorithm to the performance of the optimal set of neighboring fog nodes found in the offline case. We first see that the results of the total cost and latency in online and offline scenarios are very close. For example, it can be observed that the total cost (10) can be minimized with around 6 neighboring fog nodes. In this case, the gap between the online and offline solutions, in terms of total cost, is roughly %. A similar small gap is also seen for the latency. This demonstrates the effectiveness of the proposed algorithm under the online scenario. Also, Figs. 4 shows that, due to the time cost for queue management, the total cost increases when the number of neighboring fog nodes increases from 6 to 7 while the latency is still decreasing.
Fig. 5 shows the empirical competitive ratio for problem (14). The competitive ratio is defined as the ratio of the cost from the algorithm used in an online setting and the optimal cost found in the offline setting where the cost is defined by (14). Thus, a competitive ratio can measure how close the proposed algorithm can achieve the solution compared to the offline solution. We can first see that of iterations achieve a competitive ratio of which means that the result of online algorithm coincides with the offline optimal solution of problem (14). Fig. 5 also shows that in 50% of the iterations, the online algorithm can achieve at least % of the optimal value of (14). Finally, over iterations, the empirical competitive ratio in the worst case is shown to be . Thus, the results from Fig. 5 shows that Algorithm 1 can effectively form a fog network, in an online manner, while minimizing latency and costs.
In Fig. 6, we show the percentage of tasks computed by the cloud for different distances from m to m using Algorithm 1 with . The result shows that the number of tasks computed at the cloud decreases as the distance increases. This is due to the fact that a longer distance decreases , thus yielding an increasing of the computation delay of the cloud. For example, Fig. 6 shows that increasing the distance from 200 m to 600 m can result in fewer tasks that are offloaded to the cloud for . Also, we can see that fewer tasks are offloaded to the cloud when the fog nodes are equipped with better computational capabilities. For example, if or increases from to , then the tasks at the cloud can decrease by up to %.
In this paper, we have proposed a novel framework to optimize the formation of fog networks and distribution of computational tasks in a hybrid fog-cloud system. We have formulated the problem as an online secretary problem which enables the neighboring fog node to join the fog networking effectively in the presence of uncertainty about fog node arrivals. We have shown that by using the online algorithm, the neighboring fog nodes are suitably selected without knowing any prior information on future fog node arrivals. Simulation results have shown that the proposed online algorithm achieves a near-optimal latency while effectively offloading computational tasks across fog and cloud layers.
-  Cisco, “Fog computing and the Internet of Things: Extend the cloud to where the things are,” Cisco white paper, 2015.
-  M. Chiang and T. Zhang, “Fog and IoT: An overview of research opportunities,” IEEE Internet of Things Journal, vol. PP, no. 99, pp. 1–1, June 2016.
-  C. Vallati, A. Virdis, E. Mingozzi, and G. Stea, “Exploiting LTE D2D communications in M2M fog platforms: Deployment and practical issues,” in Proc. IEEE 2nd World Forum on IoT, Milan, Italy, Dec. 2015, pp. 585–590.
-  M. Khaledi, M. Khaledi, and S. K. Kasera, “Profitable task allocation in mobile cloud computing,” in Proc. 12th Int. Symposium on QoS and Security for Wireless and Mobile Networks, Malta, Nov. 2016.
-  V. B. C. Souza, W. RamÃrez, X. Masip-Bruin, E. MarÃn-Tordera, G. Ren, and G. Tashakor, “Handling service allocation in combined fog-cloud scenarios,” in Proc. IEEE Int. Conf. on Commun. (ICC), Kuala Lumpur, Malaysia, May 2016, pp. 1–5.
-  S.-H. Park, O. Simeone, and S. Shamai, “Joint cloud and edge processing for latency minimization in fog radio access networks,” in Proc. IEEE 17th Int. Wksh. on Signal Process. Adv. in Wireless Commun., Edinburgh, UK, July 2016, pp. 1–5.
-  Y. Yu, J. Zhang, and K. B. Letaief, “Joint subcarrier and CPU time allocation for mobile edge computing,” in Proc. of IEEE Global Commun. Conf. (GLOBECOM), Washington DC, USA, Dec. 2016.
-  R. Deng, R. Lu, C. Lai, and T. H. Luan, “Towards power consumption-delay tradeoff by workload allocation in cloud-fog computing,” in Proc. IEEE Int. Conf. on Commun. (ICC), London, UK, June 2015.
-  Y. Mao, J. Zhang, S. Song, and K. B. Letaief, “Power-delay tradeoff in multi-user mobile-edge computing systems,” in Proc. of IEEE Global Commun. Conf. (GLOBECOM), Washington DC, USA, Dec. 2016.
-  R. Kleinberg, “A multiple-choice secretary algorithm with applications to online auctions,” in Proc. the 16th Symposium on Discrete Algorithms (SODA), Vancouver, Canada, Jan. 2005, pp. 630–631.
-  D. P. Bertsekas, R. G. Gallager, and P. Humblet, Data networks. Prentice-Hall International New Jersey, 1992, vol. 2.