Serverless multi-edge function dynamic deployment and task offloading method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTHEAST UNIV
- Filing Date
- 2023-10-11
- Publication Date
- 2026-08-07
AI Technical Summary
[0004]现有边缘计算场景下的研究主要集中在任务卸载与服务部署上,但大多数工作仍存在以下不足:首先,不少工作在设计任务卸载策略时都忽略了一个基本事实,即某边缘服务器当前可以处理指定类任务的前提是:处理该类任务的服务(包括代码、数据库等)正缓存、运行于该边缘服务器上
[0013] To achieve the above objectives, the present invention also adopts the following technical solution: a serverless multi-edge function dynamic deployment and task offloading system, comprising a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the methods described above.
Smart Images

Figure CN117376357B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of edge computing applications, serverless computing applications, and computer technology, and mainly relates to a serverless multi-edge function dynamic deployment and task unloading method and system. Background Technology
[0002] Edge computing deploys resources closer to the network edge of end-user IoT devices. By establishing a reliable network connection between the devices and the edge computing platform, various computationally intensive and latency-sensitive tasks submitted by end devices (such as sensor assistance and mobile games) can be processed directly at the network edge without being transmitted to a remote cloud center, significantly reducing network load and improving quality of service. However, this new distributed computing architecture also has some drawbacks, the most obvious being limited hardware resources.
[0003] Serverless edge computing combines the advantages of serverless computing and edge computing, supporting highly elastic scaling of resource usage. In this computing model, services are designed as individual functions and encapsulated in lightweight containers. An event-driven pattern is used to dynamically and on-demand manage and deploy function instances. That is, a function is only instantiated and occupies resources after a task triggers it, and can be immediately destroyed to release resources after processing, significantly improving resource utilization.
[0004] Current research on edge computing scenarios mainly focuses on task offloading and service deployment, but most works still have the following shortcomings: First, many studies ignore a fundamental fact when designing task offloading strategies: the prerequisite for an edge server to handle a specific type of task is that the service (including code, databases, etc.) handling that type of task is cached and running on that edge server. For example, an edge server that has deployed image recognition models and data can only directly process and return the results to the terminal device after receiving an image recognition task. This directly leads to these offloading algorithms not being directly adaptable to real-world scenarios. Second, most current research on service deployment is based on traditional edge computing architectures and only considers the types of services deployed on each edge server. However, in serverless edge computing architectures, services are designed as functions, encapsulated and run in lightweight containers, and operate in an event-driven manner. In this architecture, the services deployed on each edge server node are a series of stateless functions. When designing deployment algorithms, it is necessary to consider the types and quantities of various functions deployed simultaneously, and to dynamically manage the lifecycle of functions. That is, it is necessary to adjust the deployment of functions in a timely manner according to the type and quantity of tasks received by the current system. Traditional service deployment algorithms are obviously no longer able to meet the needs of serverless multi-edge scenarios. Summary of the Invention
[0005] This invention addresses the problems in existing technologies by providing a serverless multi-edge function dynamic deployment and task unloading method and system. It includes at least an initialization phase, a function dynamic deployment and algorithm update and maintenance phase, and a task unloading phase. In the initialization phase, a historical experience replay area and a high-quality experience replay area are created to store pre-collected historical experiences of the edge system. Data in the high-quality experience replay area is clustered, function deployment model parameters are initialized, and the data from the historical experience replay area is used for pre-training. Subsequently, in the function dynamic deployment and algorithm update and maintenance phase, the current task arrival patterns of the edge system are collected and input into the policy network within the function deployment model. After computation, function deployment actions are obtained, new experiences are collected, the high-quality experience area is maintained, the deployment model is updated, and parameters are periodically synchronized. Finally, with the goal of minimizing average task latency, task hybrid unloading is performed based on the current function instance deployment status. This invention reduces task latency and improves service quality through multi-edge collaborative deployment of function instances and task hybrid unloading, demonstrating broad application value and practical prospects in the field of serverless multi-edge computing.
[0006] To achieve the above objectives, the technical solution adopted by this invention is: a serverless multi-edge function dynamic deployment and task unloading method, comprising at least an initialization phase, a function dynamic deployment and algorithm update and maintenance phase, and a task unloading phase, wherein...
[0007] A. Initialization phase: Create a historical experience replay area and a high-quality experience replay area to store the historical experience of the pre-collected edge system, cluster the data in the high-quality experience replay area, initialize the function to deploy model parameters, and pre-train using the data in the historical experience replay area;
[0008] B. Function dynamic deployment and algorithm update and maintenance phase: Collect the task arrival patterns of the edge system at the current moment, input them into the policy network in the function deployment model, obtain the function deployment actions after calculation, collect new experiences, maintain the high-quality experience area, update the deployment model and periodically synchronize parameters;
[0009] C. Task Unloading Phase: With the goal of minimizing the average task latency, tasks are unloaded in a mixed manner based on the current function instance deployment status.
[0010] As an improvement of the present invention, the experience in the initialization phase includes the task arrival mode of the system at the previous moment when this experience is collected, the function instance deployment action at the previous moment, the average task latency, and the task arrival mode at the current moment, wherein the task arrival mode is the amount of tasks submitted to each edge requesting various functions.
[0011] As another improvement of the present invention, in the function dynamic deployment and algorithm update and maintenance phase, the function deployment action is output according to the task arrival mode at the current moment, and this action instruction is sent to each edge, and each edge updates the function instance according to this information; the experience is saved to the historical experience replay area, the category of this experience is matched in the clustering results, and whether to save this experience to the corresponding category in the high-quality experience replay area is selected according to the maintenance rules of the high-quality experience area, and the clustering results of the high-quality experience area are maintained regularly; data is collected proportionally from the experience replay area and the high-quality experience area to update the function deployment model and periodically synchronize parameters.
[0012] As another improvement of the present invention, in the task unloading phase, for any type of function, the priority level of the edge is determined by the number of instances currently deployed at each edge and the amount of tasks requesting that type of function received; for tasks initially submitted to a node requesting a certain type of function, the task priority is determined based on the estimated latency of task unloading to the cloud; then for any type of function, the edge is first determined according to the edge priority, and then tasks are sequentially taken out from the task priority queue until the execution edge of all tasks is determined; finally, for each type of task allocated to each edge, the priority is re-determined and scheduled for execution accordingly.
[0013] To achieve the above objectives, the present invention also adopts the following technical solution: a serverless multi-edge function dynamic deployment and task offloading system, comprising a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the methods described above.
[0014] Compared with existing technologies, this invention offers the following advantages: It considers multi-edge collaboration mechanisms during both function deployment and task unloading, ensuring efficient resource utilization and minimizing task latency. During function deployment, a reinforcement learning algorithm automatically learns the characteristics of each edge and the mapping between task arrival patterns and optimal deployment states. Furthermore, during algorithm updates, a technique of periodically maintaining high-quality experience replay areas and proportionally sampling training in dual experience replay areas is employed, effectively balancing exploration and utilization while avoiding the impact of negative samples during algorithm updates. During task unloading, the invention considers the heterogeneity of resources and loads across edges, fully utilizing the available resources of the entire edge system. Task characteristics are used to determine task unloading and scheduling priorities to minimize average latency and improve the service quality of serverless multi-edge systems. This has significant advantages in serverless edge computing systems characterized by bursty tasks, computational intensity, and fine-grained function requests. This invention comprehensively considers multi-edge collaboration and heterogeneous characteristics, adjusting function deployment and task unloading in a timely manner based on real-time task arrival patterns to optimize average task latency and improve system performance. It has broad application value and practical prospects in the field of serverless multi-edge computing. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of the serverless multi-edge system architecture of the present invention;
[0016] Figure 2 This is a schematic diagram of the serverless multi-edge function dynamic deployment and task unloading method of the present invention;
[0017] Figure 3 This is a detailed flowchart of the steps of the serverless multi-edge function dynamic deployment and task unloading method of the present invention. Detailed Implementation
[0018] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are for illustrative purposes only and are not intended to limit the scope of the invention.
[0019] Example 1
[0020] like Figure 1As shown, this invention considers constructing a serverless multi-edge computing system with cloud-edge collaboration. The system includes one remote cloud center and N edge computing nodes. Each edge node consists of a base station (BS) providing network access for IoT devices and several edge servers providing limited computing resources. The base station can receive various tasks submitted by terminal devices within its network coverage area. Each type of task requires a corresponding function instance for processing. The base station can communicate with other base stations or the remote cloud. The system has a controller responsible for dynamic function deployment and a scheduler responsible for task scheduling. Specifically, at a certain moment, after each base station receives various tasks submitted by devices within its coverage area, the controller first adjusts the type and number of function instances deployed on each edge server within the system, under the condition of satisfying hardware resource constraints. Then, based on this, the scheduler schedules the tasks to appropriate locations for execution.
[0021] A serverless multi-edge function dynamic deployment and task offloading method that minimizes average task latency comprehensively considers multi-edge resources, load heterogeneity, task computation volume, data volume characteristics, and inter-edge collaboration mechanisms. During function deployment, deployment actions are directly output using a policy network. During task scheduling, resource characteristics are fully utilized to minimize task latency and improve system performance. Figure 2 As shown, the method includes the following stages:
[0022] A. Initialization Phase: Collect the dataset and import it into the experience replay area, initialize and deploy the model, and pre-train it. This includes the following steps:
[0023] A1. Collect historical experience from serverless edge systems to construct a dataset, whereby the experience includes the task arrival pattern s of the system at the previous moment when this experience was collected. t-1 The previous time step function instance deployment action a t-1 Average task latency r and current task arrival mode s t The task arrival mode s at time t. t This represents the workload of various functions and requests submitted to each edge at this time, encoded as a matrix, s ij The number of tasks submitted to the edge i request function j;
[0024] A2. Create two experience replay areas: a normal experience area to store all historical experiences and a high-quality experience area to store historical experiences with good deployment results. Import the dataset from A1 into the experience area.
[0025] A3. Based on historical experience, the task arrival pattern from the previous moment is... t-1 Data from the high-quality experience replay area of clustering;
[0026] A4. Construct an initialization function deployment model, which includes a target network (target policy network A′, target evaluation network Q′) and a current network (policy network A, evaluation network Q). Randomly initialize parameters. Randomly collect a certain proportion of samples from each category in the current clustering results of the high-quality experience replay area and randomly collect samples from the experience replay area to form a training set for pre-training the model.
[0027] B. Function dynamic deployment and algorithm update and maintenance phase: Output function deployment actions based on the task arrival pattern at the current time t, collect new experience, maintain the high-quality experience zone and update the deployment model;
[0028] B1. Collect the current task arrival patterns of the edge system. t As the input to the policy network A in the function dynamic deployment algorithm, it is used to obtain the function deployment action a after computation. t Immediately send this action command to each edge, and each edge updates its function instance according to this information;
[0029] B2. The task arrival mode s from the previous moment in the system t-1 The previous time step function instance deployment action a t-1 The average time of the task at the previous moment r t-1 And the current task arrival mode s t Create a new experience H t Save to the historical experience replay area;
[0030] B3. Match H in the current clustering results of the high-quality experience region. t The category to which this experience belongs will be determined according to the maintenance rules of the high-quality experience area. You can then choose whether to save this experience to the corresponding category in the high-quality experience replay area.
[0031] B4. If the update condition for the high-quality experience replay area is triggered, i.e., the average distance of all experiences to their respective cluster centers is greater than a preset threshold, then all historical experiences will be processed according to the task arrival mode s from the previous moment. t-1 Re-cluster and update the results;
[0032] B5. Collect data proportionally from the experience replay area and the high-quality experience replay area, update the deployment model strategy network A and the evaluation network Q using stochastic gradient ascent, and periodically synchronize the parameters of the target network with the current network.
[0033] C. Task Unloading Phase: With the goal of minimizing the average task latency, tasks are unloaded in a mixed manner based on the current function instance deployment status.
[0034] C1. For function f, x is the number of instances of this type of function currently deployed at edge i. i,f The number of tasks n for this type of function received in the request. i,fCalculate the load I of the deterministic function f at edge i. i,f Based on this load, the priority of each edge is determined; the higher the load, the higher the priority.
[0035] l i,f =n i,f / x i,f
[0036] C2. For the initial set of tasks submitted to edge i request f type functions, determine the task unloading priority based on the estimated latency δ of the task being directly unloaded to the cloud, where the estimated latency is the sum of the task's transmission time TT, execution time ET, and result return time RT;
[0037] δ=TT+ET+RT
[0038] C3. For functions of type f, firstly, edge i is determined sequentially based on the edge priorities of C2. Then, tasks are sequentially retrieved from the task unloading priority queue of function of type f requested from edge i in C3. Next, among all instances of function of type f on the edge, the instance that is expected to finish earliest during task execution is found, and the unloading benefit is calculated. The unloading benefit is the maximum difference between the estimated completion time obtained by direct transmission to the cloud and execution at a certain position on the edge. If the unloading benefit is positive, the estimated available time of the function instance corresponding to the maximum unloading benefit is updated (consistency), and the position of the function instance is determined as the execution edge of the task. Otherwise, the task is unloaded to the cloud for execution. C3 is repeated until an unloading edge is determined for all tasks.
[0039] C4. Reschedule the tasks of request type f functions assigned to edge i within that edge. The priority rule for scheduling is the estimated earliest end time Δ of the task when it is executed at the current edge. The value of Δ is the sum of the earliest start time and the execution time of the task. The earliest start time of the task is the maximum value of the earliest available time X of the type f function instance on edge i and the transmission time of the task from the initial submission edge to the current edge via the shortest path. After determining the priority of the task, take the tasks out of this priority queue in sequence, assign them the earliest available instance of type f function on edge i and update the available time of the function instance synchronously, and record the estimated start time of the task. Repeat C3 until a specific function instance and execution order are determined for all tasks.
[0040] Δ = max(TT,X) + ET
[0041] Once the above steps are completed, the system operation process for one moment ends, and the system can move on to the next moment to continue running.
[0042] Through the above process, the present invention realizes a serverless multi-edge function dynamic deployment and task offloading method that minimizes the average task latency. By timely and appropriate function collaborative deployment and task hybrid offloading mechanism, the resource utilization of the entire edge system is improved and the average task latency is significantly reduced.
[0043] Example 2
[0044] A serverless multi-edge function dynamic deployment and task unloading method, such as Figure 3 As shown, the specific steps include the following:
[0045] S1. Collect historical experience to form a dataset. The experience includes the task arrival pattern, function instance deployment status, average task latency, and current task arrival pattern of the system at the previous moment when this experience was obtained. The task arrival pattern at a certain moment is encoded in matrix format, and the element in row i and column j of the matrix is the amount of task currently submitted to edge i requesting function j.
[0046] S2. Create a historical experience replay area and a high-quality experience replay area, import the dataset from step S1, and cluster the data in the high-quality experience replay area according to the task arrival pattern of the previous moment in the historical experience as the indicator; the clustering process specifically includes:
[0047] S201. Randomly select a certain amount of historical experience from the high-quality experience area as cluster centers;
[0048] S202. Calculate the distance from each experience in the high-quality experience playback area to the cluster center. The distance calculation formula is as follows: Where N is the number of edge nodes, the first element of each experience is the task arrival pattern of the previous time when this experience is collected, the task arrival pattern is a matrix, and each element of the i-th row represents the arrival amount of each type of task at the corresponding time edge i. cosθ calculates the cosine similarity between the corresponding row vectors in the task arrival patterns of the previous time in experience X and Y.
[0049] S203. Assign the experience to the category corresponding to the cluster center based on the calculated distance;
[0050] S204. Redetermine the cluster centers. If the cluster centers have not changed significantly compared to the previous iteration, stop the iteration; otherwise, go to S202 to continue running.
[0051] S205. Output the clustering results;
[0052] S3. Collect data proportionally from the experience replay area and the high-quality experience replay area to form training samples, and pre-train using stochastic gradient ascent. If the parameter synchronization period has been reached, synchronize the parameters of the target network (target policy network A′, target evaluation network Q′) with the current network (policy network A, evaluation network Q). The deployment model update synchronization process specifically includes the following steps:
[0053] S301. A certain proportion of samples are randomly collected from each category in the current clustering results of the high-quality experience replay area and the samples randomly collected from the experience replay area to form a training set;
[0054] S302. Use stochastic gradient ascent to update the policy network and evaluation network in the model. The objective function for updating the policy network is E(Q(s,a)), where s is any empirical task arrival pattern at the previous time step, a is the function deployment action within the empirical context, and Q is the evaluation network. The objective function for updating the evaluation network is E[Q(s,a)-r-γ·Q′(s′,A′(s′))]. 2 A′ is the target policy network, Q′ is the target evaluation network, s′ is the function deployment mode at the current moment in the experience, and r is the average task latency information in the experience;
[0055] S303. If the number of updates has not reached the parameter synchronization period, then go to S301 to continue sampling and updating; otherwise, synchronize the parameters of the target network and the current network. The specific method is as follows: weight the parameters of the policy network and the parameters of the target policy network and assign them to the target policy network; weight the parameters of the evaluation network and the target evaluation network and assign them to the target evaluation network.
[0056] S304. If the number of synchronizations reaches the preset value, end the update; otherwise, proceed to S301 to continue updating and synchronizing.
[0057] S305. Update synchronization complete, result returned;
[0058] S4. Input the current task arrival mode into the policy network A in the function deployment algorithm. After the operation, the function deployment action matrix a is obtained. The matrix element means the proportion of resources that a certain edge needs to allocate to a certain type of function. Send this action instruction to each edge, and each edge updates the function instance according to this information.
[0059] S5. Create an experience record based on the task arrival mode of the system at the previous moment, the function instance deployment action at the previous moment, the average task latency, and the task arrival mode at the current moment, and save it to the historical experience replay area. Maintain the high-quality experience replay area and update and synchronize the model in the manner of S3. The maintenance process of the high-quality experience replay area specifically includes the following steps:
[0060] S501. Match the category to which this experience belongs in the current clustering results of the high-quality experience replay area;
[0061] S502. If the number of experience entries in a category within the high-quality experience area has not reached the upper limit, then this experience will be saved directly to its category.
[0062] S503. If the number of experience entries in the category of the high-quality experience zone has reached the limit, compare this experience with the experience with the highest average task latency in the category. If the average task latency value contained in this experience is smaller, replace the old historical experience being compared with this experience; otherwise, discard this experience directly.
[0063] S504. Calculate the average distance from all experiences to their respective cluster centers. If it is greater than the preset upper limit of distance, it is considered that the update cycle of the high-quality experience replay area has been reached. It is necessary to re-cluster the data of the high-quality experience replay area according to the task arrival pattern of the previous moment in the historical experience and save the new clustering results.
[0064] S505. Output the clustering results; maintenance complete.
[0065] S6. For a certain type of function, the priority level of each edge is determined by the number of instances of that type of function currently deployed on each edge and the amount of tasks requesting that type of function. The higher the ratio of task amount to number of instances, the higher the priority level.
[0066] S7. For a certain type of function, determine each edge sequentially from the edge priority queue. For each task in the task set that initially submits to the edge node to request the function of this type, determine the task unloading priority based on the estimated latency of unloading to the cloud, where the greater the latency, the higher the priority.
[0067] S8. Take out tasks sequentially from the task unloading priority queue, and find the instance that is expected to finish earliest when it is executed among all instances of the function requested by the task at the edge, and calculate the unloading benefit, which is the maximum difference between the estimated completion time obtained when it is directly transferred to the cloud and executed at a function instance at the edge.
[0068] S9. If the unloading benefit is positive, update the estimated availability time (consistency) of the function instance corresponding to the maximum unloading benefit, and determine the edge where the function instance is located as the execution edge of the task; otherwise, the task is scheduled to be executed in the cloud.
[0069] S10. Repeat S6 to S9 until execution boundaries are determined for all tasks;
[0070] S11. Based on the estimated earliest end time of the task, determine the priority of the task in a certain type of task set that is finally assigned to a certain edge processing edge. The earlier the estimated earliest end time, the higher the priority. Then, take the task out from the priority queue in sequence, schedule the task to the earliest available instance of the corresponding function category of the current edge, record the estimated start time and end time of the task, and update the availability time of the assigned function instance (consistency).
[0071] S12. Repeat S11 until the actual function instances to be executed and the execution order have been determined for all tasks;
[0072] S13. At the current moment, function deployment and task unloading are completed, and the algorithm will continue to run in the next moment, starting from S4.
[0073] In summary, this invention primarily addresses the problem of dynamic function deployment and task offloading scheduling in serverless multi-edge computing from the perspective of reducing task latency. It embodies the concept of efficient computing and provides a method for dynamic function deployment and task offloading in serverless multi-edge computing that minimizes latency. This method comprehensively considers the flexible and heterogeneous characteristics of serverless edge computing, as well as the attributes of fine-grained function requests, strong burstiness, and high latency requirements. It minimizes the average latency of tasks and reduces task latency and improves service quality by deploying function instances and offloading tasks in a hybrid manner through multi-edge collaborative deployment. This method has broad application value and practical prospects in the field of serverless multi-edge computing.
[0074] It should be noted that the above content merely illustrates the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. For those skilled in the art, various improvements and modifications can be made without departing from the principle of the present invention, and all such improvements and modifications fall within the scope of protection of the claims of the present invention.
Claims
1. A serverless multi-edge function dynamic deployment and task unloading method, characterized in that... It includes at least the initialization phase, the dynamic deployment and algorithm update and maintenance phase, and the task unloading phase, among which, A. Initialization phase: Create a historical experience replay area and a high-quality experience replay area to store the historical experience of the pre-collected edge system, cluster the data in the high-quality experience replay area, initialize the function to deploy model parameters, and pre-train using the data in the historical experience replay area; B. Function dynamic deployment and algorithm update and maintenance phase: Collect the task arrival patterns of the edge system at the current moment, input them into the policy network in the function deployment model, obtain the function deployment actions after calculation, collect new experiences, maintain the high-quality experience area, update the deployment model and periodically synchronize parameters; C. Task Unloading Phase: With the goal of minimizing the average task latency, tasks are unloaded in a mixed manner based on the current function instance deployment status. Specifically, the steps include the following: S1. Collect historical experience to form a dataset. This experience includes the task arrival pattern, function instance deployment status, average task latency, and the task arrival pattern at the previous moment when the experience was obtained. The task arrival pattern at a given moment is encoded in matrix format. OK The column element is the current submission to the edge. ask The workload of class functions; S2. Create a historical experience replay area and a high-quality experience replay area and import the dataset from step S1. Cluster the data in the high-quality experience replay area according to the task arrival pattern of the previous moment in the historical experience as the indicator. S3. Collect data proportionally from the experience replay area and the high-quality experience replay area to form training samples, and pre-train using stochastic gradient ascent. If the parameter synchronization period has been reached, synchronize the parameters of the target network and the current network; the target network includes the target policy network. and target evaluation network The current network includes a policy network. and evaluation network ; S4. Input the current task arrival mode into the policy network of the function deployment algorithm. The function deployment action matrix is obtained after the calculation. This action instruction is sent to each edge, and each edge updates its function instance according to this information; S5. Save the experience from step S1 to the historical experience replay area, maintain the high-quality experience replay area and update and synchronize the model in the manner of step S3; S6. For a certain type of function, the priority level of each edge is determined by the number of instances of that type of function currently deployed on each edge and the amount of tasks requesting that type of function. The higher the ratio of task amount to number of instances, the higher the priority level. S7. For a certain type of function, determine each edge sequentially from the edge priority queue. For each task in the task set that initially submits to the edge node to request the function of this type, determine the task unloading priority based on the estimated latency of unloading to the cloud, where the greater the latency, the higher the priority. S8. Take out tasks sequentially from the task unloading priority queue, and find the instance that is expected to finish earliest when it is executed among all instances of the function requested by the task at the edge, and calculate the unloading benefit, which is the maximum difference between the estimated completion time obtained when it is directly transferred to the cloud and executed at a function instance at the edge. S9. If the unloading benefit is positive, update the estimated availability time of the function instance corresponding to the maximum unloading benefit, and determine the edge where the function instance is located as the execution edge of the task; otherwise, the task is scheduled to be executed in the cloud. S10. Repeat steps S6 to S9 until execution boundaries are determined for all tasks; S11. Based on the estimated earliest end time of the task, determine the priority of the task in a certain type of task set that is finally assigned to a certain edge processing edge. The earlier the estimated earliest end time, the higher the priority. Then, take the task out from the priority queue in sequence, schedule the task to the earliest available instance of the corresponding function category of the current edge, record the estimated start time and end time of the task, and update the available time of the assigned function instance. S12. Repeat step S11 until the actual function instances to be executed and the execution order have been determined for all tasks; S13. At the current moment, function deployment and task unloading are completed. At the next moment, the algorithm will proceed to step S4 to continue running.
2. The serverless multi-edge function dynamic deployment and task offloading method as described in claim 1, characterized in that: The experience gained during the initialization phase includes the task arrival pattern of the system at the previous moment when this experience was collected, the function instance deployment action at the previous moment, the average task latency, and the task arrival pattern at the current moment. The task arrival pattern is the amount of requests for various functions submitted to each edge.
3. The serverless multi-edge function dynamic deployment and task unloading method as described in claim 2, characterized in that: During the dynamic deployment and algorithm update and maintenance phase of the function, the function deployment action is output according to the current task arrival mode, and this action instruction is sent to each edge. Each edge updates the function instance according to this information. The experience is saved to the historical experience replay area, and the category of this experience is matched in the clustering results. According to the maintenance rules of the high-quality experience area, it is selected whether to save this experience to the corresponding category in the high-quality experience replay area and the clustering results of the high-quality experience area are maintained regularly. Data is collected from the experience replay area and the high-quality experience area in proportion to update the function deployment model and periodically synchronize parameters.
4. The serverless multi-edge function dynamic deployment and task unloading method as described in claim 3, characterized in that: During the task unloading phase, for any type of function, the priority of the edge is determined by the number of currently deployed instances at each edge and the amount of tasks requesting that type of function. For tasks initially submitted to a node requesting a certain type of function, the task priority is determined based on the estimated latency of unloading the task to the cloud. Then, for any type of function, the edge is first determined according to the edge priority, and then tasks are sequentially taken out from the task priority queue until the execution edge of all tasks is determined. Finally, for each type of task assigned to each edge, the priority is re-determined and scheduled for execution accordingly.
5. The serverless multi-edge function dynamic deployment and task offloading method as described in claim 1, characterized in that: The clustering process in step S2 specifically includes the following steps: S201. Randomly select a certain amount of experience as cluster centers; S202. Calculate the distance from each experience in the high-quality experience replay area to the cluster center; S203. Assign the experience to the category corresponding to the cluster center based on the distance calculated in step S202; S204. Redetermine the cluster centers. If the cluster centers have not changed significantly compared to the previous iteration, stop the iteration; otherwise, proceed to step S202 to continue. S205. Output the clustering results.
6. The serverless multi-edge function dynamic deployment and task offloading method as described in claim 1, characterized in that: The deployment model update synchronization process in step S3 specifically includes the following steps: S301. A certain proportion of samples are randomly collected from each category in the current clustering results of the high-quality experience replay area and the samples randomly collected from the experience replay area to form a training set; S302. Use stochastic gradient ascent to update the policy network and evaluation network in the model. The objective function for updating the policy network is: ,in For any experience, the task arrival mode at the previous moment. Deploy actions for functions within the experience. To evaluate the network, the objective function for evaluating network updates is: , For the target policy network, To evaluate the network for the target, This represents the function deployment pattern at the current moment in the experience. This provides average task latency information from experience. S303. If the number of updates has not reached the parameter synchronization period, proceed to step S301 to continue sampling and updating; otherwise, synchronize the parameters of the target network and the current network. The specific method is as follows: weight the parameters of the policy network and the parameters of the target policy network and assign them to the target policy network; weight the parameters of the evaluation network and the target evaluation network and assign them to the target evaluation network. S304. If the number of synchronizations reaches the preset value, end this update; otherwise, proceed to step S301 to continue updating and synchronizing. S305. Update synchronization complete, results returned.
7. The serverless multi-edge function dynamic deployment and task unloading method as described in claim 1, characterized in that: The maintenance process for the high-quality experience replay area in step S5 specifically includes the following steps: S501. Match the category to which this experience belongs in the current clustering results of the high-quality experience replay area; S502. If the number of experience entries in a category within the high-quality experience area has not reached the upper limit, then this experience will be saved directly to its category. S503. If the number of experience entries in the category of the high-quality experience zone has reached the limit, compare this experience with the experience with the highest average task latency in the category. If the average task latency value contained in this experience is smaller, replace the old historical experience being compared with this experience; otherwise, discard this experience directly. S504. Calculate the average distance from all experiences to their respective cluster centers. If it is greater than the preset limit, it is considered that the update cycle of the high-quality experience replay area has been reached. Then, the data of the high-quality experience replay area is re-clustered according to the task arrival pattern of the previous moment in the historical experience and the new clustering results are saved. S505. Output the clustering results, maintenance complete.
8. A serverless multi-edge function dynamic deployment and task offloading system, comprising a computer program, characterized in that: When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1-7 above.