A Stackelberg Game based Dynamic Resource Allocation in Edge Federated 5G Network

Mobile Edge Computing (MEC) plays key role for providing fast-response and high interactivity in the emerging 5G network. Edge service providers (ESP) are responsible for serving edge users or IoT devices running latency-critical applications. An MEC server provides faster response to ESPs but has limited computation resources, hence, it can be overloaded due to extensive resource demand. Thus, federation of multiple MEC servers offers an opportunity for dynamic resource allocation in a distributed manner. The federation objective is to maximize the usage of underutilized edge resources and reduction of service provision time simultaneously. As all the ESPs and MECs act autonomously, it is quite impossible for all the individuals to achieve optimal behavior simultaneously. In this paper, we develop a Stackelberg Game (SBG) based dynamic resource allocation method to reach the expected performance. The SBG analyzes the pricing of MECs and the resource-purchasing problem of ESPs. We also develop a many-to-many matching algorithm for resource sharing among the MECs and a one-to-many matching algorithm for that between an MEC server and ESPs. The results from an extensive performance evaluation demonstrate effectiveness of the proposed system in increasing utilities for MECs and ESPs, reducing the turnaround time of application tasks, and ensuring fair resource distribution compared to state-of-the-art works.


I. INTRODUCTION
T HE cloud computing and wireless communication integration created enormous scope for faster real-time communication. According to the current Cisco report [1], the annual global IP traffic will reach 396 exabytes (EB) per month which is 4.8 zettabyte (ZB) per year by 2022. Also, Traffic from wireless and mobile devices will account for 71 percent of total IP traffic by 2022. This traffic is the result of the 5G era. There are typically 3 scenarios present in 5G. The first one is enhanced Mobile Broadband (eMBB), which is characterized by high data rate requirements as virtual reality (VR), augmented reality (AR), etc. Second is Ultra-Reliable and Low Latency Communication (URLCC), characterized by latency intolerant services like self-driving cars [2]. The third one is the massive Internet of Things (mIoT) [3] which can be depicted as smart city, smart agriculture. Therefore, different applications require heterogeneous resources and it is quite challenging to meet the ongoing resource demand for mobile devices and IoT present at the 5G edge network [4]- [6]. Thus, the cooperation of Mobile Edge Computing (MEC) in terms of sharing resources is a challenging issue.
Enhancing the user's quality of experience (QoE) is very essential to ensure for diverse applications in 5G. Moreover, due to the increased computation requirement and limited computation and network resources, all tasks processing at local devices or offloading to the remote cloud for computation is inefficient and costly. In this case, the MEC will play a pivotal role [7], [8] for communication in 5G. The MECs provide not only computation capability and reduction of power consumption, but also shorten the computation and • We propose a distributed edge federation model for allocating resources dynamically between MEC servers and ESPs. The objective of each entity is to maximize its utility. • We formulated the Stackelberg game to observe the interaction between ESP and MEC servers. In the game, each MEC acts as a leader and sets the renting price for ESPs. The ESPs act as a follower and purchase the optimal amount of CRBs from MEC. • After knowing the optimal demand of CRBs, MEC determines if it has to purchase resources from other MEC servers or not. Thus we propose a many-to-many matching for resource sharing between buyer MEC and seller MEC servers. • MEC server serves multiple ESPs and an ESP can avail service from one MEC server. Hence, we also proposed a one-to-many matching between MEC and ESPs. • Extensive simulation done by using the Cloudsim [14].
The simulation results show the improvement in terms of the increased utility of MECs and ESPs, better service percentage of ESPs, and tasks turnaround time.
Rest of the paper is organized as follows. Section II is the literature review of the current scenario related to our work. Section III is the description of system model with assumptions and Section IV we formulated our problem. In Section V, we analyze the system based on the formulated problem and propose our algorithms. Section VI elaborates the performance evaluation and finally, Section VII summarizes the paper.

II. RELATED WORKS
Cloud computing brought revolutionary in the context of computing and service management. The federation between clouds is the concept of cooperation between different cloud servers, which is a concept of service aggregation based on the interoperability features. There are two basic federation types [15], one is the vertical federation which spans multiple levels of the cloud stack, other is the horizontal federation which spans a single level of the stack. Therefore the authors in [16] considered horizontal federation focusing on the smaller and medium cloud servers to federate along with large ones to enhance the economical gain of the server capabilities. Also, there are issues like resources availability, robustness, price of the federated resource, and the revenue gained from federation along with maintaining the high QoS. In [17] authors have addressed these issues and provided a cloud federation model where they consider the horizontal federation of Infrastructure as a Service (IaaS) layer of different cloud servers.
As the current network is growing rapidly for connecting new devices entering every day for computation and communication, the static resource provisioning will not be sufficient enough to cope-up with the same rate. The software defined networking (SDN) and network function virtualization enables flexible resource management and creates abstraction on the physical resource and internet services [18], [19]. Where NFV decouples network functions from dedicated hardware and SDN creates programmable centralized network control. The combination of SDN-NFV can be used as one of the key elements to make federation among clouds [20], [21]. In [22], the authors provided a centralized idea of SDN controller placed in MEC connected to the base station for the ultra-dense network. This SDN controller collects network status from a global perspective and advises mobile devices to perform tasks locally or offload tasks to a nearby small cell base station. An approach of distributed computation offloading and profit maximization is done in [13]. Where SDN controller placed in MEC and it controls only the resources required for different mobile virtual network operators (MVNOs) and offloading process from user to MEC with an extra element called virtualized user (VU). The joint optimization of the model considering the VU, MEC, and MVNOs are proposed by the authors and their proposed algorithm reduces the signaling overhead and complexity of the computation.
In [23] authors propose an auction based model for resource sharing between edge servers and the service providers to maximize the utility of each entity. Here, the allocation of resources is distributed and this process is also decoupled from service provisioning management at the service provider end. Now, when one particular MEC has abundant resources, it may share them with the cloud server and other edge servers also. On the other hand, when the demand increases that particular MEC have to buy resources from cloud server as well as from MEC servers. In [12], authors presented an effective process of wholesaling abundant edge resources to cloud server and buyback again if required by a particular MEC. Here, the main objective was to increase profit for MEC by wholesaling its resource which is underutilized at a lower price and then buyback at a higher price, if required to serve tasks coming to that MEC. In [24] the authors discussed the issue of sharing the resources between different MEC servers. They proposed a cooperative game based framework, where the edge servers form a coalition for resource sharing. When one MEC can not meet the resource requirement for its native applications other MECs can aid this situation by providing resources after ensuring the fulfillment of their requirements. They provided Pareto optimal solution for allocating resources using the cooperation of the present MEC servers in the system.
Most of the existing studies do not focus on the impact and opportunity of the federation of edge servers to handle extensive edge resource demand. Few works focused on the sharing resources between edge to cloud servers [12] and edge to edge servers [24], although none of the works focus on the optimal resource requirement of the ESPs to serve edge users and the objective of maximizing the utility. When the ESPs resource demand information at MEC servers are properly available, then it eases the decision for MEC to buy or sell resources. Hence, this observation lead us to design a Stackelberg game based approach for finding the optimal behavior of ESPs and MEC servers and federate resources between preferred MEC servers.

III. SYSTEM MODEL AND ASSUMPTIONS
In the edge network, the edge user runs different types of applications where most of which are latency-critical and requires real-time interactions. The Edge Service Provider(ESP) consists of User Equipment or IoT devices for smart-home. To serve the incoming tasks, ESP requests resources from one particular InP. The InP consists of a base station, MEC server, and SDN controller. For the case of simplicity, we use characterize InP as a MEC server. One MEC server is connected with other MEC servers. The figure (1) shows the federated environment of edge federation.
Let the set of ESP is M = {1, 2, ..., m} and the number of ESP is M . The set of InPs containing the MEC server is E = {1, 2, ..., e}. For serving edge users or IoT devices, each ESP requests resources from its nearby MEC server. We define the unit amount of resource that can be purchased by ESP from the MEC server as a computational resource block (CRB). The service rate of each CRB is denoted as µ. A particular MEC can serve multiple ESP by its resources. The aggregated tasks arrival rate to m th ESP is represented by λ m . Now, if a large number of ESPs prefer to get CRBs from   one particular MEC server to serve its incoming tasks, that MEC will face resource scarcity. Therefore, this MEC can now act as a buyer and buy CRBs by the federation process, from other MEC servers who have abundant CRBs to sell. S e is the set of sellers maintained by buyer MEC e, where the total number of sellers is N . A seller n in practicality cant serve all its buyers. Therefore, it will maintain a preference list of the buyer MECs, denoted as L n from its buyer set B n containing B number of buyers. Also, a buyer MEC can buy resources from multiple sellers. Hence, it also maintains a preference list of sellers L b . Furthermore, e th MEC also has its preference to serve connected ESP, where the list is denoted by L e m As already mentioned ESP serves UE and IoT devices running real-time applications, better QoS must be ensured for edge service. The measurement of QoS for m th ESP depends on the service delay t m which is calculated by where f m is the network delay and d m is the queuing delay. According to [25] the queuing delay for serving ESP m can be calculated by the following equation where q m is the amount of CRBs purchased by the ESP m. The network delay can be influenced by the traffic situation of the network, distance for transmitting, and many other uncertain factors. However, for the case of simplicity, the dependency of latency for network delay is greatly dependent on the total distance l e m from ESP m to the physical service provider e. Therefore f m has a linear relationship with l e m and scalar θ represented as To serve the edge users, ESP have to pay for purchasing CRBs from MEC, following the model presented in [26], the utility of ESP can be measured by the revenue received from the incoming workload of ESP and subtracting the cost for the payment of MEC and the cost incurred by the service delay, represented as following where α m , β m , γ m are the weight factors determined by each ESP for itself. ω e m is the association indicator where ω e m = 1 indicates ESP m is connected to MEC e and 0 otherwise. Also one ESP can avail service form one MEC only. r e is the per unit price of virtualized CRBs set by MEC e and q m is the amount of CRBs purchased by m form e.
According to the purchasing request from the serving ESP, each MEC calculates its utility from revenue gained from serving ESPs minus the energy cost for serving CRBs by itself. However, if e does not have a sufficient amount of CRBs present at the moment, it needs to buy CRBs from other sellers MECs n. Therefore the payment for buying CRBs and cost for communication delay from different sellers also subtracted from the utility of e, which is where q e n is the amount of CRBs purchased from seller n, p e n is the price set by n, ψ e is the weight factor and t e n is the communication delay between e and n. q r e is the number of CRBs is reserved by that particular MEC e and ε e is the energy cost of serving each CRBs by itself.
Again from the perspective of a seller MEC the utility function will be the payment received from the buyers minus the maintenance cost for serving each buyer as follow where p i n is the price set by the seller n itself, c n is the maintenance cost and q i n is the amount of CRBs rented by a buyer i from n.

IV. PROBLEM FORMULATION
According to the federation architecture between MECs, the interactions of resource trading between ESP and MEC and between buyer MEC to seller servers, all the individual ESP, buyer MEC, and seller servers can't achieve the maximal utility simultaneously. Therefore we need to observe a sequential decision making process. In this process, MEC predicts the total number of CRBs purchased by its serving ESPs and solves the pricing problem for ESPs using Stackelberg Game. Observing the behavior of MEC, each ESP determines to buy resources from MEC. After that, a buyer MEC now knows the amount of CRBs it needs to buy from seller servers and requests accordingly. Finally, each seller will provide the required amount of CRBs to its buyer and compete with other seller servers.
The objective of ESP is to maximize its utility by serving the edge user and IoT devices. Therefore, we can write the optimization problem for each ESP as follows subject to: where the pricing profile r is the price value set by all the MEC servers nearby to the ESP m. Constraint (8) ensures that ESP can avail service from only one MEC. Constraint (9) indicates tasks service delay should not exceed delay deadline. Constraint (10) indicates utility gained from edge users should be greater than the resource buying utility and constraint (11) ensures that ESPs received nonnegative resources from the MEC server. After observing the behavior of ESPs, MEC now sets the serving price to serve ESPs and compete with other MECs. Also, all MEC will determine if it needs to buy CRBs from seller servers or not. Therefore the optimization problem for the buyer MEC is subject to: (p e n q e n + ψ e t e n ) + ε e q r e (13) where Q * e denotes the optimal amount CRBs purchased by all the connected ESPs. P is the rent profile of all the seller servers. r * −e is the optimal price profile, set by other MECs except e. The constraint (13) ensures that utility gained by serving ESPs should be greater or equal to the resource buying utility and energy utility. Service latency should not exceed the delay deadline of tasks, hence, the buyer will buy resources from the seller where the constraint (14) can be met. Constraints (15,16,17) indicates non negative price and non negative resource purchased from sellers and MEC allocates non negative resources to ESPs respectively.
A seller MEC also wants to maximize its utility, therefore, it chooses the most preferable buyer MECs. Also, it needs to compete to sell its CRBs to buyers. The optimization problem for the seller server is subject to: where Q −i is the optimal amount of CRBs required by buyers other than i. P i −n is the pricing profile set by other sellers except n. The constraint (19) indicates pricing of CRBs should be greater or equal to the maintenance cost. Constraint (20) ensures allocation of resource to buyer i will be smaller or equal to the demand q i−th . Also, a seller will allocate CRBs to buyer MECs up to the available amount Q s n , which is represented by constraint (21).
After observing the interactions between ESPs, MECs and seller servers, we can focus on the following problems 1) Amount of resource purchased by ESP from MEC: ESPs are serving latency-critical applications of edge users and IoT devices. Again, the demand for CRBs is influenced by the service delay and pricing of the MEC server. Hence, the number of CRBs required by the ESPs should be optimal to increase utility. 2) Determining the price for ESP by MEC: When MEC provides CRBs to ESPs, the pricing of the CRBs should not be intolerable. Because at higher price ESPs will buy less resource from that MEC server and will give up if it can not gain positive utility. Also, MEC has to bear the serving cost and resource buying cost if it acts as a buyer. Hence, MEC has to ensure the optimal pricing of CRBs.

3) Resource allocation problem between buyer-seller:
When a MEC needs to buy resources from seller servers, it does have some preferences for selecting sellers. In the same way, each seller wants to allocate CRBs to its buyers to increase utility value. To maximize the utility, each seller will also have a preference list for selecting its buyers. 4) Resource allocation problem for MEC-ESP: MEC will allocate resources to its serving ESPs after matching between MEC and all its ESPs. MEC will prefer the ESPs form which the total utility will be maximized based on the pricing to ESP.
According to the above formulated problem and discussion, we observe that each ESPs, MECs are autonomous in their actions. Each individual observes other actions and takes the optimal decisions to improve their utility. Therefore to reach the optimal behavior, we first formulate the Stackelberg game where the MEC server acts as a leader and ESPs acts as followers. The purpose of the game is to solve the pricing problem for MECs and the resource purchasing problem for the ESPs. After calculating the optimal amount of CRBs purchased by ESPs, if MEC needs to buy external resources to meet the demand, then a many-to-many matching between buyers and sellers servers is proposed. Finally, to serve ESPs by a particular MEC server a one-to-many matching algorithm is proposed.
Lemma IV.1. The stackelberg game between MEC and the ESP, when MEC sets the service price r e , the optimal amount of CRBs required to maximize utility of a ESP is Proof. Based on the utility equation of ESPs in eq. (4) the first derivative of U m with respect to q m is Also the second derivative of U m with respect to q m is as follows Now as the ∂ 2 U m ∂ 2 qm < 0, which indicates that U e m follows a decreasing relationship with respect to q m . Hence if we consider the first derivative ∂U m ∂qm = 0, we will get the optimal number of CRBs or q * m purchased by each ESP m. As the actions of ESPs regarding the optimal CRBs are known to MEC server, the adjusted optimization function for a particular MEC server e is as follows maximize re U e (r e |Q * e , P, r * −e ) subject to: which indicates that the utility of a MEC server e is positive co-related with the pricing set by e to its ESPs. Again the as the service delay for any particular ESPs can not cross T , therefore the low bound for purchasing CRBs by any ESPs given as follows Finally following the low bound and eq. (22), the optimal pricing by MEC e to its ESPs for maximizing its utility is After calculating the optimal resource demand at the edge and pricing for ESPs, now we have to allocate resource dynamically.

V. DISTRIBUTED ALGORITHM FOR RESOURCE FEDERATION AT THE EDGE
After observing the behavior of ESPs, one particular MEC knows the amount of required CRBs (Q e ) it needs to purchase from nearby seller servers. To find out the best possible seller, each buyer needs to make their preference list. Each buyer MEC wants to buy resources from the seller considering lower renting price and minimal communication latency. Therefore the preference list of a particular MEC e who needs to buy CRBs form sellers is L e N = {L e 1 , L e 2 , . . . L e n } considering, L e n = −(ζ e P e n + η e τ e n ), where ζ e and η e are weight factors set by each buyer for itself, P e n and τ e n are the normalized price and communication delay, respectively. Accordingly a seller server n will make its preference list of buyers L n I = {L n 1 , L n 2 , . . . L n i }. Each seller prefers the buyers from which it can gain more profit thus, After the construction of the preference list by each buyer, it will try to buy resources from its preferred sellers. In Algorithm 1 we set a pointer for each buyer MEC to point its preferred seller from the preference list. At the starting phase, the pointer will point to the first seller. In each iteration, the buyer will propose its preferred seller for sharing resources and wait for confirmation. We also set a flag f e for each buyer MEC, which indicates wheater the seller n allocates its resource to that buyer or not. Initially, the value is set to 1 and when a buyer proposes a seller n, the value of f e will be 0. Now, if one particular buyer is rejected by seller n, it will update its pointer to point next most preferred seller form L e N and propose in the same way. This process of requesting seller continued until the demand of total amount of required CRBs Q e met.
From the perspective of a seller in Algorithm 2, based on the proposals from buyers, each seller constructs buyer preference list L n I , and allocate its resource for rent to the propose to pointed seller n according to preference for purchasing CRBs 11: f e ←− 0 12: end while most preferred buyer. After allocating CRBs to one buyer, the pointer of the seller updates to point next most preferable buyer in the next iteration. Selection of buyer will happen until the total available amount of CRBs Q s n of the seller n is not 0. If there are no more available CRBs to share by the seller to its buyer, it simply rejects the requests.
After the federation process of renting resources from different sellers, each MEC e will allocate its currently available number of CRBs Q e to its serving ESPs. The allocation of CRBs by MEC server to ESPs depicted in algorithm 3. MEC will construct the preference list of if Q e ≥ q m then 6: Allocate q m to ESP m Pointer moves to next preferred ESP where f m = 1 15: end while ESPs and set a pointer for each MEC to point ESPs in L e m . Initially, the pointer points first ESP. We also set flag f m to indicate if ESP m is chosen or not. Initially, the pointer value is 1. Each MEC selects its serving ESPs based on the preference and allocate resource according to the requirement and set f m = 0. If one particular MEC can not fulfill all ESPs resource demands then it prefers to serve only the most preferable ESPs and low preferred ESP will not get the desired amount of CRBs.

VI. RESULT ANALYSIS
In this section, we discuss the simulation setup and the analysis of the proposed edge federation process in detail. We used CloudSim [14] for the implementation and simulation result analysis. For simplification, we denoted our proposed method as Stackelberg Game (SBG). We compare our SBG with standalone non-federated (NF) MECs and another stateof-the-art-work Cooperative Game(CG) [24].

A. SIMULATION ENVIRONMENT
We considered there are 3-9 MEC servers, and 200 -320 ESPs randomly in a circular distance of 100km. By following the practical environmental settings in [25] we set the tasks arrival rate of each ESP λ m as a random number having the average of 0.5 per millisecond (ms) which is 500 per second (s). The CRB service rate is 0.1 (ms) −1 . The maximum delay deadline for all ESPs is 60 ms. Based on the usage of its computing resources and its service cost, we set the announced rent as a random number satisfying the uniform distribution between (5, 10) also the announced price for buyer MEC is between (0, 5), and the amount of available CRB as a random number satisfying uniform distribution between (200, 400). The weight factors α m , β m , γ m are set as 20, 0.01 and 0.001, respectively. Performance parameters can have values as summarized in Table 2.

C. SIMULATION RESULTS
We study the performance of our proposed SBG method by varying the number of ESPs, changing the task arrival rate at ESPs, and varying the number of MECs.

1) Impact of varying the number of ESPs
The Fig. 2 depicts the impact of varying the number of ESPs in the system. To study the impact we change the number of ESPs from 200 to 320 and assume the tasks arrival rate at each ESP is 500 per second and 5 MECs for providing resources to the ESPs. In Fig. 2a, we can observe that as the number of ESP increases the average utility of MECs increases. The utility increases rapidly for MECs when the number of ESPs is 200 to 280, after that the growth of utility gradually decreased to the nearly equal utility for the last few points. However, the saturation point is reached when the number of ESP is 300 to 320. The reason behind this is when all MEC have available resources, increasing ESP helps MECs to gain more utility by providing its resources to the demanding ESPs according to their requirements. After when the ESPs number reached 300 to 320, all MECs are now saturated by demanding ESPs and MECs have no more resources available to provide to ESPs. We can also observe that our proposed SBG and the method CG have a very close average utility of MECs compared to the N F method. The reason behind this is in SBG a buyer MEC and buy CRBs from other sellers and in CG all the MECs which have abundant resources can share resources ESPs other than its serving ESPs. On the contrary in the VOLUME -, 2021 can not gain utility by sharing or directly selling CRBs to ESPs. However, our proposed SBG outperforms both the CG and N F methods. In Fig. 2b, the average utility of ESPs is higher when the number of ESPs was low and decreased drastically according to the increasing number of ESPs. The reason behind this is when the number of ESPs increases MECs are providing available CRBs to ESPs and can satisfy the total amount of resource demand up to a certain point. After that increasing ESPs actually increases the demand of CRBs and now it will cause resource scarcity, therefore the number of fully served ESPs will decrease. In this scenario, each ESPs have to wait more and the competition of getting resource is higher for all the described methods. As usual, the N F method performs worst and our proposed SBG outperforms the other two methods of resource provisioning.
As already mentioned that, an increasing number of ESPs will cause resource starvation and eventually decrease the average utility of ESPs; the percentage of served ESPs will also decrease. In Fig. 2c, we observe that when the ESPs number in the system is low link 200 to 220 both SBG and CG can serve 100% of ESPs according to the demand. When ESPs increases the percentage of served ESPs decreases accordingly. The N F performs worst as in this approach, MECs can not buy or federate resources from other MECs hence the percentage of ESPs getting served is very low compared to the other methods and SBG outperform CG.
In Fig. 2d, we observe the average turnaround time (TAT) of successfully completed tasks. We can find that the increasing number of ESPs increases the TAT of tasks in all the described methods. We observe that the N F method has the lowest TAT whereas the CG method has the highest TAT value. The reason behind this is, in the N F method the MECs do not communicate with other MECs to share resources that's why the burst time is less than other methods. Whereas in CG ESPs have to wait until another MEC who have abundant resources decides to share its CRBs to that particular ESP which are not getting resources. In contrast, in the SBG method if a MEC faces resource shortage, that particular MEC by itself request other MECs to share resources, and thus SBG requires less time for finding resources and satisfying it's demanding ESPs requests. We also can observe that when the number of ESPs much higher like 300 or 320 the TAT is much better in our proposed SBG method. Although it seems N F is better than the other two approaches, but we can surely say that is not true when we observe in Fig. 2c.
2) Impact of varying task arrival rates In Fig. 3 we measure the impacts of changing tasks arrival rate at each ESPs. We change the arrival rate from 200 to 800 tasks per second and maintain the number of ESPs present in the system is 200 also the number of MECs are 5, and observe the impacts. In Fig. 3a, depicts that when the average tasks arrival rate of each ESP increases the average utility of MECs increases. The reason behind this is now MECs can increase prices for CRBs and ESPs have to buy them at a higher price. The utility value is increasing up to tasks arrival rate 700 for all the N F , CG, and SBG methods. However, when the number of tasks arrival increases further, the utility values are not increasing for MECs as all MECs are now at saturation point. Therefore when MECs reach the saturation point of resource availability, it is not possible to allocate more resources to demanding ESPs. Here we also can observe that MECs in the N F method have the lowest utility value than other methods. Also, the SBG and CG ensure very close utility values for the MECs.
In Fig. 3b, we observe that the average utility of ESPs also increases when the tasks arrival rate is increasing. The utility values are nearly similar for tasks arrival rate 200 to 400 for all described methods. The reason behind this is, at this tasks arrival rate, nearly all the demand of resources of all ESPs can be served in flexible manner as the resources are highly available due to low demand. However then the increasing rate of the utility of ESPs decreases when the tasks arrival rate is higher like 500 to 800. Also, when the tasks arrival rate is 700 -800 as MECs are highly saturated therefore ESPs utility also reach a saturation level.
In Fig. 3c, we can see that increasing the rate of the arrival of the tasks decreases the average served percentage of ESPs. As already mentioned when more tasks are arriving, VOLUME -, 2021  the demand of resources of ESPs also increases as they have to serve the increasing edge demand. However, the MECs are resource-constrained and all the MECs will face resource scarcity at the higher tasks arrival rate. For that particular reason more ESPs will face resource shortages and the number of ESPs getting service from MECs will drastically decrease. However as usual N F method performed worst in this case, CG, and our proposed method SBG performs moderately well to handle the increased resource demand.
In Fig. 3d, we observe that the N F method has the lowest TAT for successful tasks completion and CG has the highest. Our proposed SBG performs moderately than CG. Though NF has the lowest TAT it does not mean that N F is better than the other two methods as we already observed in Fig.  3c the percentage of served ESPs are very low. Both CG and SBG require extra communication time or burst time for searching and providing abundant resources of different MECs.

3) Impact of varying the number of MECs
In figure 4 we change the number of MECs in the system from 3 to 9 and maintain the number of ESPs present in the system is 320. Also, we consider the tasks arrival rate at ESPs to 500 tasks per second and observe the impacts.
In Fig. 4a, increasing the number of MECs decreases the average utility value for all the MECs in all the described methods. When we increase the number of MECs it means we increase the total amount of resources to serve edge load. Now all the MEC servers will have fewer ESPs to serve, which means ESPs are now distributed between MECs more evenly. This will eventually decrease the utility of MECs. The N F method faces a drastic decrease in utility value, whereas the CG and our proposed SBG method behave more similarly when the number of MEC increases. We can see that when the number of MECs is 9 both CG and our proposed SBG have are nearly equal average utility for MECs because the need to spend less communication time and the demand of ESPs also nearly equally distributed among serving MECs.
In Fig. 4b, we observe that the average utility value of ESPs increases when the number of MECs increases. As already mentioned, we run this simulation by keeping the number of ESPs to 320, which is an overloaded situation for all MECs. That's why the utility value of ESPs is quite low when the MECs number is 3. After, when we increase the MEC count, which indicates we increase the resource availability. When the number of MECs is much higher like 7 to 9 we can see the gained utility of ESPs are nearly equal for both CG and SBG methods. This indicates that the system has more resources than the demand of ESPs and the utility value of ESPs is now at saturation point. However, the N F still performs poorly although we increase the number of MECs.
In Fig. 4c, we observe the percentage of served ESPs is increasing when the number of MECs increases. As already stated when the MECs number was low the scarcity of resources was very high. Which causes more than half of the ESPs not to get the required amount of CRBs. This situation eases when we increase resource availability by increasing the number of MECs in the system. All the three methods N F , CG, and SBG are follow the same intuition. We also observe that when the number of MECs is between 7 to 9, the percentage of served ESPs are close to 100% for both CG and our proposed SBG methods. That is all the ESPs are getting their required resources to fulfill the edge demand as the resource are abundant for all the MECs.
In Fig. 4d, we observe the decrease in average TAT concerning the increasing number of MECs. We see that the N F method has the lowest TAT value than the other two methods. The reason behind this is, in NF there is no possibility of renting resources from other MECs, thus this method serves its ESPs faster than rest two methods, although the served percentage is not satisfactory as we can see in Fig.  4c. However, our proposed SBG method has less TAT for successful tasks completion than CG. In this approach, the burst time or the communication time is lower than the CG method as finding resources is done by the MEC server itself which reduces the burst time. On the other hand in the CG method, MECs allocate resources to their own ESPs and then find other ESPs to provide abundant resources, this increases the burst time for tasks getting served. When the number of MEC servers reaches 8 to 9, we can also observe that all three methods have nearly equal average TAT for serving their ESPs.

VII. CONCLUSION
In this paper, we proposed the resource sharing approach or the federation process between the MEC servers. Our target was to aid overloaded MEC servers and federate abundant resources of other MEC servers. The objective was to find dynamic resource requirements and the allocation of resources in a distributed manner. Hence, our proposed SBG method first calculates the optimal resource demand for each ESPs, and based on that we categorized buyer and seller MEC servers. We observed the interactions of buyer and seller servers and the interaction of MEC with ESPs. We devel-oped a many-to-many matching algorithm between buyer and seller MEC servers for resource sharing or federation. Then, we also represented a one-to-many matching between MEC and ESPs. The proposed method showed improvement in a comparative study with the state-of-the-art-work and nonfederated standalone MEC approach.