{'fraction_non_alphanumeric': 0.036769194646630664, 'fraction_numerical': 0.006057760037567504, 'mean_word_length': 4.789180372434417, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
EdgeMatrix: A Resources Redefined Edge-Cloud System for Prioritized Services

The edge-cloud system has the potential to combine the advantages of heterogeneous devices and truly realize ubiquitous computing. However, for service providers to guarantee the Service-Level-Agreement (SLA) priorities, the complex networked environment brings inherent challenges such as multi-resource heterogeneity, resource competition, and networked system dynamics. In this paper, we design a framework for the edge-cloud system, namely EdgeMatrix, to maximize the throughput while guaranteeing various SLA priorities. First, EdgeMatrix introduces Networked Multi-agent Actor-Critic (NMAC) algorithm to redefine physical resources as logically isolated resource combinations, i.e., resource cells. Then, we use a clustering algorithm to group the cells with similar characteristics into various sets, i.e., resource channels, for different channels can offer different SLA guarantees. Besides, we design a multi-task mechanism to solve the problem of joint service orchestration and request dispatch (JSORD) among edge-cloud clusters, significantly reducing the runtime than traditional methods. To ensure stability, EdgeMatrix adopts a two-time-scale framework, i.e., coordinating resources and services at the large time scale and dispatching requests at the small time scale. The real trace-based experimental results verify that EdgeMatrix can improve system throughput in complex networked environments, reduce SLA violations, and significantly reduce the runtime than traditional methods.


I. INTRODUCTION A. Background and Problem Statement
With the explosion of networked devices, centralized mobile network architecture is facing many challenges. According to the GSMA's The Mobile Economy 2020 report, IoT connections will reach almost 25 billion globally by 2025, up from 12 billion in 2019 [1]. As a result, the traditional cloud computing paradigm is hard to cope with:(i) a large number of computing tasks generated by the massive networked devices are delivered to the cloud center, which brings a severe challenge to cloud computing capability; (ii) the long transmission distance between the networked devices and the cloud center, which is difficult to meet the requirements of low latency services, e.g., automated driving.
To address the above issues, the emergence of edge computing [2] has the potential to guide the development of next-generation network architecture. Compared with cloud computing, the advantages of edge computing are mainly shown in two aspects: (i) widely distributed edge computing nodes can handle a large number of computing tasks, relieving the pressure on the backbone network; (ii) most services are processed near the edge, reducing the data transmission delay, and only services that cannot be processed at the edge will be uploaded to the cloud center.
Therefore, edge computing can effectively solve many problems such as low real-time and work inefficiency in traditional cloud computing. Simultaneously, cloud computing can provide great computing power and massive storage for distributed edge computing nodes. The complementary characteristics of edge computing and cloud computing accelerate the deep collaboration between each other and gradually evolve into edge-cloud system [3]. Unlike the one-fits-all cloud computing paradigm, the widely distributed edge nodes and mutually heterogeneous edge clusters in the edge-cloud system bring significant opportunities and also challenges to provide users reliable service [4].

B. Motivation and Challenges
In the cloud computing paradigm, service providers can provide reliable services to users based on Service-Level-Agreement (SLA) [5]. In this paper, we propose EdgeMatrix that can provide strong SLA assurance for various user services in the complex networked environment of the edge-cloud system based on the idea of SLA in cloud computing.
Although providing reliable service for users based on SLAs in edge-cloud systems can significantly improve system efficiency, three inherent challenges still need to be faced in the specific implementation process. (i) Multi-resource heterogeneity: Geographically distributed edge nodes have different computing capabilities, communication capabilities and system architectures; (ii) Resource competition: Different types of services have various resource requirements, which causes resource competition among different services and thus affects the service efficiency of requests; (iii) Networked system dynamics: Due to the random fluctuations in user demand and networked devices, the request load and available resources of the networked system are in a constant dynamic change. Therefore, there is an urgent need for the resourceredefined architecture to satisfy the SLAs of users under the inherent challenges orient to edge-cloud systems.

C. Technical Challenges and Solutions
In this paper, to better cope with the three inherent challenges in the edge-cloud system, our work focuses on resource customization, service orchestration, and request dispatch.
Resource customization. The multi-resource heterogeneity of the networked system poses a severe problem for providing users reliable service in edge-cloud systems because heterogeneous edge nodes increase the uncertainty of service orchestration and request dispatch. It is challenging to design traditional methods to consider the massive heterogeneous nodes in the system, i.e., a large number of constraints may cause algorithms complicated and even unsolvable [6]. Therefore, we introduce multi-agent deep reinforcement learning (MADRL) algorithms to provide customized isolated resources for various user services in the edge-cloud system. Specially, we customize the resources of edge-edge nodes (Horizontal) and edge-cloud nodes (Vertical) to form logically isolated resource combinations called resource cells in edge-cloud systems. Biologically, cells at different locations have different functions, and each cell has an isolated space. We further call the set of cells with similar characteristics (resources, latency, etc.) a resource channel, which means that each resource channel has its corresponding SLA priority. Macroscopically, resource channels can also be divided into two categories, i.e., horizontal or vertical. As shown in Fig. 1, we call this framework EdgeMatrix.
Service orchestration. Resource competition among services can lead to a decrease in the number of requests that are successfully served in the system without violating SLA priority, i.e., a reduction in throughput [7]. Imagine a scenario where one service takes up most of the memory resources on a node, under which orchestration of other services is severely adversely affected, even if they require merely a few memory resources. Therefore, we should orchestrate the services reasonably by EdgeMatrix to reduce the negative impact of resource competition.
Request dispatch. The dynamic of networked systems poses a significant challenge for the adaptability of dispatch algorithms [8]. Request dispatch is the last link to determine whether requests can be successfully served. The design of the request dispatch algorithm plays a crucial role in system robustness in the face of networked system dynamics. Specifically, to ensure the system's stability, we adopt a twotime-scale framework, which performs resource customization and service orchestration sequentially at the large time scale (frame) and requests dispatch at the small time scale (slot).

D. Main Contributions
• We design EdgeMatrix to redefine heterogeneous physical resources as isolated resources (i.e., resource customization) and solve the problem of joint service orchestration and request dispatch (JSORD). • We propose a Networked Multi-agent Actor-Critic (NMAC) algorithm for resource customization with limited neighbor nodes, which provides lightweight models and improves the system's stability through offline centralized training and online distributed execution. • We solve the JSORD with multiple types of resources in EdgeMatrix based on mixed-integer linear programming (MILP), and significantly reduces the runtime of the solution by running a multi-task mechanism in parallel. • We design a two-time-scale framework for EdgeMatrix to coordinate each component, performing resource customization and service orchestration in each frame and request dispatch in each slot as shown in Fig. 2, which outperforms other schemes by real trace-based evaluation.

II. SYSTEM MODEL AND PROBLEM STATEMENT
A. Edge-cloud System As shown in Fig. 1, the edge-cloud system is composed of the network edge and the cloud center. At the edge of the network, there exist massive heterogeneous edge computing nodes, and adjacent nodes in certain regions D = {1, ..., D} together form edge clusters to provide closer resources for users. The cloud center has sufficient resources, but the centralized deployment approach results in being geographically far from the users. In addition, the edge clusters in each region connect to the cloud center through Wide Area Network (WAN). To be more concise, we (i) only focus on one region d ∈ D at the edge of the network, it also applies to other regions d ∈ D, (ii) each edge node can only be connected to a limited number of other nodes, and (iii) assume that each node in the edge cluster has decision-making ability. Network edge. Geographically dispersed users generate diverse arriving requests over time that have different SLA priorities P = {1, ..., P }, and each SLA p ∈ P has a service set L p = {1, ..., L p }. All services with different SLA priority are denoted by L = L 1 ∪ L 2 ∪ ... ∪ L P . For service l ∈ L p , we denote the request packet size of each service l as h p,l , memory required to load the service l as r p,l , the required computing capacity of service l as w p,l , the maximum response time of services with p (the lifecycle of service) as t p,l , and the execution time of services with p as o p,l . We denote the network topology of the edge cluster in region d as a graph G d (V, E), where each i ∈ V is the edge node, and e ij ∈ E is the link directly connected between node i and node j. N i = {j | j ∈ V, e ij ∈ E} represents the neighborhood where the node i is located, that is, the set of i and its adjacent nodes. The number of edge nodes in cluster G d is denoted as N . Each edge node i has resource capability, we denote the computing capacity as W i , the total memory as R i , the total bandwidth as B i .
Cloud center. The cloud center has sufficient computing and memory resources, but the centralized deployment approach results in a long geographic distance from most users. Therefore, the cloud center is better at handling requests that require a large amount of computing or memory resources but are not latency-sensitive, such as model training. We denote the computing capacity owned by the cloud center as W cloud , the memory as R cloud .
Resource cells and channels. EdgeMatrix fully collaborates with the advantages of the computing resources between the cloud center and the network edge, customizes a series of resource cells in the edge-cloud system across edge-edge nodes (Horizontal) and edge-cloud nodes (Vertical). Resource cells have a mapping relationship with physical resources in the edge-cloud system, and resource cells are logically isolated with no mutual interference. In addition, we assign corresponding services to the resource cell according to its characteristics (e.g., location, resources). Furthermore, we group resource cells with similar characteristics into one resource channel. The customized services for users with different SLA priorities are exhibited in the resource channels, which means a channel provides users with a corresponding SLA priority, as shown in Fig. 3. Therefore, we can treat the channels and SLA of services as equivalent to P = {1, ..., P }.
On each channel p ∈ P, we deploy customized resource cells M p = {1, ..., m p } for users according to the SLA of services arriving in the edge cluster. For cell m ∈ M p , we denote its computing capacity as W p,m , and memory size as R p,m .

B. Problem Statement
The objective of EdgeMatrix is to maximize the overall throughput while reducing SLA violations for various services. To ensure the robustness of EdgeMatrix, we adopt a two-timescale framework in the edge-cloud system to realize resource customization, service orchestration and request dispatch.
At the large time scale, frame τ , EdgeMatrix performs two steps to guarantee the SLA priorities of different user services: (i) resource customization, which customizes the resources in the edge-cloud system into resource cells according to the states of the system based on MADRL algorithm, and groups cells with similar characteristics into one resource channel using a clustering algorithm; (ii) service orchestration, which allocates the cell resources to service replicas and then binds the service replicas with allocated physical resources.
At the small time scale, slot t, EdgeMatrix performs request dispatch to adapt the networked system dynamics. In EdgeMatrix, we implement these three steps by resource customizer, service orchestrator and request dispatcher.
Resource customizer. The workflow of resource customizer is as shown in Fig. 4. We deploy a resource customizer agent for every node i in the edge cluster. At frame τ , all of the agents need to calculate new resource cell's resource requirements through the observed local state and learned resource customized policy π i,τ , denote by M τ = {m 1,τ , ..., m i,τ , ..., m N,τ }. For m i,τ ∈ M τ , we denote the memory requirement as R mi,τ and the computing requirement as W mi,τ . Note that, M is different from M temporarily, each m i,τ ∈ M τ only represents predicted resource requirements at this moment. The resource customizer first obtains the available resources from the neighborhood N i of the edge node i where the agent is located according to the requirements of the resources required by m i,τ . When the available resources in the neighborhood can meet the requirements of m i,τ , we call it a horizontal resource cell. Resource Customizer will obtain the rest resources if needed from the cloud center, namely the vertical resource cell.
After resource customizer finishes customizing the physical resources in the edge-cloud system into resource cells based on the MADRL algorithm, it has to cluster the resource cells to corresponding resource channels. First, the resource customizer abstracts the characteristics from each cell, and then it uses a clustering algorithm to group the resource cells with similar characteristics to one resource channel. Finally, SLA priorities are defined for each channel to provide services to users with a corresponding service level. Horizontal resource cells have lower transmission latency but limited resources, while vertical resource cells have sufficient resources but higher transmission latency. We then group the cells with similar characteristics into the same channel, and the characteristics of resource cells in EdgeMatrix is denoted by where w i,τ and r i,τ are normalized CPU and memory resources, and u i,τ is the edge resources proportion. This article mainly focuses on the two resources of CPU and memory because the datasets [9] we are using are computationally intensive services. Note that the larger value of u i,τ means the lower latency of m i,τ , and the latency is one of the essential factors affecting SLA priority, so we add the consideration of the weighting factor ε to u i,τ . The larger the value of each item in ϕ i,τ , the better the performance of corresponding item will be in the resource cell m i,τ . We group the cells m i,τ ∈ M τ based on Φ τ into resource channels p ∈ P with corresponding SLA priority using clustering algorithm, i.e., M τ ⇒ M P . The SLA priority of each channel is denoted by where m p is the central point of channel p, and SLA priority is proportional to the performance of the resource cell.
Service orchestrator. To make full use of the resources customized by resource customizer, the service orchestrator needs to appropriately orchestrate service replicas at resource cells on each resource channel. On resource channel p ∈ P, orchestrating a service replica l p to the cell m p , can be denoted as (l, m). We can define all orchestration sets as S ⊆ L p ×M p , and describe each single service orchestration as selecting an element from the set. So we can transform the service orchestration problem into set optimization. Note that service orchestration significantly influences request dispatch, and we will explain the relationship between them in the following.
Request dispatcher. After the resource customization and service orchestration is completed, request dispatcher will dispatch the requests that reach the nodes to the resource cells with matching service replicas at the small time scale, slot t, as shown in Fig. 5. The number of requests from users for service l ∈ L p arrived at node i at slot t is λ t p,l,i , and the average number of requests for a frame τ is denoted by λ τ p,l,i . To achieve the objective of EdgeMatrix, we have made the following efforts: (i) the policy learned by the resource customizer reduces SLA violations for various user services (detailed in Sec. III-A); (ii) moreover, we jointly consider service orchestration and request dispatch to maximize the overall throughput of the system (i.e., JSORD); and model them together as a mathematical problem because of their strong correlation (a brief introduction in the following, and more details in the Sec. III-B).
Since each channel in P is similar in terms of handling JSORD, for clarity, one channel p ∈ P is used to introduce EdgeMatrix in the following discussion. We first set up two decision variables x and y, where x is the service orchestration variable and y is the request dispatch variable. More specifically, x τ p,l,m ∈ {0, 1} is 1 if service l is orchestrated on cell m in frame τ and 0 otherwise, y t p,l,i,m ∈ [0, 1] represents the probability that a request of service l arrived at edge node i is dispatched to cell m at slot t. For frame τ , we define y as We formulate the JSROD as Eq. (1): The object of (1a) is to maximize the number of each channel served requests, Ψ p = l∈Lp i∈V λ p,l,i m∈Mp y p,l,i,m , which equivalent to the system overall throughput because the joint optimization among channels is mutually independent. Constraint (1b) guarantees the request dispatch variable is available. Constraints (1c) and (1d) ensure that each cell's memory and computing capacity can offer the resources required by orchestrated service replicas. Constraint (1e) ensures that y is valid if and only when the service l is orchestrated and won't trigger the SLA, where I t c,l −o c,l −ti,m>0 is the indicator function, indicates the SLA priority for the requests, and t i,m is the transmission latency between node i and cell m. Constraint (1f) is the available range of values.

A. MADRL for Resource Customization
The resource customizer agent deployed on each node can calculate new resource cells' resource requirements for Edge-Matrix based on local state and learned policy. Its objective is to provide customized resource cells for user services with different SLA priority under (i) multi-resource heterogeneous edge nodes and (ii) dynamically changing service requests, which reduces SLA violations for various user services.
With the development of artificial intelligence, especially reinforcement learning (RL) [10] represented by DQN [11], DDPG [12] and A3C [13], game control and robot control are well performed by RL. Due to the large number of computational nodes distributed in the edge-cloud system, the direct implementation of these algorithms will cause a highdimensional action space or non-stationary environment [14], [15]. Therefore, we introduce the MADRL algorithm to enable each decision-capable edge node in the system to customize the resources in its network neighborhood into resource cells based on the changing system state. To learn practical resource customization policies in complex networked environments, we must consider (i) the impact of algorithm training on the robustness of the networked system, (ii) the unsuitability for edge nodes with limited computational power to deploy large models, and (iii) the high-dimensional action space in the decision making of the networked system. Therefore, we adopt an algorithmic framework of offline centralized training and online distributed execution with a continuous action space.
1) Markov Game Formulation: Since the edge cluster of each region d ∈ D in EdgeMatrix is a graph G d , a multiagent Markov Decision Process (MDP) can be formed as . We denote the resource customizer agent on each edge node as i ∈ V. More details are introduced according to ρ in the following.
State spaceŜ. At frame τ , the local state space observed by the agent on edge node i isŝ i,τ , which contains: (i) the number and kinds of requests (λ τ 1,1,i , ..., λ τ p,l,i ) p∈P,l∈Lp ; (ii) the resource requirements and delay demand of requests arrived at node i; (iii) the CPU, memory and edge resources proportion of the existing cells created by agent i in the system; (iv) the available resources of edge nodes where agent i is located, N i . We simply consider the global observation for the training critic as the ensembles of all agents' state,ŝ τ .
Action spaceÂ. We define the action space of all agents in the edge cluster as a joint action spaceÂ = {Â 1 , ...,Â i , ...,Â N } i∈V , whereÂ i ∈Â represents the action space of agent i. At frame τ , agent i predict the actionâ i,τ according to the observed local state spaceŝ i,τ and policy π i,τ . Specifically,â i,τ indicates the size of the resource that the agent i predicts allocate to cell m i,τ , i.e., (W mi,τ , R mi,τ ), where both of them are continuous variables with a value range of [0, 1]. The actual resource size is (α · W mi,τ , β · R mi,τ ), where α and β are the upper limits of the cell's resources.
Reward functionR. Agent i inputs the observed local state spaceŝ i,τ and selected actionâ i,τ at frame τ into the reward functionR to get an immediate rewardr i,τ . To learn how to improve the overall throughput of the system while reducing SLA violations for various user services, we comprehensively consider service throughput and SLA priority to help the agent learn this ability in an environment where multi-agents coordinate with each other. The reward function can be formulated asr i,τ = p∈P δ p l∈Lp Ψ l,i,τ , where  Fig. 6. Networked multi-agent actor-critic.
Ψ l,i,τ = Ψ l,i,τ /λ τ p,l,i is the throughput rate of service l arrived at node i at τ . δ p indicates the weight of the services with SLA priority p, and we verified the necessity of this setting by adjusting ε in Sec. V-A.
2) Networked Multi-agent Actor-Critic: In the networked environment of the edge-cloud system, the main problems in designing the MADRL algorithm are: (i) we need to minimize the requirements of resources for agents' decision-making because the computing nodes at the edge of the network only have limited resources; (ii) reducing SLA violations is the aim of our work, so the training or execution process should not affect the stability and security of the networked system.
To better deal with the above problems, we proposed the Networked Multi-agent Actor-Critic (NMAC) algorithm in the multi-agent coordinate environment of edge-cloud system, as shown in Fig. 6, (i) centralized critic, which can guide each actor to learn an effective policy according to global observation with extra information during training; (ii) distributed actor, each actor's input during training and execution is local state, so the actor can seamlessly switch between the two phases. • Centralized critic. During the training process, we equip each agent with a critic to train the actor. For agent i, the critic is implemented based on the centralized actionvalue functionQ (ŝ τ ,â τ | θ πi ), which represents the expected discounted cumulated reward of frame τ starting from state-action pairs (ŝ τ ,â τ ) according to the policy π i ,â τ = (...,â i,τ , ...). The action-value function can be represent asQ . Thus, the centralized actionvalue function can be obtained from the Bellman Equation: where θ πi is the parameter of policy π i ∈ Π, Π = {π 1 , ..., π N }, and the optimization function can be derived as a loss function between actual critic networkQ i,τ and target critic networkĜ i,τ , • Distributed actor. For each agent, the actor network learns a  deterministic policy µ i to maximize the cumulative reward, i.e., J = E µi [R i,τ ]. We update the parameters θ µi through optimizing policy gradient: Especially, NMAC implements an offline training and online execution framework: (i) offline-training, can avoid that the training process may have a negative impact on the networked system stability; (ii) online-execution, only requires the actornetwork to predict the action and the learned policy only uses local state, which significantly reduces the resources consumed by the agent compared to the training phase.

B. Joint Service Orchestration and Request Dispacth
Since service orchestration significantly impacts request dispatch, we together consider them as a joint optimization problem, i.e., JSORD. Specifically, (i) at the large time scale, JSORD has to orchestrate the appropriate services for each cell in EdgeMatrix based on the system state, and (ii) at the small time scale, JSORD has to dispatch the requests arriving at each node of the system to resource cells. Considering the system with multiple types of constraints, (e.g., computation, memory, communication, and latency requirements), we solve JSORD based on MILP. However, the widely distributed edge nodes and the variety of services in the system make the runtime of the solution unacceptable for users.
In EdgeMatrix, each channel serves a specific class of services with the same SLA priority. The resources used during service orchestration and request dispatch are the cells of the channel, so the channels are independent of each other. Therefore, we execute JSORD independently in parallel on each channel, which significantly reduces the runtime.
We model the joint optimization problem of service orchestration and request dispatch as Eq. (1) at the end of section II. More specifically, (i) at the beginning of frame τ , we calculate the optimal service orchestration x τ p,l based on Eq. (1) by the predicted request dispatching probability y τ p,l,i,m and the request demand λ τ p,l,i ; (ii) then at the beginning of slot t, we calculate the request dispatch variable y t p,l,i,m with the current request demand λ t p,l,i and the orchestrated service x τ p,l to solve Eq. (1). At the large time scale, note that although the dispatch variable y τ p,l,i,m is predicted according to the demand λ τ p,l,i , y τ p,l,i,m is used to evaluate Eq. (1a) under the given orchestrated services x τ p,l rather than request dispatch. 1) Solvability Analysis: We first analyze the solvability of the joint optimization Eq. (1) and then consider the special case of Eq. (1), where the resource cell and the service are homogeneous, with constraints (1d) ignored: The joint optimization Eq. (1) can be simplified to the 2-Disjointed Set Cover Problem, i.e., Eq. (5), which is proved to be NP-complete [16]. The special case of the joint optimization, Eq. (1) is NP-hard, which means that the joint optimization problem of service orchestration and request dispatch is also NP-Hard in the general case.
To describe the solution process of Eq. (1) more clearly, we discuss the deformations of Eq. (1) and the solution processes at the two-time-scale framework in the following, i.e., service orchestration and request dispatch, as shown in Fig. 7.
2) Requst Dispatch: At slot t, the service orchestrator has already orchestrated the services on each resource cell, which means we solve the request dispatch problem under the situation that service orchestration variable x τ p,l is known. Thus, the joint Eq. (1) can be simplified to linear programming, i.e., Eq. (6), which means we can get the probability y t p,l,i,m when dispatching a request of service l arriving at the edge node i to cell m. 3) Approximation Algorithm for Service Orchestration: Service orchestration problem can be transformed to a set optimization problem in the Sec. II-B. On resource channel p ∈ P, orchestrating a service replica l p to the cell m p can be denoted as (l, m). We can define all orchestration sets as S ⊆ L p × M p , and each single service orchestration can be described as selecting an element from the set. Let Ω (S) denote the optimal objective value of Eq. (1) under a fixed set S of orchestrated services and a fixed dispatch variable x, (l, m) ∈ S if and only if x l,m = 1. This can be calculated by solving the request dispatch problem (see Eq. (6)), and then we can rewrite the problem as: s.t. l:(l,m)∈S In summary, the overall training and scheduling process of EdgeMatrix is given in Algorithm 2.

IV. IMPLEMENTATION A. Edge-cloud System Setup
Edge cluster and cloud center. In the simulation experiment, we set up 10 edge nodes and 6 SLA Allocation/Retention Priority (ARP) services [17] in the edge cluster of a region from the perspective of the service providers. Each property of the edge node i ∈ V is set to W i = [2,4] vCPUs, R i = [100, 200] GB and B i = {125, 12.5} Mbps. We assume that the computing capacity W cloud and memory capacity R cloud of cloud center are always sufficient, and the connection between the cloud center and the edge cluster is reliable, so the transmission delay from the edge node to the cloud center is set to a constant L cloud edge = 10ms. Resource cells and channels. By default, at each frame τ , the number of resource cells that each agent can maintain is p∈P m p,i ≥ 1. The requirements of each resource cell are predicted by the continuous actionâ i,τ = {W mi,τ , R mi,τ }. These two numbers are floats between [0, 1], and their true resource requirements are multiplied by the scalar in the system, i.e., (2 vCP U s, 500 M B). These resource cells are classified to the corresponding resource channels according to the cell characteristics Φ. There are [2,4] kinds of service on each channel, and the number of resource channels is 6.
Service and request. Our system's data value range and request distribution are based on the Alibaba Cluster Trace [9] to ensure EdgeMatrix has effective performance in the real environment. However, since the dataset does not reflect the delay characteristics, we refer to ETSI's white paper [17] to determine the delay data range of requests.
in which the activation function in the first two hidden layers is relu, and there is no activation function in the output layer. The actor policy network is also a three-layer FCNN with 64 neurons per layer, in which the activation function is relu in the first two layers, and the output layer is sigmoid to ensure that the output is in the valid range. The linear program solver in JSORD uses linprog function of the SciPy library.

V. PERFORMANCE EVALUATION
Under the objective of maximizing the overall throughput while reducing SLA violations for various services, we have verified the effectiveness of EdgeMatrix on the three challenges of multi-resource heterogeneity, resource competition, and networked system dynamics. More specifically, we consider three metrics: (i) the reward used to evaluate the comprehensive performance of EdgeMatrix when training the algorithm; (ii) to avoid system throughput Ψ → ∞, we use the overall throughput rate to verify the system performance; (iii) percentage of requests served by each channel to total requests in EdgeMatrix used to reflect EdgeMatrix's assurance of SLA priority. In our experiments, the baselines include (i) MADDPG, a general MADRL algorithm; (ii) MA2C, a stateof-art MADRL algorithm applied in the networked system.

A. Setting of Key Parameters
We gradually determine several essential parameters during training, as shown in Fig. 8. The frequency of service orchestration has a significant impact on the training performance of EdgeMatrix, i.e., frequent or occasional service orchestration cannot get better performance. (i) For frequent orchestration, the cell must reload replicas of the service at each service orchestration, making some requests time out during the waiting process; (ii) for occasional orchestration, the requests of the networked system are dynamically changing, and the services orchestrated in the system need to be appropriately adjusted. Therefore, we set 100 slots at each frame. The system performance will perform better as the number of cells maintained by each node increases. However, the node maintains cells requires additional resource costs, so we set the number of cells maintained by each node to 6. As one of the essential characters of SLA priority, the edge resources Overall throughput rate (%) 1 frame = 100 × slots 2 8 4 6 The number of cells maintained by each agent proportion determines the delay guarantee of cells. The large weight of the edge resources proportion causes the impact of core network resources negligible, so we set it as ε = 1.5.

B. Learning Ability of EdgeMatrix
To verify the learning performance of EdgeMatrix, we first compare the training performance of the other two baselines, proving that EdgeMatrix has the feasibility of convergence and has effective learning capabilities. Then we compare the performance of the algorithm EdgeMatrix, independent DQN [11], and independent PPO [18] to demonstrate the effectiveness of EdgeMatrix among 10 edge nodes.
As shown in Fig. 9(a), the three algorithms at the first 100 training episodes are in the exploration stage with random policy, i.e., they do not learn policies and only collect training data, and their rewards are at the same level. The rewards of EdgeMatrix and MADDPG begin to rise sharply after the 100th episode and maintain a flattened period. It is because the algorithm has learned some effects from the data collected in the first 100 episodes. However, the learning performance is flattening along with the state of the dynamic networked system. After the 1000th episode, both EdgeMatrix and MADDPG tend to converge. In particular, the performance of EdgeMatrix is improved by about 60%, but MADDPG captures almost no knowledge among the data. Moreover, there is no significant impact on the performance of MA2C, which also implies that the algorithm gains little benefit from training based on sample data. Fig. 9(b) demonstrates that a simple implementation of independent agent in the multi-agent environment is not excellent due to the non-stationary problem. Fig. 10 proves two sub-objectives of EdgeMatrix: (i) maximizing overall throughput; (ii) focusing on reducing SLA violations for various user services. We compare the overall throughput rates of different algorithms in Fig. 10(b) under the same request distribution (as shown in Fig. 10(a)) within a period and shows the proportion of service requests served by each channel to all service requests in Fig. 10(c). Specifically, the performance of EdgeMatrix under the same dynamic request distribution is 36.7% better than the closest baseline. In all six channels (1-6), the smaller the value of Channel Id, the higher the SLA priority that the channel can guarantee. Among them, the cells distributed on the channel with channel id (1-3) are all horizontal, which means that the orchestrated service has a high SLA priority and almost negligible transmission delay, and the channel with channel id is (4-6) have the vertical cells. Furthermore, under the weight of edge resources proportion set during our training process (i.e., ε = 1.5), the number of requests served by the horizontal channel accounted for 73.7% of the total number of requests. The number of requests served by the vertical channel is accounted for 26.3%. Note that the throughput rate of the different services can be adjusted by ε.

D. Performance in Complex Environment
To test the adaptability of EdgeMatrix in the edge-cloud system, we evaluated the performance of EdgeMatrix under the three inherent challenges: multi-resource heterogeneity, resource competition, and networked system dynamics.
EdgeMatrix under multi-resource heterogeneity. Fig. 11(a) shows the performance of EdgeMatrix under heterogeneous core network (i.e., compute and memory) resources owned by edge nodes. While keeping the total amount of each resource unchanged, we change the resource variance between edge nodes and divide the resource heterogeneity into five levels according to the variance, where the larger the value means the higher heterogeneity. We found that EdgeMatrix performs the best when the heterogeneous level of computing resources and memory resources are the same under the existing request distribution. There is a certain correspondence between requests for computing resources and memory resources. Even though the performance of EdgeMatrix will decrease as the heterogeneity of one resource increases, the performance of EdgeMatrix only drops 3.9% when the edge node resource heterogeneity is the strongest compared to the weakest case.
EdgeMatrix under resource competition. Resource demand has a significant impact on the throughput rate. The higher the load level of computing resources and memory resources, the more intense the competition for this type of resource. Fig. 11(b) shows that EdgeMatrix can adjust adaptively to the dynamic change of resource competition degree, and its ability to adjust the competition of memory resources is better than that of computing resources. EdgeMatrix benefits from the isolation ability of channels and the online learning ability of NMAC, which can sensitively perceive the load changes of various resources in the environment and adjust the policy, thus maintain efficient resource customization ability. EdgeMatrix under networked system dynamics. The bandwidth resource can affect the stability of the networked system. The heterogeneity level of bandwidth is the same as the previous. The larger the average network bandwidth (1)(2)(3)(4)(5), includes larger the average bandwidth. Fig. 11(c) shows that the larger the total bandwidth, the higher the service throughput rate.
The system throughput will decrease as the heterogeneity of bandwidth resources between nodes increases. The larger the average bandwidth resource, the smaller the impact of heterogeneity changes. EdgeMatrix's resource customization has played a positive role, which means whether the resources of edge nodes are large or small, EdgeMatrix can cover them.

E. Runtime Cost Reduction
One of the most important contributions of EdgeMatrix is to significantly reduce the runtime of service orchestration and request dispatch. As shown in Fig. 12, we compare the decision time cost by EdgeMatrix and pure-JSORD to perform service orchestration and request dispatch for each frame under different numbers of nodes and service types when the number of channels is 6. We found that the time cost required by EdgeMatrix and pure-JSORD will increase with the increase in the number of nodes and service types, but the magnitude of the time cost required by EdgeMatrix is much lower than that of pure-JSORD. We observe that the runtime of pure-JSORD is 13 to 71 times higher than EdgeMatrix for a small range of parameter values. The reason is that the traditional method considers all services and requests within the global nodes, unlike EdgeMatrix which (i) divides the SLA priority levels of user services, orchestrates services with corresponding SLA priority on each channel; (ii) dispatches requests orient to the cells on each channel rather than the global edge nodes, and only dispatch requests with one corresponding SLA priority. These characteristics lead EdgeMatrix to perform service orchestration and request dispatch in parallel between channels and significantly reduce the magnitude of parameters in the algorithm. VI. RELATED WORK Resource Customization. The design concept of network slicing in 5G inspires our work [19], i.e., using SDN and NFV technologies to map resources in physical infrastructure to dedicated virtual resources required by users. Further provide customized services and resource isolation to efficiently utilize limited resources in networked systems, such as RANs [20]- [25] and Core Network [26], [27]. However, some existing research considered a separate MEC host [7], [28] or Service Chain Functions (SCFs) [21], [29] in the edge node as a slice for the edge-cloud system. However, they do not fully consider the multi-resource heterogeneity in edge environments.
Joint Service Orchestration and Request Disapatch.We also need to make rational and efficient use of virtual resources in EdgeMatrix through service orchestration [30], [31] and request dispatch [32]. In [30], the authors designed service orchestration algorithms based on the greedy idea to deploy appropriate services in edge clusters. In [31], the authors proposed a service orchestration algorithm using a game-theoretic approximation with energy consumption and communication costs as optimization goals and enhance the algorithm's robustness by avoiding the need for a centralized auctioneer. However, [30], [31] have no particular concern on (i) the impact of service orchestration and deletion on request dispatch and (ii) the competition for resources among different services. The authors in [32] designed the request dispatch algorithm aiming to reduce global energy consumption. However, the work in [32] does not fit the edge-cloud system, which is the collaboration between the network edge and the cloud center.
VII. CONCLUSION In this paper, we propose EdgeMatrix that can guarantee the SLA priority for users in the edge-cloud system under three inherent challenges. EdgeMatrix introduces the NMAC to redefine the physical resources in the edge-cloud system as isolated customized resources, which effectively maximize the system throughput and improves the throughput rate of services with high SLA priority under real trace. We also perform JSORD in parallel on each independent channel, significantly reducing runtime and making EdgeMatrix equally applicable to large-scale networked systems.