Introduction

The vigorous development of IoT and mobile intelligent devices has brought about a trend of data sources shifting from centralized cloud data centers to distributed edge computing networks [1,2,3]. In IoT application scenarios based on centralized cloud computing, the data generated by sensors needs to be transmitted to cloud platform and to be processed by using the cloud computing power. Unfortunately, the massive amount of data transmission will bring a huge burden to the core network, which not only affects the normal operation of the core network, but also brings huge transmission delays and reduces user experience [4,5,6]. As a result, edge computing came into being, and Edge Cloud is one of the main research directions in the field. In Edge Cloud, multiple edge servers (referred to as edge nodes in the paper) are placed closer to users, and users can submits computing tasks to an edge server that is closer to them for computing. Compared with centralized cloud, Edge Cloud meets the requirements of low latency, low consumption and fast response. Therefore, the combination of Edge Cloud and IoT has become a general trend [7,8,9,10].

As is known, P2P architecture, where the neighbor nodes exchange parameters to obtain global information, is one of the mainstream architectures of Edge Cloud. Therefore, we adopt P2P architecture that has no fixed central node and can better and fully utilize the extensive distributed resources of edge nodes. Considering the important impact of sensor data routing technology on edge cloud service quality, such as reducing overall network traffic, reducing user access latency, and improving resource utilization of edge nodes, in the paper, we study an adaptive routing strategy in PEC.

Currently, the challenges in utilizing PEC to process sensor data routing can be mainly divided into two aspects. On the one hand, due to the following factors, such as the diversities of user needs, the temporal differences in service access, and the limited coverage of an individual edge node, if a certain sensor data is cached on an edge node, it often leads to an increase in service latency, and even network congestion and service interruption. On the other hand, due to differences in computing power and dynamic changes in load conditions among edge nodes, some edge nodes may have excessive load, which greatly damages the quality of service. In the paper, we focus on the topic of ARPEC, specifically studying how to reduce data traffic, how to shorten user access latency, and how to improve the utilization of edge nodes in PEC. The contributions of this paper can be summarized as follows.

  • • Modeling adaptive routing optimization: We analyze the key goals of solution to routing optimization, and propose a sensor data routing model to reasonably route sensor data to the target edge nodes which provide caching services for the sensor data.

  • • Selection scheme for target edge node: We introduce a target edge node selection scheme to enhance user experience, which can adapt to the temporal dynamic characteristics of routing demands, and design a target edge node selection algorithm based on a grey linear regression combination prediction model.

  • • Construction and solution of MCMF graph: To improve the overall performance of PEC, we map sensor data routing to MCMF graph from a resource perspective, at the same time, propose an incremental MCMF algorithm based on BP, which reduces computational costs and supports dynamic deployment.

The remainder of this paper is organized as follows. In Related work section, we review the related work on routing strategies. An adaptive routing model in PEC is established in Adaptive routing model Section. In Target edge node section, we propose a target edge node selection scheme based on the relevant characteristics of PEC and IoT, and design a request message processing algorithm. In MCMF graph section, by analyzing the impact of edge node load on service quality, we propose a sensor data routing scheme based on MCMF graph that supports global optimal solution for multiple routing tasks, and design an incremental MCMF algorithm based on BP. We compare the experimental performance and analyze the results in Simulation and performance analysis section. Conclusion section concludes the paper.

Related work

The sensor data routing strategy of edge computing network in IoT is a hot research topic in academic research in recent years. According to the different metrics, it mainly involves two aspects: scheme for selecting target edge node and solution using MCMF model.

Scheme for selecting target edge node

In IoT, the edge nodes store a certain amount of sensor data. The quality of target edge node selection scheme will have a significant impact on system performance. The core of scheme is how to cache sensor data, that is, how to design caching scheme for sensor data.

LCE [11] is an intuitive caching decision scheme where data is cached by all nodes along the way back to the requester; however, it can easily lead to huge data redundancy. LCD [12] and MCD [13] are two approaches that improve the caching diversity. A new copy of the requested data will be cached only at the immediate node of the path in downward direction. The difference between them is that under MCD, the hit node will delete the requested data. However, both were proposed earlier for web caching to reduce cache redundancy. Prob [14] is a probabilistic caching version of LCE. However, the version is not flexible enough to determine whether to cache the arrived data based on a static probability. In short, the above strategies are mainly applied to Information Centric Networks and not specifically targeted at IoT.

Currently, there are some data caching solutions based on IoT. Y. Sellami et al. [15] proposed an architecture for a distributed fog caching solution for Content-Centric Networks. O. Serhane et al. [16] focused on an energy-aware caching placement scheme to maximize the energy-saving. G. Dhawan et al. [17] considered the trade-off between node energy, data freshness and cache occupancy, and proposed a candidate node selection for cache placement. N. Baltagiannis et al. [18] incorporated sensor faults and energy consumption in caching decisions. M. Amadeo et al. [19] designed a probabilistic Internet-scale caching design for IoT data. S. Tanted et al. [20] discuss the design, implementation and performance of a distributed caching & aggregation mechanism to handle the visualization of sensor data. However, the approaches are more focused on caching techniques for IoT-based compared to giving much attention to the placement and selection of caching nodes.

In summary, it can be seen that the caching schemes of Information Centric Networks have the problems of high pressure on data center transmission and computing, as well as high construction costs; the IoT-based caching schemes are good solutions for the systems that generate a large amount of sensor data flow. However, how to improve resource utilization and computational efficiency, as well as how to reduce user query latency, is still a topic that needs further research. This study extends the existing work by utilizing an adaptive routing optimization model with mechanisms for selecting target edge node to address the limitations of traditional routing models when applied to PEC. It also optimizes the selection scheme for target edge node, resulting in reduced load on edge node and user access latency.

Solution using MCMF model

In many scenarios, a large number of users access edge nodes at different times and locations [21]. Therefore, routing strategy typically cannot be designed for each user, but relies on dynamic changes in user query patterns and spatiotemporal dimensions. In addition, routing service often incurs significant transmission costs, which may lead to service interruption and overall service delay. At present, there are some studies using MCMF model to solve sensor data routing problems.

To minimize average transmission delay or flow cost in data centers, Akbar Majidi et al. [22] formulated this optimization problem as a constrained Markov decision process. By creating multiple paths between the source and destination peers, MaxFlowTCP [23] utilized SDN with traditional TCP to deliver maximum flow throughput in data centers. Through a logically centralized control plane, the processing-while-transmitting pattern [24] jointly determined the transmission path and placed subtasks adaptive to dynamic topology, and data distributions. To minimize the sum of heterogeneous costs of relay nodes, Y. Sun et al. [25] formulated the NWPTSTP for minimum cost relay node placement. However, the approaches are more focused on providing traffic management in Software-Defined Networks environments or in Wireless Sensor Networks, and don’t involve the re-optimization of flow in PEC.

In addition, some studies have concentrated on BP-based MCMF methods [26], which mainly concentrate on how to utilize the parallel transmission of information between nodes in solving combinatorial optimization problems. G. Dhawan et al. [27] applied BP to discover globally optimal routes by performing low-complexity computations and exchanging messages with their neighbors. N. Baltagiannis et al. [28] showed how BP can be used to compute the throughputs of different links in the network given their access intensities. Ghafoor et al. [29] applied BP algorithm to compute a final belief about existence of primary user. Kakkasageri et al. [30] proposed multi-agent routing scheme for vehicular Ad hoc networks. However, one common challenge is the high time-consuming of message updates, which often leads to a low sensor data routing efficiency. Thus, there is a need for further research to develop optimized BP algorithm that can effectively minimize system overhead in PEC.

Drawing inspiration from these above researches, we focus on the overall performance of PEC utilizing an adaptive routing optimization model, and demonstrate how leveraging an incremental MCMF algorithm based on BP can reduce computational costs, thereby enhancing efficiency in routing sensor data.

Adaptive routing model

System model

A typical PEC scenario is shown in Fig. 1.

Fig. 1
figure 1

A typical PEC scenario

PEC consists of sensors, edge nodes, and users. Without affecting routing analysis, the system model omits gateways between sensors and edge nodes, as well as between users and edge nodes. There are two types of messages in PEC: user request and sensor data. Thus, it can be inferred that the overall network traffic arises from the superposition of these two types of messages. Assume that sensor data carries the corresponding information such as sensor identification and timestamp. A sensor transmits data to a directly connected edge node, which stores sensor data in the same size blocks. We refer to the data blocks in edge node as content. If an edge node caches a certain sensor data, then the edge node is referred to as the target edge node related to the sensor. Edge nodes can transmit user requests and sensor data between each other. A user obtains the contents of a target edge node by sending request messages. In Fig. 1, \(S=\{{s}_{1},{s}_{2},{s}_{3}\}\), \(EV=\{{\text{e}}{v}_{1},{ev}_{2},\dots ,{ev}_{6}\}\) and \(U=\{{u}_{1},{u}_{2}\}\) denote the sets of sensors, edge nodes and users, respectively. The set of target edge nodes related to s1 for the users u1 and u2 is denoted by \(TE({s}_{1},U)=\{{ev}_{2},{ev}_{5}\}\). A label \(\stackrel{Data}{\to }\) on an edge indicates the routing of sensor data. Meanwhile, a label \(\underset{Request}{\to }\) expresses the routing of user request messages.

With the expansion of the scale of PEC scenarios, this system model exhibits highly dynamic characteristics. First, with the dramatic increase of sensors, the user request services are highly dynamic in temporal. Thus the temporal dynamic of user request services should be considered for routing optimization. Second, it is demonstrated that with the deepening of PEC computing, an unchanged topology in a PEC scenario can no longer meet complex application requirements. So, supporting dynamic deployment of nodes is another factor that cannot be ignored in routing optimization.

Optimization goals

Considering the dynamic requirements of user request services and network topology, the adaptive routing in the paper is defined as how to reasonably route sensor data to the edge nodes for caching in heterogeneous edge node scenarios at each time, that is, how to select the target edge node to achieve the optimal goal.

From the perspective of edge computing service providers and users, the main purpose of selecting target edge node is to reduce the traffic of entire network and the access delay of users, while improving the resource utilization of the edge node. To achieve this goal, the following measures can be taken. Firstly, In order to avoid the surge in the traffic of entire network caused by the propagation of sensor data in PEC, we reduce the number of visits to edge nodes directly connected to sensors. Secondly, we make the content as close to users as possible to reduce users’ access delay. Thirdly, considering the performance differences of edge nodes, we deploy user request services to edge nodes that minimize the overall computational network scenario overhead as much as possible. Therefore, for selecting target edge node, three optimization goals are defined as follows.

  • (1) Goal 1: Minimize the load on edge nodes directly connected to sensors

The goal 1 can be calculated as

$$load\left(u,s\right)=\sum_{t\in T}sat(req\left(u,s,t\right),dl\left({\text{s}}\right)),$$
(1)

where T is the running time of the network, req(u,s,t) is the request messages sent by user u to s at time t, dl(s) represents the edge node directly adjacent to s, and sat(r,ev) is a Boolean function to determine whether ev meets the request r. We define load(u,s) as the number of requests that edge node dl(s) satisfies u during time period T. The smaller the value of load(u,s) is, the lower the network traffic is.

  • (2) Goal 2: Minimize user access latency

The goal 2 can be calculated by the following expression.

$$delay\left(u,s,ev\right)=d(u,s,ev)\cdot\sum\nolimits_{t\in T}sat(req\left(u,ev,t\right),dl(s)).$$
(2)

We define delay(u,s,ev) as the ratio of the delay of sensor data transmission between user u and the edge node ev that satisfies the user's request after sending a request message to sensor s during time period T, and the delay between user u and the edge node dl(s). The smaller the value of delay(u,s,ev), the closer the edge node that satisfies the user u's request is to u. Therefore, delay(u,s,ev) can be used to indirectly reflect goal 2.

  • (3) Goal 3: Minimize system overhead

One of the factors affecting system overhead is the resource utilization of edge nodes. To describe the resource utilization of edge node, the weight value of edge node ev, denoted as w(ev), is designed in PEC. w(ev) is inversely proportional to the resource utilization of the edge node. Here, w(ev) is influenced by the factors such as the CPU and disk utilization of edge node, as well as the priority of content requested by user, that is, the higher the utilization of CPU and disk, as well as the priority of the requested content, the lower this value of w(ev) is.

The goal 3 can be formulated as follows.

$$cost\left(u,s\right)=w(dl(s))\cdot load\left(u,s\right)+mW\cdot mD,$$
(3)

where \(mW=(w\left({ev}_{1}\right) w\left({ev}_{2}\right)\cdots w({ev}_{n}))\) is a 1*n matrix, given n is the number of edge nodes in the network. \(mD={(delay\left(u,s,e{v}_{1}\right)\cdots delay\left(u,s,{ev}_{n}\right))}{\prime}\) is a n*1 matrix. Taking into account the processing capacity of the edge nodes, cost(u,s) is defined as a numerical value that represents the ratio of the product of the edge node load of the content provider in goal.1 and the delay between u in goal.2 and the edge node ev that satisfies u's request, to the delay between u and the content source provider.

As mentioned above, we construct the following adaptive routing optimization model.

$$min\sum\nolimits_{\begin{array}{c}u\in U\\s\in S\end{array}}cost\left(u,s\right).$$
(4)

Considering the different processing capabilities of each edge node in the scenario of heterogeneous edge nodes, the target of the model is to solve for the values of the req function and sat function at a certain time, so as to minimize the value of formula 4.

Problem analyses

  • (1) Selection of target edge node

By observing the goal 1 and the goal 2, we find that req(u,s,t) and req(u,ev,t) are key parameters in the model, which can reduce the overall network traffic and user access latency. Thus, based on the value of the function sat, it can be determined whether the edge node has a message that meets the request. By summing the sat values, the activity of sensor messages at an edge node can be determined. Based on message activity, it is possible to better determine whether each edge node is a target edge node during the period. Therefore, the value of \(\sum_{t\in T}sat(r,ev)\) is a key factor. In addition, in order to minimize user access latency, it is necessary to keep \(\sum_{t\in T}sat(r,ev)\) as small as possible, that is, the number of hops between the target edge node and the user needs to be as small as possible. We proposes a target edge node selection scheme based on message activity and network topology, and implements a target edge node selection algorithm based on a grey linear regression combination prediction model.

  • (2) MCMF graph

By observing the goal 3, we find that w(ev) is another key parameter in the model. Furthermore, w(ev) can be quantified as the capacity of the path in the network graph. At present, the MCMF problem has been applied to various network routing scenarios and is usually characterized by graph models. By limiting the capacity and cost of paths in the graph, the global optimal solution for multiple routing tasks is sought. We apply it to message routing modeling in multi user, multi sensor, and multi query scenarios. Specifically, the two problems of users' demand for resources and the supply of resources in edge computing networks are transformed into the construction and solution of MCMF graph. In particular, considering the throughput and response delay of user requests in edge computing networks, an incremental MCMF optimization algorithm is implemented.

A MCMF graph for sensor data routing is shown in Fig. 2. The nodes marked with dashed circles, such as ev2 and ev5, are the target edge nodes of s1. The node \(t{v}_{{s}_{1}}\) is the terminal node associated with s1, which serves as the aggregation node for data from sensor s1. \({tv}_{{s}_{1}}\) is connected to u1 and u2 by edges, indicating that u1 and u2 have sent request messages to s1. Sequence \({s}_{1}\to {ev}_{1}\to {ev}_{2}\to {u}_{1}\) and sequence \({s}_{1}\to {ev}_{1}\to {ev}_{3}\to {ev}_{5}\to {ev}_{4}\to {u}_{2}\) represent the two data forwarding paths related to s1, respectively. Each edge is marked with a pair of cost/capacity values, where the cost indicates the cost of forwarding sensor messages through the edge, and the capacity means the ability of the edge to forward sensor messages. Considering that an edge node directly connected to a sensor should receive the sensor data as much as possible, the capacity of the edge is assigned infinity. Similarly, due to the fact that the terminal node directly connected to a user is uniformly added for the convenience of unified processing, the capacity of the edge is also assigned infinity.

Fig. 2
figure 2

A MCMF graph for sensor data routing

Target edge node

Priority of edge node

In the following, based on the scheme of selecting target edge nodes, we first discuss three time-related metrics: message activity, user request probability, and query distance. And then, the priority is set for each edge node based on these measurements, and the edge node with the highest priority is selected as the target edge node to meet the dynamic changes in user service requests.

  • (1) Message activity

Since the types and quantities of user requests received by edge node are different, we can determine the activity of message by calculating the number of user requests. Therefore, message activity is defined as the ratio of the number of requests for that message to the total number of requests for all messages. Let rs denote the messages generated by the sensor s. For the edge node ev, act(rs,t,ev) denotes the activity of rs at time t. The activity of rs in the edge node ev can be denoted by act(rs,ev). Thus, the following equation holds.

$$act\left(r_s,ev\right)=\sum\nolimits_{t\in T}act\left(r_s,t,ev\right)=\sum\nolimits_{t\in T}sat(r_s,ev).$$
(5)
  • (2) User request probability

Considering that a sensor generates new messages every once in a while, users are more inclined to request the latest information. Therefore, the novelty of messages can have an impact on the priority of the edge nodes. We use timestamps to distinguish messages generated by the same sensor at different times. So the larger the timestamp value is, the newer the message is. The probability of any user sending a request message to the edge node ev regarding the message r generated by sensor s at time t is denoted by prob(rs,t,ev).

  • (3) Query distance

In order to reduce latency, sensor messages should be cached as close to the edge node as possible to the user who sends the relevant request message. Therefore, we take the network topology into account when calculating the priorities of edge node. The query distance is denoted by ah(rs,t,ev), which is defined as the average number of edge nodes on the relevant paths. Here, the relevant path refers to the path that the message rs generated at time t routes from the current edge node ev to the user node that send the corresponding request message.

  • (4) Selecting target edge node

Message activity and user request probability are related to the usefulness of the cached sensor data, and query distance is a metric of user access latency. In summary, for the sensor message rs generated at time t, the priority of the edge node ev can be obtained by

$$p\left(r_s,t,ev\right)=act\left(r_s,t,ev\right)\cdot prob\left(r_s,t,ev\right)/ah\left(r_s,t,ev\right).$$
(6)

Similarly, for the sensor message rs, the priority of the edge node ev can be calculated as

$$p\left(r_s,ev\right)=\alpha_{ev}\sum\nolimits_{t\in T}p\left(r_s,t,ev\right)/\sum\nolimits_{t\in T,s\in S}p\left(r_s,t,ev\right).$$
(7)

Among them, the coefficient αev denotes an adjustment factor, and its value can be appropriately predicted according to the application scenario. In the paper, we let a = 1. Generally speaking, the higher the activity of message is, the higher probability of user’s request is; and the smaller the query distance is, the higher priority of edge nodes.

Prediction of priority

In PEC, sensors constantly generate new data, and users frequently have new requests. Especially when edge nodes receive new requests, the three metric values calculated by using the method in the previous section will have a significant deviation from the subsequent stable values. This results in a significant difference in the priority of edge nodes between the early and the subsequent stable stages. In order to overcome the above impact, this section predicts the priority of edge nodes that receive new requests, so that the nodes can obtain more accurate priorities earlier. Due to the characteristics of grey system, such as no need for a large number of samples, and a good short-term prediction performance, a grey system prediction model for predicting priority is proposed.

Assume that a user has a request for a new message \({r}_{s}{\prime}\) from sensor s, where \({r}_{s}{\prime}\) is an earlier message than rs. For predicting the priority of ev regarding \({r}_{s}{\prime}\), the priority sequence of ev regarding rs can be quantified as \({mP}^{(0)}=(p\left({r}_{s},{t}_{1},ev\right),p\left({r}_{s},{t}_{2},ev\right),\dots ,p\left({r}_{s},{t}_{n},ev\right))\), and then, the grey system prediction model, which is donoted by p(1)(rs,tk,ev), is used to estimate the predicted value \(p\left({r}_{s},{t}_{n+1},ev\right)\). The details of modeling can be found as follows.

  • Step 1. Accumulate the priority sequence \({mP}^{(0)}\) to obtain a new sequence, i.e. \({mP}^{(1)}=({p}^{(1)}\left({r}_{s},{t}_{1},ev\right),{p}^{(1)}\left({r}_{s},{t}_{2},ev\right),\dots ,\left({r}_{s},{t}_{n},ev\right))\). The accumulation formula can be expressed as

$$p^{(1)}\left(r_s,t_k,ev\right)=\sum\nolimits_{i=1}^kp\left(r_s,t_i,ev\right),k=1,2,\dots,n.$$
(8)
  • Step 2. Generate the adjacent difference sequence \(mZ=(z(1),z(2),\dots ,z(n-1))\), where z(k) follows the below expression.

$$z\left(k\right)=p^{(1)}\left(r_s,t_{k+1},ev\right)-p^{(1)}\left(r_s,t_k,ev\right),k=1,3,\dots,n-1.$$
(9)
  • Step 3. Calculate the estimated values of \(\widehat{v}\), \({\widehat{c}}_{1}\), \({\widehat{c}}_{2}\), and \({\widehat{c}}_{3}\) according to the following formulae.

$$\widehat v=aver(\sum\nolimits_{m=1}^{n-3}\sum\nolimits_{k=1}^{n-2-m}(\mathit{ln}(z\left(k+m+1\right)-z\left(k+1\right))-\text{ln}(z\left(k+m\right)-z\left(k\right)))),$$
(10)
$$mC={\left({mA}^{\mathrm{^{\prime}}}\cdot mA\right)}^{-1}\cdot m{A}^{\mathrm{^{\prime}}}\cdot {({mP}^{(1)})}^{\mathrm{^{\prime}}}$$
(11)

where aver is a function for calculating the average value, \(mC={\left(\begin{array}{ccc}{c}_{1}& {c}_{2}& {c}_{3}\end{array}\right)}^{\mathrm{^{\prime}}}\), and \(mA=\left(\begin{array}{ccc} e^{\hat{v}} & 1 & 1\\ e^{2\hat{v}} & 2 & 1\\ \vdots & \vdots & \vdots\\ e^{n\cdot \hat{v}} & n & 1\end{array}\right)\)  

  • Step 4. Calculate the estimated value of p,(1)(rstk,ev) by using the following prediction model.

$$p^{(1)}\left(r_s,t_k,ev\right)={\widehat c}_1{\cdot e}^{\widehat vk}+{\widehat c}_2\cdot k+{\widehat c}_3,k=2,\cdots,n+1.$$
(12)
  • Step 5. Restore the results of step 4.

$$\widehat p^{\left(0\right)}\left(r_s,t_{k+1},ev\right)=\widehat p^{\left(1\right)}\left(r_s,t_{k+1},ev\right)-\widehat p^{\left(1\right)}\left(r_s,t_k,ev\right),k=1,2,\cdots n,$$
(13)

where \({\widehat{p}}^{\left(0\right)}\left({r}_{s},{t}_{k+1},ev\right)\) is the predicted priority of ev regarding \({r}_{s}{\prime}\).

Algorithm for processing request messages

The priority adjustment of edge node is accompanied by the processing of user request messages by the edge node. According to the discussions of priority predicting, the process of request message processing algorithm based on a grey system prediction model includes the following essential steps. When receiving a user request message, the edge node updates the values of these metrics: message activity, user request probability, and query distance. If the request is a new request, it is necessary to predict the priority of the edge node regarding this request. Finally, the edge node refreshes the user request message and recalculates the priority corresponding to each request. The details can be found in Algorithm 1.

Lines 3-6 are the setting of measurements and the return of results to users when the edge node detect user request messages; lines 7-8 are the forwarding of request messages; lines 9-12 predict the priority of the edge node when dealing with new request messages; The 13th line recalculates the priority of the edge node after changes in these measurements.

figure a

Algorithm 1. Request message processing

In Algorithm 1, the edge node ev maintains operations on its content based on a content block statistics table, which consists of user request messages, sensor data messages, and three metrics related to optimization goals. The statistics table is an important data structure that supports the selection of target nodes. Assume the length of the statistical table is m, and the number of sensors related to the content is l. Let Creq,s denote a set of all content blocks with the same sensor identifier s as that of req, where the timestamps in the set are earlier than req. Let |Creq,s|= n. For the maintenance operation of the statistical table, the time complexity analysis is as follows. There are only two procedures, i.e., as GreyPre and priorityculating, involved in operating the statistical table. GreyPre includes the steps such as traversing Creq,s, sorting Creq,s in chronological order, and calculating according to formulas (8, 9, 10, 11, 12 and 13). The time complexity of GreyPre is O(nlog2n). Similarly, priorityculating the time complexity of GreyPre is \(\text{O}\left(m+l\cdot n\cdot{log}_2n\right)\). In conclusion, the time complexity of Algorithm 1 is O(mlog2n).

MCMF graph

Construction of MCMF graph

We mainly consider the performance parameters such as reducing network traffic, shortening user access latency, and improving the utilization of edge nodes. This section discusses the question that how to characterize the above parameters from a resource perspective and how to convert them into the assignment problem of graph capacity and cost.

For a given graph G = (V, DE, CA, CO), among them, V is a node set that represents entities in PEC, including the sensor S, the edge node EV, the user U, and the terminal node TV; DE is a directed edge set, which indicates whether a data forwarding task can be mapped to a corresponding entity; CA denotes a set of capacities on edge, identifying the entity’s supply capacity; CO is a cost set that represents the mapping effect between sensor data forwarding tasks and entities.

Definition 1

For G, \(\exists s\in S\bigwedge {\exists v}_{i},{v}_{j}\in V\bigwedge {(v}_{i},{v}_{j})\in DE\), to analyze the flow in PEC, we let \(out(s,{v}_{i},{v}_{j})\) denote the flow of the edge < vi,vj > with respect to s, which can be calculated as follows.

  • If \({v}_{i}\in EV,(s,{v}_{i})\in DE\), then \(out\left({r}_{s},s,{v}_{i}\right)=0\),

  • If \({v}_{i},{v}_{j}\in EV\), then \(out\left({r}_{s},{v}_{i},{v}_{j}\right)=1\),

  • If \({v}_{i}\in EV,{v}_{j}\in U\), then \(out\left({r}_{s},{v}_{i},{v}_{j}\right)=0\),

  • If \({v}_{i}\in U,{v}_{j}\in TV\), then \(out\left({r}_{s},{v}_{i},{v}_{j}\right)=0\).

Similarly, the flows of < vi,vj > and G are expressed as \(out\left({v}_{i},{v}_{j}\right)=\sum_{s\in S}out({r}_{s},{v}_{i},{v}_{j})\) and \(out\left(G\right)=\sum_{{(v}_{i},{v}_{j})\in DE}out({r}_{s},{v}_{i},{v}_{j})\), respectively.

Definition 2

For G, \(\exists s\in S\bigwedge {\exists v}_{i},{v}_{j}\in V\bigwedge {(v}_{i},{v}_{j})\in DE\), the cost of the edge < vi,vj > with respect to s, i.e. \(co(s,{v}_{i},{v}_{j})\), can be calculated as follows.

  • If \({v}_{i}\in EV,<s,{v}_{i}>\in DE\), then \(co\left({r}_{s},s,{v}_{i}\right)=0\),

  • If \({v}_{i},{v}_{j}\in EV\), then \(co\left(r_s,v_i,v_j\right)=w(v_j)\cdot\frac1{p\left(r_s,ev\right)}\). The cost of forwarding data from vi to vj is related to \(p\left({r}_{s},t,{v}_{j}\right)\) and \(w({v}_{j})\), in the paper, it is specifically expressed as \(w(v_j)\cdot\frac1{p\left(r_s,ev\right)}\),

  • If \({v}_{i}\in EV,{v}_{j}\in U\), then \(co\left({r}_{s},{v}_{i},{v}_{j}\right)=0\),

  • If \({v}_{i}\in U,{v}_{j}\in TV\), then \(co\left({r}_{s},{v}_{i},{v}_{j}\right)=0\).

In the same way, \(co\left({v}_{i},{v}_{j}\right)=\sum_{s\in S}co({r}_{s},{v}_{i},{v}_{j})\) and \(co\left(G\right)=\sum_{{(v}_{i},{v}_{j})\in DE}co\left({v}_{i},{v}_{j}\right)\) are the costs of < vi,vj > and G.

Definition 3

For G, \({\exists v}_{i},{v}_{j}\in V\bigwedge {(v}_{i},{v}_{j})\in DE\), then \(ca\left({v}_{i},{v}_{j}\right)\) represents the capacity of the edge < vi,vj > , which can be obtained by the following expressions.

  • If \(\exists s\in S\bigwedge {\exists v}_{i}\in EV\bigwedge (s,ev)\in DE\), then \(ca\left(s,{v}_{i}\right)=\infty\),

  • If \({ev}_{i},e{v}_{j}\in EV\), then \(ca\left({ev}_i,ev_j\right)=min(w({ev}_i)\cdot\sum_{\begin{array}{c}u\in U\\s\in S\end{array}}delay\left(u,s,{ev}_i\right),w({ev}_i)\cdot\sum_{\begin{array}{c}u\in U\\s\in S\end{array}}delay\left(u,s,{ev}_i\right))\),

  • If \({v}_{i}\in U\bigwedge {v}_{j}\in TV\), then \(ca\left({r}_{s},{v}_{i},{v}_{j}\right)=0\).

Solution of MCMF graph

  • (1) Formal description of problem solving

In this paper, one of our purposes is improving the overall performance of PEC. So we formulate the MCMF problem for graph G as follows.

$$\text{min}\sum\nolimits_{{(v}_i,v_j)\in DE}out\left(v_i,v_j\right)\cdot co\left(v_i,v_j\right),$$
(14)
$${\varvec{s}}.{\varvec{t}}.\mathrm{ C}1: {\sum }_{{(v}_{i},{v}_{j})\in DE}f\left({(v}_{i},{v}_{j}\right)-{\sum }_{({v}_{j},{v}_{i})\in DE}f\left({v}_{j},{v}_{i}\right)=b\left({v}_{j}\right),$$
(15)
$$\text{C}2:0\leq out\left(v_i,v_j\right)\cdot co\left(v_i,v_j\right)\leq ca\left(v_i,v_j\right),\forall\left(v_i,v_j\right)\in DE.$$
(16)

As mentioned above, the node that satisfies the condition b(vj) > 0, and b(vj) < 0 is called a source node, and an aggregation node, respectively; the flow that satisfies \({\sum }_{v\in EV}b\left(v\right)=0\) is called a feasible flow. Under the premise of satisfying formulae (14, 15 and 16), we maintain the minimum cost, and iteratively search for the maximum flow until the optimization conditions are met.

In a PEC environment, there will be certain changes in PEC, such as the number of user requests, the access costs, the load capacity of edge nodes and the number of edge nodes. However, the structural changes in the graph associated with PEC are relatively small within every two adjacent time periods. Therefore, we propose an incremental MCMF algorithm based on BP. By caching and reusing the last solution, only local operations are required to obtain the global optimal solution of the graph.

  • (2) Algorithm for solving MCMF graph

BP algorithm is message-transmission algorithm based on factor graph model. By updating the information of nodes, BP algorithm updates the state of an entire network until the network stabilizes. The efficiency of message transmission plays a crucial role in BP algorithm. This section discusses the incremental MCMF algorithm based on BP, which reduces the network and computational costs and supports dynamic deployment by only sending the changed messages.

In a factor graph, there are two types of nodes: variable node xi and constraint node f(a). Correspondingly, there are two types of messages on undirected edge (i,α) at time t, namely message m(i,a,xi,t) sent by xi to f(a), and message g(a,i,xi,t) sent by f(a) to xi. The message description based on increment is as follows.

$$\Delta m(i,a,x_i,t)=\sum\nolimits_{k\in N(i)\backslash a}\Delta m(k,i,x_i,t-1),$$
(17)
$$m(i,a,x_i,t)=m(i,a,x_i,t-1)+\Delta m\left(i,a,x_i,t\right),$$
(18)
$$\Delta g(a,i,x_j,t)=\sum\nolimits_{j\in N\left(a\right)\backslash i}\Delta m\left(j,a,x_j,t\right),$$
(19)
$$g(a,i,x_j,t)=g(a,i,x_j,t-1)+\Delta g(a,i,x_j,t),$$
(20)

where \(k\in N(i)\backslash a\) denotes the set of constraint nodes connected to xi except for f(a), \(j\in N\left(a\right)\backslash i\) denotes the set of variable nodes connected to f(a) except for xi, and let \(\Delta m(i,a,{x}_{i},0)=0,\Delta m(k,i,{x}_{i},0)=m(k,i,{x}_{i},0)\),\(g(a,i,{x}_{j},0)=0\).

For graph G, f denotes its minimum cost flow, and graph G’ = (V’, DE’, CA’, CO’) denotes the graph after its local changes. By further optimizing the minimum cost flow f, the incremental minimum cost flow algorithm obtains the minimum cost flow f 'of graph G' according to the factor graph increments and the message increments. The details can be found in Algorithm 2.

Lines 2-3 generate the factor graphs and the minimum cost flow for the initial graph G; lines 4-8 detect the state change events, update the graph structure when events occur, and solve the updated graph; lines 11-27 are the main body of the incremental minimum cost flow algorithm based on belief propagation, with the main idea of calculating the minimum cost eigenvalues while ensuring the maximum flow constraint; lines 30-35 are incremental iteration operations, which specifically include the calculation of the factor graph increments and the message increments.

figure b

Algorithm 2. Incremental MCMF based on BP

For BP algorithm, the schedule for updating messages is crucial to its convergence. In Algorithm 2, we address the question of how to schedule messages for asynchronous propagation to attempt to reach convergence. Procedure IncrementalMsgUpdating leverages a scheduling scheme that selects all incremental messages to update at a time. Additionally, an incremental update approach is introduced to accelerate the computation of message in Procedure BasicBPMCF.

Simulation and performance analysis

Experimental settings

PeerSim [31] is an event simulator for large-scale distributed systems that supports P2P network architecture. To evaluate the performance of the proposed adaptive routing strategy, we conducted relevant simulation experiments on PeerSim.

The experiment use a cube-connected cycle graph [32] with 4*24 = 64 nodes as the network topology structure. Each node in the graph denotes an edge node. Given that each edge node is connected to 10 sensors and 10 users, there are a total of 640 different sensors and 640 different users in the network. Each edge node can provide data generated by the connected sensor nodes to users, and the farthest location for a request message to receive a response is at the edge node connected to the corresponding sensor node.

The experimental parameters are set as follows. The bandwidth and latency between adjacent edge nodes are 1 Mb/second and 1 ms, respectively. A sensor generates a new message with a size of 10 MB every 1 s. The probability of users requesting different sensor messages is the same. And the probability of users requesting messages generated by the same sensor at different times follows Zipf distribution, where let \(C=\mathrm{1,0.8}\le \alpha \le 1.5\). Each user randomly requests 20 different sensor messages at the rate of 1 request/second. Each edge node caches 2048 sensor messages and can accommodate 500 request messages. In each experiment, we take 5 samples with an interval of 60 s between each sampling. A total of 10 experiments were conducted, and the results were averaged.

According to the above settings, the total number of user request messages during the 5 sampling periods is tnr = 192000.

Performance metrics

By analyzing the formula (1, 2 and 3) involved in the optimization goals of the adaptive routing model, we can conclude that load(u,s) and delay(u,s,ev) are key factors that affect the performance of the system model. To evaluate the performance of different routing schemes, the following two performance evaluation metrics based on load(u,s) and delay(u,s,ev) are considered.

  • Average access latency, \(adelay=\frac1{tnr}\cdot\sum_{t\in T}delay\left(u,s,ev\right)\), which denotes the average delay spent from an user sending a request to receiving the corresponding sensor message.

  • Average edge node load, \(aload=\frac1{tnr}\cdot\sum\nolimits_{t\in T}load\left(u,s\right)\), which denotes the average number of times that edge nodes directly connected to sensors provide services to users.

Based on these indicators, we can analyze both the efficiency of caching services provided by target edge nodes in ARPEC and the effectiveness of target edge nodes in alleviating service pressure on edge nodes directly connected to sensors.

Performance testing & analysis

  • (1) Performance of request message processing algorithm

We adjust Zipf probability parameter α of request message to examine the performance trend of the request message processing algorithm. Because LCE, LCD, and Prob0.5 are three typical target node selection strategies that range from simple to complex, we compare the performance of ARPEC with that of LCE, LCD, and Prob0.5. The performance changes are shown in Fig. 3.

Fig. 3
figure 3

Performance changes with α under different strategies. a Average access latency. b Average edge node load

Figure 3a and b show that there are certain differences of the strategies and ARPEC outperforms these compared strategies in the two metrics. This is because user’s requests for high-priority edge nodes become more frequent as the parameter α increases. Due to the lack of sensitivity of LCE, LCD, and Prob0.5 to changes in message activity and user's requests, performance improvement is limited. As message activity increases, sensor messages in edge nodes become more concentrated. By increasing the priority of the corresponding edge nodes, ARPEC can cache sensor messages on the reasonable edge nodes.

  • (2) Performance of incremental MCMF algorithm

The experimental parameters are set as follows. First, by assigning a value greater than 1 to a, it indicates that users are more concerned about several sensors. On the contrary, the distribution of user requests is relatively uniform. So α reflects user’s preference for sensor requests. Without loss of generality, let α = 1. Second, in each sampling period, the number of nodes with changes is less than 12; and the change pattern of nodes follows a uniform distribution. In Fig. 4, the trends of the incremental BP-based MCMF algorithm in terms of performance measurements are examined by adjusting the number of changing nodes, and the results are compared with the BasicBPMCF algorithm.

Fig. 4
figure 4

Performance changes under different strategies. a Average access latency. b Average edge node load

The average access latency difference between the two strategies shown in Fig. 4a is not significant, which indicates that the solution results of the two strategies are basically consistent. However, as shown in Fig. 4b, the efficiency of the incremental MCMF algorithm has been greatly improved, with an edge node load of approximately 50% of that of BasicBPMCF. This indicates that the incremental MCMF algorithm reduces network costs. This is because the incremental MCMF algorithm saves time in solving the maximum flow. Meanwhile, because the data in the network does not change much, the MCMF in the previous stage may already be very close to the optimal flow in this stage, and only a small amount of incremental information needs to be processed to achieve the optimal feasible flow.

Analysis of ARPEC application scenarios

ARPEC uses a grey model to predict the priority of edge nodes. For cases where priority data samples change rapidly, the sample quality may not be particularly good and the response speed may not meet user requirements. We can improve sample quality by adjusting the length of the priority sequence. However, due to the unpredictable statistical characteristics of the incoming user requests and sensor data, GreyPre may adjust the sample length multiple times and results in higher latency. Therefore, ARPEC is not suitable for applications with significant instantaneous changes in IoT and high requirements for real-time computing.

The requirements for updating node information in ARPEC should be met. Users can set the frequency of updating node information. If the frequency is higher, the number of adjustments to the minimum cost flow will increase. Due to the limited resources of edge nodes, in the worst case, the adjustment of the minimum cost flow still cannot meet the user's requirements for network traffic. So, it is considered that ARPEC cannot provide support for MCMF at the given frequency of updating node information.

Conclusion

In this paper, we propose an adaptive routing strategy in PEC, which can adapt to the temporal dynamic characteristics of routing demands and supports dynamic deployment. In order to improve the user experience and give full play to the overall performance of Edge Cloud, a routing optimization model is described from the perspectives of network traffic, user access delay, and edge node resource utilization. We implement two algorithms, the processing request messages algorithm based on grey prediction model, and the incremental MCMF algorithm based on BP algorithm. The evaluation results show that ARPEC can effectively improve PEC transmission performance and user experience. In the future, our research will focus on the following two aspects: the optimization technology of target node parameters based on machine learning, and the merging and filtering mechanisms to reduce the complexity of solving graph.