Performance Analysis of Task Offloading With Opportunistic Fog Nodes

In the fog computing architecture, the offloading of computing tasks can be conducted by the Internet of Things (IoT) devices to the fog nodes (FNs) that are co-located with base stations (BSs). However, as the IoT devices within the same coverage of the BS can offload lots of tasks simultaneously, the FN can be overloaded, resulting in scalability issues due to limited computing resources. As a promising solution to this problem, opportunistic FNs (OFNs) which denote FNs with mobility such as smart phones and vehicles have been considered as they opportunistically reduce the load of static FNs. IoT devices can offload a task and receive the result to/from the OFN directly when OFN is close to the device. In addition, the offloading can be conducted indirectly through the BS when the OFN is not in the vicinity of the IoT devices while it is within the coverage of the BS. To assess the offloading performance according to the mobility of the OFN considering the direct and indirect offloading scenarios, we developed an analytic model for the opportunistic offloading probability that the task can be offloaded to the OFN, which can also be interpreted as the load distribution effect. Extensive simulation results are given to validate the analytic model and to demonstrate the performance of the opportunistic offloading probability.


I. INTRODUCTION
With the growing popularity of smart devices, such as smart phones, wearable devices, and vehicles that are equipped with various sensors, Internet of Things (IoT) networks where data is shared between the connected devices and IoT services such as smart home, smart city, and smart factory have attracted increased attention [1], [2]. Along with the variety and complexity of IoT services, cloud computing has been utilized to process the task from the IoT devices due to its flexible and scalable computing resources [3]. However, the remote location of the cloud servers typically leads to high latency and requires high network bandwidth usage for the core network. To mitigate this problem, the concept of fog computing, which brings computing resources closer to the IoT devices, has been introduced [4], [5].
In the fog computing architecture, the offloading of computing tasks can be conducted from the IoT devices to the fog node (FN) that is usually co-located with the network The associate editor coordinating the review of this manuscript and approving it for publication was Maurizio Casoni . access node such as a base station (BS) [6]. Compared to the conventional offloading (i.e., based on the cloud computing), offloading with FN can reduce the load of networks and support delay-sensitive applications. However, as the IoT devices within the same coverage of the BS can offload lots of tasks simultaneously, the FN can be overloaded, resulting in scalability issues due to its limited computing resource [6]- [9].
As a promising solution to this problem, opportunistic FNs (OFNs) which denote the FNs with mobility such as smart phones and vehicles have been considered. OFNs can provide computing resources to the IoT devices only when they are close to each other. In other words, OFNs can opportunistically reduce the load of static FNs because of mobility [10]- [19]. There have been many studies on the OFN offloading that can be classified into three scenarios as shown in Fig. 1: (a) direct offloading where the IoT devices directly offload the task and receive the result to/from the OFN when the OFN is close to the IoT devices [10]- [12], (b) indirect offloading where both procedures (i.e., the task offloading and result reception) always pass through the BS when the OFN is not in the vicinity of IoT devices while it is within the coverage of BS [13]- [16], and (c) hybrid offloading where either of the procedures directly interacts with OFN while the other is conducted through the BS according to the availability of the OFN based on its mobility [17]- [19]. However, previous studies have only considered their own fixed offloading scenarios. This means that the overall offloading analysis that reflects the entirety of the scenarios has not been considered even though all the scenarios can be opportunistically utilized according to the mobility of the OFN.
In this paper, we focus on the challenges associated with analytically modeling the behavior of the OFN offloading based on the whole systematic view. Based on the analytical model, extensive simulations are conducted and demonstrate that direct and hybrid offloadings account for 73% of the total opportunistic offloading probability, which denotes that the direct and hybrid offloading scenarios should be considered to design the OFN-based offloading architecture. To the best of our knowledge, this is the first analytical study that elaborates on the performance of the OFN offloading considering the entirety of the available scenarios according to the mobility of the OFN under diverse environments. The key contribution of this paper is two-fold: 1) we develop an analytic model for the opportunistic offloading probability that a task can be offloaded to the OFN for each offloading scenario, which can be interpreted as the load distribution effect; and 2) based on the simulation works, we evaluate the performance of the opportunistic offloading probability under various environments, which can provide valuable design guidelines for the OFN-based offloading architectures.
The remainder of this paper is organized as follows. After related works are introduced in Section II, the system model is described in Section III. Performance analysis is conducted in Section IV. Evaluation results and concluding remarks are given in Sections V and VI, respectively.

II. RELATED WORKS
Due to the limited computing resource of FN, there have been efforts to optimize the offloading performance between FN and users [6]- [9]. Fan et al. [6] proposed a workload balancing scheme to minimize the service latency considering traffic load allocation to BS and computing load allocation to FN. In addition, an application-aware load distribution scheme was introduced that can dynamically adjust computing resources of different applications to FN [7]. Ali et al. [8] provided an energy-efficient deep learning based computation offloading scheme to minimize the cost of local and remote executions considering the remaining energy of users, previous offloading decision, and network conditions. Moreover, Irshard et al. [9] considered a wireless powered FN system where users can offload the task to FN and harvest energy from FN, and provided an optimal time allocation and offloading policies to minimize the cost and energy consumption of users. These efforts on the offloading with FN have been extended to consider OFN.
As introduced in Section I, lots of studies have been conducted to opportunistically reduce the load of static FNs using OFNs [10]- [19]. These studies can be categorized into the direct offloading between the IoT devices and the OFN [10]- [12], indirect offloading via the BS [13]- [16], and hybrid offloading that considers both direct and indirect offloadings [17]- [19]. Shah et al. [10] introduced a vehicular fog computing framework to consider computational offloading from user vehicles to other fog vehicles and provide a scheduling policy for the offloading. Waqas et al. [11] investigated the effects of the mobility factors that captures the level of physical proximity between the users and fog nodes to the offloading performances. Lee et al. [12] provided a vehicular fog computing system to reduce the service delay of vehicular applications by offloading computational tasks to vehicles based on the resource monitoring manager.
Wang et al. [13] considered a fog computing architecture where roadside units (RSUs) redirect the incoming tasks to available vehicles to minimize the average response time. Hou et al. [14] introduced a software-defined vehicular fog computing architecture where RSU-based task allocation to vehicles is performed based on the offloading decision by software-defined networking (SDN) controller, while also maintaining the global network state information. Ye et al. [15] provided a service offloading strategy in bus networks to find an optimal task allocation strategy according to the moving trajectory of the bus fog servers. Tang et al. [16] proposed a task scheduling scheme where RSUs determine the task offloading strategy among vehicular fogs to reduce the service latency.
Zhang et al. [17] introduced a hybrid offloading scheme where either the vehicular-to-infrastructure (V2I) or vehicular-to-vehicular (V2V) transmissions is determined as task offloading options to reduce the offloading cost while considering running direction, file transmission time, and task execution time. Zhou et al. [18] reviewed the hybrid usage of the V2V and V2I offloadings in the vehicular fog computing architecture from the perspective of the mobility feature such as the contact probability, contact time interval, and coded computing. Wu et al. [19] provided a fog node selection algorithm to minimize the average response time of the offloaded tasks utilizing both V2V and V2I communications.  Note that abovementioned previous studies focused on their own offloading scenarios, which means that it was not investigated to analyze the OFN offloading performance considering the whole available offloading scenarios.

III. SYSTEM MODEL
As an example, in Fig. 2, the OFN can be in contact with the BS between τ o and τ 5 (i.e., the BS contact time). In the BS contact time, the OFN can communicate with IoT devices (i.e., users 1 and 2) between τ 1 and τ 2 and between τ 3 and τ 4 (i.e., the IoT contact times), respectively. If the task of the users occurs during the IoT contact time (e.g., τ f 2 ), the IoT device can directly offload the task to the OFN. Then, the IoT device can receive the result of the task from the OFN if the OFN completes the task before τ 4 . This case does not impose any load on the BS. However, it can be possible that the OFN cannot complete the task (e.g., τ e2 ) during the IoT contact time (e.g., between τ 3 and τ 4 ). In this case, the OFN can deliver the task result via the BS if the task is completed before τ 5 . On the other hand, if the task occurs before or after the IoT contact time (e.g., τ f 1 ), the IoT device transmits the task to BS because it cannot directly use the OFN. From the BS's perspective, if the task is received during the BS contact time, the BS can offload the task to the OFN because the OFN is available. If the OFN cannot complete the task before τ 5 , this paper assumes that the result can be delivered to the original BS based on the interface between the BSs such as X2 and Xn interfaces [20], [21]. Similarly, if the task occurs at the IoT device before τ 0 or after τ 5 , the IoT device offloads the task to the FN through the BS. Note that the IoT device and the BS can recognize the disconnection with the OFN by using periodic signaling messages [22], [23].
It is assumed that the IoT and BS contact times denoted by t I and t B follow an exponential distribution with mean 1/µ I and 1/µ B [24], [25], respectively. The probability density function (PDF) and cumulative density function (CDF) for the IoT contact time are denoted by and Similarly, the probability density function (PDF) and cumulative density function (CDF) for BS contact time are denoted by and In addition, we assume that the period when the OFN is not available for both the IoT and BS (i.e., non-contact time), denoted by t N , follows a general distribution with mean 1/µ N [27].
Meanwhile, it is assumed that the task processing time of the OFN denoted by t p follows the exponential distribution with the mean ωv OFN /u OFN , where ω, v OFN , and u OFN are the average size of the offloaded task, computational intensity, and computing capacity of OFN, respectively [28]. Its PDF and CDF are given by and

IV. PERFORMANCE ANALYSIS
In this section, analytic models are introduced to evaluate the performance of the opportunistic offloading probability that task is offloaded to the OFN. Specifically, available OFN offloading scenarios can be divided into six disjoint cases in Fig. 3: τ 2 ≤ τ k ≤ τ 3 < τ r ≤ τ 4 , and f) τ 3 < τ k , τ r ≤ τ 4 , where τ k and τ r are the times when the task occurs in the IoT device and the result of the task is received, respectively. t p denotes task processing time of the OFN. As described in Figure 3, we assume that the BS and IoT contact times can have range from 0 to infinity (i.e., 0 ≤ t B ≤ ∞) and from 0 to the BS contact time (i.e., 0 ≤ t I ≤ t B ), respectively. In addition, the IoT device can meet the OFN when they are both in the coverage of BS (i.e., t N ≤ τ 2 ≤ t N + t B − t I ). As explained before, we do not consider the cases when τ k < τ 1 , τ 4 < τ k , and τ 4 < τ r because the FN (i.e., not OFN) is in charge of the offloaded task in these cases. Let E Y be the opportunistic offloading probability in the case Y ∈ {a, b, c, d, e, f}. Then, E Y can be derived as follows.
1) E a : As shown in Figure 3(a), when τ 1 ≤ τ k , τ r < τ 2 , the task is delivered to the OFN through the BS because the OFN is not within the IoT contact time (i.e., t I ) but within the BS contact time (i.e., t B ). This means that the task occurs before the IoT device meets the OFN during the BS contact time (i.e., t N ≤ τ k ≤ τ 2 ). In addition, the result of the task can be received from Y. Kyung: Performance Analysis of Task Offloading With Opportunistic Fog Nodes the BS because the task is completed before the IoT contact time (i.e., 0 ≤ t p ≤ τ 2 − τ k ). The opportunistic offloading probability in case a (i.e., E a ) can be calculated using the PDF of t p and τ k . The joint PDF of the t p and τ k is denoted by f p,k , (t p , τ k ). Since t p and τ k are independent, the joint PDF becomes the product of each PDF (i.e., f p (t p ) · f k (τ k )). Consequently, E a is given by 2) E b : When τ 1 ≤ τ k < τ 2 ≤ τ r ≤ τ 3 , after the IoT device offloads the task to the OFN through the BS (i.e., t N ≤ τ k ≤ τ 2 ), it can receive the result of the task directly from the OFN because the task is completed within the IoT contact time (i.e., τ 2 − τ k ≤ t p ≤ τ 2 + t I − τ k ). This means that OFN moves close to the IoT device before the task is completed. Consequently, E b is given by 3) E c : When τ 1 ≤ τ k < τ 2 , τ 3 < τ r ≤ τ 4 , after the IoT device offloads the task to the OFN through the BS (i.e., t N ≤ τ k ≤ τ 2 ), it can also receive the result of the task from the OFN through the BS because the task is completed after the IoT contact time (i.e., τ 2 +t I −τ k ≤ t p ≤ t N + t B − τ k ). This means that OFN passes by the IoT device while processing the task. Consequently, E c is given 4) E d : When τ 2 ≤ τ k , τ r ≤ τ 3 , the IoT device directly offloads to OFN because the task occurs during the IoT contact time (i.e., τ 2 ≤ τ k ≤ τ 2 + t I ). In addition, the IoT device receives the result of the task to/from the OFN because the OFN is within the IoT contact time from the task occurrence time to the end of the processing time (i.e., 0 ≤ t p ≤ τ 2 + t I − τ k ). Consequently, E d is given by 5) E e : When τ 2 ≤ τ k ≤ τ 3 < τ r ≤ τ 4 , although the offloading to the OFN can be directly possible from the IoT device (i.e., τ 2 ≤ τ k ≤ τ 2 + t I ), the result of the task is delivered to the IoT device from the OFN via the BS because the IoT contact time is not sufficient to complete the task (i.e., the OFN leaves from the coverage of the IoT device before the task processing is completed; τ 2 +t I −τ k ≤ t p ≤ t N +t B −τ k ). Therefore, E e is given by 6) E f : Similar to the case a, when τ 3 < τ k , τ r ≤ τ 4 , the task is offloaded, and the result of the task is received after the IoT contact time (i.e., τ 2 + t I ≤ τ k ≤ t N + t B and 0 ≤ t p ≤ t N + t B − τ k ).
Consequently, E f is given by  Since the cases from a to f are disjoint events, the total opportunistic offloading probability denoted by E O can be obtained from (13).

V. SIMULATION RESULTS
To validate the analytic models, we developed an eventdriven simulator based on MATLAB R2018a and conducted extensive simulations. The default values of µ N , µ B , and µ I are 5, 5, and µ B × 2, respectively, as the average contact time of OFN is usually assumed to have a range from 1 to 10 [24]- [26]. In addition, the default values of ω, u OFN , and v OFN are set to 1Mb, 5 × 10 8 cycles per second, and 50 cycles per Mb, respectively [27]. For the simulation results, 50,000 random numbers are generated for t p , t B , t I , τ k , and t OFN according to the distribution with the default mean values as described above and used to compute the opportunistic offloading probability. This means that each simulation result is the average value of 50,000 tests. Fig. 4 shows the opportunistic offloading probability E for each case according to the BS contact time 1/µ B which is normalized by the non-contact time 1/µ N . The reason of this normalization is that Fig. 4 aims to show the effect of the BS contact time relative to the non-contact time (i.e., the ratio of the BS contact time to the non-contact time is the x-axis in Fig. 4). First, as shown in Fig. 4, the simulation results are consistent with the analytic results in all simulation settings. Meanwhile, as 1/µ B increases, E increases for all cases. This is because as 1/µ B increases, which can also be interpreted that the moving speed of the OFN decreases within the coverage of the BS, there are increased chances to exploit the OFN. Fig. 4 also describes that E b , E d , and E e are higher than E a , E c , and E f . Since we assume that the BS contact time is twice of the IoT contact time, the probability that either τ k or τ r exists within the IoT contact time is higher than the probability that both do not exist within the IoT contact time. Therefore, E b , E d , and E e , when either τ k or τ r exists within the IoT contact time, is higher than others. In addition, a crossing point can be found as 1/µ B increases. Specifically, E a sharply increases and becomes higher than E c . This is because the probability of a short processing time is higher than the probability of a long processing time for the OFN based on the form of the distribution. From Fig. 4, we can also check that the direct and hybrid offloadings between the OFN and IoT device can be efficiently utilized. Specifically, when 1/µ B = 0.5 (i.e., the fifth x-axis point), the direct and hybrid offloadings (i.e., cases b, d, and e) account for 73% of E O . This means that the direct and hybrid offloadings should be considered to design the OFN-based offloading architecture. Fig. 5 shows the opportunistic offloading probability E for each case according to the IoT contact time 1/µ I which is normalized by the BS contact time 1/µ B . The reason of this normalization is that Fig. 5 aims to describe the effect of the IoT contact time relative to the BS contact time (i.e., the ratio of the IoT contact time to the BS contact time is the x-axis in Fig. 5). First, as shown in Fig. 5, E b and E d increase while others decrease as 1/µ I increases. This is because the opportunity to complete the task processing within the IoT contact time becomes higher as 1/µ I increases. It can be noted that as 1/µ I increases, which can also be interpreted that the coverage of dedicated IoT communication increases, there can be more chances to exploit the OFN directly from the IoT. Between the cases b and d, E d sharply increases and finally becomes higher than E b because it becomes easier to offload the task and receive the result of the task directly to/from the OFN with increasing IoT contact time. On the other hand, among the cases a, c, e, and f, E e has the highest value because the task can easily occur within the IoT contact time as 1/µ I increases. With other cases (i.e., cases a, c, and f), E a is higher than others due to the form of distribution for the task occurrence and processing time as explained above. From   5, we can also check that the direct offloading between the OFN and IoT device without the intervention of the BS can be efficiently utilized. Specifically, when 1/µ I = 0.7 (i.e., the seventh x-axis point), 40% of E O does not require the intervention of the BS, which can reduce the load of the BS as well as the FN. Fig. 6 shows the opportunistic offloading probability E for each case according to the average size of the offloaded task ω whose unit is Mb. It is shown that E decreases as ω increases for all cases. This is because the task processing time also increases as ω increases, which makes it difficult for the OFN to complete the task within the BS and IoT contact times. Among all cases, the cases utilizing the IoT contact time (i.e., cases b, d, and e) have a higher E as explained with Fig. 5. On the other hand, among the other cases (i.e., cases a, c, and f), case f has the lowest E due to the form of the distribution for the task occurrence as explained above. Then, we can see that E a becomes lower than E c as ω increases. This is because it is difficult for the OFN to complete the task within short time (e.g., before the IoT contact time) as ω increases.

VI. CONCLUSION
In this paper, we introduced a systematic view to design the OFN-based offloading architecture which can be dynamically flexible according to the mobility of the OFN. In addition, we developed the analytic model of the opportunistic offloading probability considering both direct, indirect and hybrid OFN offloading scenarios based on the mobility of the OFN. Analytic and simulation results demonstrated that the opportunistic offloading probability for each case is affected by the contact times of the OFN with the BS and IoT device as well as the size of the offloaded task. Based on the results, it was found that the opportunistic offloading probability in each case increases when the BS contact time increases and the average size of the offloaded task decreases.
On the other hand, when the IoT contact time increases, the opportunistic offloading probability in the direct and specific hybrid offloading cases increases and accounts for the major parts while the opportunistic offloading probability in the other cases decreases. This denotes that the direct and hybrid offloading scenarios should be considered to design the OFNbased offloading architecture. In our future work, we will investigate the optimal offloading performance considering the available resources of the BS, static FN, and OFN.