Method for deploying edge dynamic DAG (Directed Acyclic Graph) server-free function on line to realize quick start
By building a dynamic DAG model with warm-up preparation and function scheduling in a dynamic DAG serverless edge computing environment, combining the random rounding search algorithm and the online warm-up scheduling algorithm, the cold start problem in the dynamic DAG environment is solved, and efficient task scheduling and resource utilization are achieved.
Patent Information
- Application Number
- CN202510219670.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-02-26
AI Technical Summary
In a dynamic DAG serverless edge computing environment, how to efficiently warm up function containers based on historical data, alleviate cold start problems, optimize task scheduling and meet dynamic request needs.
A dynamic DAG model with warm-up preparation and function scheduling is built to capture the probability of function call through real-time updated historical data, and combine a search algorithm based on random rounding and an online warm-up and task scheduling algorithm to realize efficient warm-up and task scheduling of function containers.
It effectively alleviates the cold start delay problem of serverless functions in edge computing, improves system response speed, optimizes task scheduling and resource utilization, and meets the task requirements of dynamic DAG applications in edge environments.
Smart Images

Figure CN120066729A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of edge computing and serverless computing, and particularly relates to a method for online deploying edge dynamic DAG serverless functions to achieve fast startup. Background Art
[0002] With the development of virtualization technology, serverless computing has become an important mode in the cloud computing ecosystem. The characteristic of serverless computing is that services are disassembled into multiple independent function units, enabling users to focus on code development while enjoying advantages such as convenient deployment, dynamic scaling, and pay-per-use. However, when a function has not been called for a long time, the relevant containers will be terminated to save resources, resulting in the need to restart the containers during the next call, thereby causing relatively high latency and response time, namely the cold start problem.
[0003] Edge computing has the advantages of low latency, high bandwidth, and real-time data processing, and can better support the Internet of Things and intelligent applications. However, the limited resources and complex management of edge computing make the cold start problem more serious. Therefore, serverless edge computing has attracted wide attention.
[0004] In serverless edge computing, tasks are usually modeled in the form of a directed acyclic graph (DAG), and applications need to call functions in sequence according to the DAG order. DAGs can be divided into two categories: one is the static DAG with a preset path, and the other is the dynamic DAG whose subsequent function path is dynamically determined according to the previous function input. Since the path of the static DAG is determined, containers can be preconfigured, while the dynamic DAG is difficult to preconfigure containers due to path uncertainty, thus further exacerbating the cold start problem. Current research mostly focuses on the container deployment and task scheduling of static DAGs, and there is less research on the processing of dynamic DAG tasks. Therefore, designing a serverless edge computing model and corresponding function container deployment and task scheduling algorithms for dynamic DAGs is still an urgent problem to be solved.
[0005] Consider an edge system composed of multiple edge servers, and each server has a certain amount of memory resources. Assume that the application uses a dynamic DAG, and the execution path of each request is changing. The containers deployed on the edge nodes are limited by memory resources, and at the same time, the cold start problem needs to be considered. In the case where the edge server capacities are the same and the cold start time is ignored, the static DAG scheduling problem in a heterogeneous edge system has been proven to be an NP-hard problem. If more practical situations are considered, that is, the DAG execution path changes dynamically and the cold start time has a significant impact on the overall startup time, then the problem will become more complex. Summary of the Invention
[0006] Technical problem: Before a new request arrives, the historical data of the DAG application will be used to warm up the relevant function containers and plan the deployment of the functions. To address the challenges of DAG serverless function execution in a dynamic edge environment, the following main problems are faced: How to efficiently warm up the relevant function containers and plan their deployment based on historical data before a new request arrives; how to mitigate the cold start problem to improve the system response speed; and how to optimize task scheduling and meet dynamic request requirements in a dynamic environment with fluctuating request complexity and function call probabilities. To solve the above problems, the present invention provides an online deployment method for edge dynamic DAG serverless functions to achieve fast startup. First, a dynamic DAG model with warm-up preparation and function scheduling is constructed, and this model captures the function call probability through real-time updated historical data to reflect the characteristics of the dynamic DAG. Second, a search algorithm based on stochastic rounding is proposed to mitigate the cold start problem, which combines constrained linear relaxation and stochastic progressive search. Finally, considering the impact of request complexity and function call probability fluctuations on practical applications, an online warm-up and task scheduling algorithm is developed for task scheduling under online requests.
[0007] Technical solution: The present invention is an online deployment method for edge dynamic DAG serverless functions to achieve fast startup, including the following steps:
[0008] Step 1: Define a dynamic DAG and establish a modeling criterion for function warm-up processing. By analyzing the characteristics of serverless applications, calculate the selection probabilities of the calls and execution paths of each function, so as to determine which functions need to be warmed up and formulate corresponding strategies; abstract the serverless application as a directed acyclic graph (DAG), calculate the path selection probability by analyzing the call probability of the functions on the execution path, use historical data and the EWMA method to calculate and smooth the function call probability, improve the prediction accuracy and stability, and judge whether warm-up is needed according to the function call probability. When the probability exceeds the threshold, mark it as needing warm-up, otherwise no warm-up is needed;
[0009] Step 2: Construct a dynamic DAG model with warm-up preparation and function scheduling, which minimizes the overall expected execution time through warm-up and function deployment. By constructing a quadratic integer programming model with the goal of minimizing the overall expected execution time of the functions, this model uses the historical call data in Step 1 to predict possible future calls and reasonably allocate warm-up and computing resources on the edge server, thereby reducing cold start latency and resource waste. The constraint conditions ensure that the execution path probability of the tasks meets the requirements, the resource usage of each edge server does not exceed the available capacity, and the data transmission, processing order, and warm-up and execution time of the functions meet the actual execution conditions. Through these constraint conditions, the model can efficiently allocate edge computing resources and optimize the task scheduling process;
[0010] Step 3: Based on the construction in Step 2, a quadratic integer linear programming problem is formulated. By processing the quadratic constraint conditions, it is transformed into a convex optimization problem. For the transformed problem, a search algorithm based on stochastic rounding is used to solve the optimal solution. Since the original problem is a quadratic non-linear programming problem and is relatively complex to solve directly, the problem is transformed into a convex optimization problem by adjusting the decision variables and constraint conditions. Then, a search algorithm based on stochastic rounding is proposed to solve this optimization problem. Its core is to search for the optimal integer solution that satisfies all constraint conditions. First, the non-linear constraints are linearized through slack variables, and solvers such as Gurobi are used to perform initial optimization on the problem to obtain an effective fractional solution. Then, the final solution that meets the integer requirements is generated through randomized search, ensuring that the solution satisfies all constraint conditions. Finally, the solution accuracy is further improved and the system response speed is optimized;
[0011] Step 4: Based on the calculation results of the algorithm in Step 3 for a single request, an online preheating and function scheduling algorithm is designed. This algorithm includes function weight calculation, preheating container adjustment, and optimal container selection to handle multiple online arrival requests; Design an online preheating and function scheduling algorithm. First, according to the calculated continuous influence of each function in the potential execution path, evaluate the importance of the function to optimize resource allocation. Then, before the start of the time slice, by dynamically adjusting the preheating resources and priorities on the edge server, ensure the effective allocation of function resources, and flexibly adjust the preheating strategy according to actual needs. Subsequently, sort all the functions to be processed according to the request priority and dependency of the tasks, and allocate the optimal computing resources to ensure that the tasks can be completed according to the optimal scheduling strategy, and dynamically release the resources that are no longer needed. Finally, by determining the earliest start time and earliest completion time of the function, compare the completion efficiency of the tasks among the candidate edge nodes, comprehensively consider the transmission delay and resource status, and select the optimal edge node to maximize the task execution efficiency and reduce resource waste, thereby optimizing the overall task scheduling in the edge computing environment.
[0012] Furthermore, the specific steps of defining the dynamic DAG and function preheating processing modeling preparation in Step 1 are as follows:
[0013] Step 101: Define the serverless application as a directed acyclic graph (DAG), where functions are divided into ordinary functions and dynamic functions. Ordinary functions are always called, while dynamic functions are called according to conditions. There may be multiple execution paths in the DAG, and the selection probability of each path is calculated from the call probabilities of all functions on the path;
[0014] Step 102: By analyzing historical data, calculate the historical call probability of each function within the specified observation period, and smooth the data fluctuations through normalization and EWMA methods to improve the accuracy and stability of the historical call probability;
[0015] Step 103: Determine whether the function needs to be preheated according to the historical call probability. Introduce a preheating probability threshold. When the EWMA probability of the function reaches the threshold, mark the function as needing to be preheated; otherwise, it does not need to be preheated. The preheating strategy does not depend on a specific edge server but directly determines whether the function itself needs to be preheated.
[0016] Further, the specific steps of constructing a dynamic DAG model with preheating preparation and function scheduling described in Step 2 are as follows:
[0017] Step 201: Construct a system model, including edge server m i Set M = {m 1 ,..., m l}, where l represents the number of edge servers, and R(m i ) represents the storage resources of edge server m i . G = (F, E, P) represents a DAG graph, where F = {f 1 ,..., f n} represents the set of functions f v arranged in topological order, n represents the number of functions, and r v,i represents the memory resources required for function f v to execute on edge m i . The functions here are divided into dynamic functions f d and ordinary functions f r . E represents the set of function dependencies, and e u,v represents that function f v depends on function f u . Set P = {ρ 1 ,..., ρ n} represents the probability of function calls. G(λ) represents the set of paths in the DAG, λ k is a certain path in the DAG, p k is the execution probability of path λ k , and g k is the number of functions in path λ k . The calculation formula for p k is The decision variable x v,i represents whether function f v is cold-started or hot-started on edge m i . The decision variable represents whether the function f k of path λ v is scheduled to edge m i .
[0018] The transmission communication time required to transfer data from the previous function to the next function can be expressed as Among them, c i,j represents the communication time for transmitting a unit of data from the edge server m i to m j and d u,v represents the data u transmitted to the function f v . represents whether the function f k on the path λ v is scheduled to the edge m i or not. represents whether the function f k on the path λ v is scheduled to the edge m j or not.
[0019] The function processing time can be expressed as Among them, x v,i represents whether the function f v on the edge m i is a cold start or a warm start, represents the cold start time of the function f v on the edge m i , represents the execution time of the function f v on the edge m i . When the function is executed on a certain container, if it is a warm container and the function arrives for a warm start, only the execution time needs to be calculated. If there is no pre-warmed container, the cold start time of the container also needs to be added
[0020] The dependency relationship between functions can be expressed as Among them represents the end execution time of the function f k on the path λ v , represents the start execution time of the function f k on the path λ v . The calculation formula of
[0021] Establish a quadratic integer programming mathematical model
[0022]
[0023] This mechanism aims to minimize the overall expected execution time through warm-up and function deployment. Specifically, as follows, based on the historical call data in Step 1, functions that may be called in the near future are predicted, and their containers are warmed up on the edge servers, thus reducing the cold start latency. Then, in Step 2, they are deployed according to the call frequency and resource requirements of the functions to ensure the effective utilization of computing resources. Constraint (1a) ensures that the function demand probabilities on all possible execution paths are met. Constraint (1b) guarantees that the resource usage on each edge server does not exceed its available resources. Constraints (1c) and (1d) ensure that the task execution order depends on the same path. Constraints (1e) and (1f) specify the ranges of the above variables.
[0024] Furthermore, in Step 3, by transforming the original problem into a convex optimization problem, a search algorithm based on stochastic rounding is proposed. Its specific steps are as follows:
[0025] Step 301: Since the original problem is a quadratic linear programming problem and is relatively complex to solve directly, the problem is simplified to a convex optimization problem by adjusting the decision variables and constraints. The specific optimization objective is to minimize the sum of the cold start time and the execution time, and to solve the optimal allocation scheme under various constraints of warm-up resources and task execution. After optimization, the problem becomes:
[0026]
[0027] Problem (2) is a convex optimization problem, where Constraint (2c) corresponds to (1c), and Constraint (2d) corresponds to Constraint (1d); the remaining constraints remain unchanged. Thus, we can handle Problem (1) by solving Problem (2);
[0028] Step 302: A search algorithm based on stochastic rounding is proposed to solve the problem proposed in Step 301. The core of the algorithm is to use a stochastic method to gradually search for the optimal integer solution that satisfies all the constraints. First, the relaxation variables are set to continuous values (between 0 and 1), and the Gurobi is used to solve the relaxed optimization problem to obtain the initial fractional solution. Then, through probability and multiple stochastic iterations, the solution is approximated to the integer solution that satisfies all the constraints. Finally, the corresponding function containers are warmed up using the solution results to reduce the cold start time and improve the system response speed.
[0029] Furthermore, an online warm-up and function scheduling algorithm described in Step 4 specifically includes the following steps:
[0030] Step 401: Based on the calculations in Step 3, evaluate the duration of each function in all potential execution paths, and calculate the weight of each function in combination with the path probability. Determine the importance of warming up functions in the path through these weights, and prioritize functions with high weights for resource allocation;
[0031] Step 402: Complete the warm-up in two stages. Before the time slice starts, determine the function containers that need to be warmed up according to the calculation results in Step 3, allocate them to the edge server, and update the memory resource usage of the server at the same time; during the running of the time slice, dynamically adjust the newly added warm-up containers on the edge server, and reset the usage at the end of the time slice.
[0032] Step 403: Maintain all requests in a queue for sorting according to the priorities of warm-up and function scheduling. When requests are processed in order, dynamically allocate function priorities and resources to ensure the optimal function scheduling strategy, and remove the completed tasks at the same time to achieve the dynamic scheduling of online requests;
[0033] Step 404: To select the optimal node, first, it is necessary to determine the earliest start time (EST) of the function, which depends on the completion time of the predecessor task on its node and the time required for task data transmission to the target node. At the same time, it is also necessary to ensure that the selected edge node does not have a resource conflict with other tasks, which means that the start time of the function cannot be earlier than the earliest completion time of other tasks on the same node. In addition, the resource status of the edge node is an important factor determining whether the function can be started in time. Especially when cold start of resources is required, the start time of the function must be postponed until the cold start process is completed. When the node meets the above conditions, the earliest completion time (EFT) of the function can be calculated through its start time and processing time. Finally, by comparing the earliest completion times of tasks among all candidate edge nodes, select the node that can complete the task earliest to ensure finding the optimal edge node under the premise of considering task dependencies, data transmission, and resource constraints. This method can achieve efficient scheduling of tasks in the edge computing environment, minimizing latency and resource waste.
[0034] An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the program, it implements the method for realizing fast startup by online deploying edge dynamic DAG serverless functions as described above.
[0035] A computer-readable storage medium, on which computer instructions are stored, and when the computer instructions are executed by a processor, they implement the steps of the method for realizing fast startup by online deploying edge dynamic DAG serverless functions as described above.
[0036] Beneficial effects:
[0037] The effectiveness of the present invention lies in that:
[0038] By means of an online deployment edge dynamic DAG serverless function to achieve a fast startup method, it effectively alleviates the cold start delay problem caused by function scheduling in edge computing, thereby meeting the requirements of task scheduling for dynamic DAG applications in the edge environment.
[0039] Compared with the prior art, the present invention has the following characteristics:
[0040] 1. The present invention constructs a dynamic DAG model considering warm-up preparation and function scheduling, and updates the function call probability in real time through historical data, accurately reflecting the characteristics of the dynamic DAG.
[0041] 2. The present invention proposes a search algorithm based on stochastic rounding, which combines linear constraint relaxation and stochastic progressive search, and can transform the original problem into a convex optimization problem, gradually approaching the optimal offline solution.
[0042] 3. The present invention designs an online warm-up and function scheduling algorithm, which can adjust the warm-up position in real time according to the current resource availability and container warm-up status, and select the best server to execute task scheduling, adapt to the function fluctuations under online requests, and improve the service throughput of parallel requests. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is the dynamic DAG scheduling flowchart of the technology of the present invention;
[0044] Figure 2 is the algorithm flowchart of the present invention;
[0045] Figure 3a 、 3b is the experimental result comparison chart of the offline algorithm of the present invention and the results of other existing algorithms;
[0046] Figure 4a 、 4b is the experimental result comparison chart of the online algorithm of the present invention and the results of other existing algorithms. DETAILED DESCRIPTION OF THE INVENTION
[0047] For the convenience of those of ordinary skill in the art to understand and implement the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0048] Embodiment: First, some important symbols used in the embodiment are described in Table 1:
[0049] Table 1 Important Symbols
[0050]
[0051] An online deployment edge dynamic DAG serverless function implementation method for fast startup in this embodiment includes the following steps:
[0052] Step 1: Define dynamic DAG and function warm-up processing modeling preparation. The specific process is as follows:
[0053] Step 101: Serverless applications are typically regarded as a series of event-triggered functions for processing data, and there are dependencies between functions. The structure of this application is defined as a directed acyclic graph (DAG), as Figure 1 shown. Functions are divided into two types: ordinary functions and dynamic functions. Ordinary functions are always called during execution, while dynamic functions are conditionally executed based on the calls of adjacent functions. The dependencies between functions are represented by edges. The execution of a certain function requires its dependent functions to complete and transfer corresponding data. Each function is also assigned a call probability. The call probability of an ordinary function is 1, while the call probability range of a dynamic function is between 0 and 1, and these probabilities are derived from historical data. When a request arrives, it is not guaranteed that the entire DAG will be executed. Instead, the execution path is dynamically adjusted according to the request. Each execution path in the DAG consists of multiple functions, including ordinary functions and dynamic functions. The selection probability of each path is calculated by the product of the probabilities of all functions on the path. There may be multiple execution paths in the DAG, and the path set represents all possible paths.
[0054] Step 102: By analyzing historical data, the historical call probability of a certain function within a specific observation period can be calculated. The historical call probability is obtained by calculating the number of calls of the function within this period and the duration of the observation period. To ensure that the probability value is within the range of [0, 1], the historical call probability needs to be normalized. The normalization process is based on the minimum and maximum call counts of all functions within the observation period. To improve accuracy and smooth fluctuations, the exponentially weighted moving average (EWMA) method is introduced. The EWMA method combines the historical call probability of the current observation period with the previous EWMA value. The formula is as follows:
[0055] P EWMA (f v ) = μP NORM (f v ) + (1 - μ)P last-EWMA (f v )
[0056] where μ is the smoothing factor that determines the weight ratio of the current observation period data and the previous data. P EWMA (f v ) is the function f in the current observation period vExponentially Weighted Moving Average Probability. P NORM (f v ) is the normal probability of function f v . P last-EWMA (f v ) is the function f of the historical observation period v Exponentially Weighted Moving Average Probability.
[0057] Step 103: To determine whether a function needs warm-up, a warm-up probability threshold P pre is introduced, and its value range is from 0 to 1. This threshold defines the lowest probability that function f v needs warm-up. Different from the deployment decision, the warm-up decision of the function does not depend on a specific edge server. Therefore, x v does not consider the specific index of the server, but directly represents whether function f v needs warm-up. If the EWMA probability P v of function f EWMA (f v ) reaches or exceeds P pre , then mark this function as needing warm-up (i.e., x v = 1); otherwise, it does not need warm-up (x v = 0).
[0058] Step 2: Build a dynamic DAG model with warm-up preparation and function scheduling
[0059] Step 201: Build a system model, including the set of edge servers M = {m i ,..., m 1 ,..., m l}, where l represents the number of edge servers, and R(m i ) represents the storage resources of edge server m i . G = (F, E, P) represents a DAG graph, where F = {f 1 ,..., f n} represents the set of functions f v arranged in topological order, n represents the number of functions, and r v,i represents the memory resources required when function f v is executed on edge m i . The functions here are divided into dynamic functions f d and ordinary functions f r . E represents the set of function dependencies, and e u,v represents that function f v depends on function f u . The set P = {ρ 1 ,..., ρ n} represents the probability that a function is called. G(λ) represents the set of paths in the DAG, and λ k is a certain path on the DAG, and p k is the execution probability of the path λ k , and g k is the number of functions of the path λ k . The calculation formula of p k is The decision variable x v,i represents whether the function f v is cold-start or warm-start on the edge m i . The decision variable represents whether the function f k of the path λ v is scheduled to the edge m i .
[0060] The transmission communication time required to transfer data from the previous function to the next function can be expressed as where c i,j represents the communication time to transfer a unit of data from the edge server m i to m j , d u,v represents the data transmitted by the function f u to the function f v , represents whether the function f k of the path λ v is scheduled to the edge m i , represents whether the function f k of the path λ v is scheduled to the edge m j .
[0061] The function processing time can be expressed as where x v,i represents whether the function f v is cold-start or warm-start on the edge m i , represents the cold-start time of the function f v on the edge m i , represents the execution time of the function f v on the edge m i . When a function is executed on a certain container, if it is a preheated container and the function arrives for warm-start, only the execution time needs to be calculated. If there is no preheated container, the cold-start time of the container also needs to be added
[0062] The dependency relationship between functions can be expressed as where Denote the path λ k The end execution time of the function f v on it, Denote the path λ k The start execution time of the function f v on it. The calculation formula of
[0063] Establish a quadratic integer programming mathematical model,
[0064]
[0065] This mechanism aims to minimize the overall expected execution time through warm-up and function deployment. Specifically, as follows, based on the historical call data in step 1, predict the functions that may be called in the near future and warm up their containers on the edge servers, thereby reducing the cold start latency. Then, in step 2, deploy them according to the call frequency and resource requirements of the functions to ensure the effective utilization of computing resources. The constraint condition (1a) ensures that the function demand probabilities on all possible execution paths are satisfied. The constraint condition (1b) guarantees that the resource usage on each edge server does not exceed its available resources. The constraint conditions (1c) and (1d) ensure that the task execution order depends on the same path. The constraints (1e) and (1f) specify the ranges of the above variables.
[0066] Step 3: Based on step 2, transform the original problem into a convex optimization problem and propose a search algorithm based on stochastic rounding.
[0067] Step 301: Problem (1) is a quadratic linear programming problem and is difficult to solve directly. Therefore, try to reduce the complexity of the problem. First, modify (1e) to
[0068]
[0069] For the quadratic constraint (1d), which is the product of binary variables. To simplify it, try to fix the value of x v,i first. Specifically, the value of x v can be obtained through the warm-up preparation in step 1. When x v = 1, first set all x v,i = 1. Then the current decision variables only remain In this way, the following convex optimization problem is proposed:
[0070]
[0071] Problem (2) is a convex optimization problem, where constraint (2c) corresponds to constraints (1c) and (1e), and constraint (2d) corresponds to constraints (1d) and (1f); the remaining constraints remain unchanged. Thus, we can handle problem (1) by solving problem (2).
[0072] Step 302: To solve problem (2), we propose a search algorithm based on stochastic rounding. The core idea of this algorithm is to find the optimal integer solution of this problem through the stochastic rounding method. First, the relaxation variables are continuous values between 0 and 1, and then the Gurobi linear solver is used to solve the relaxed optimization problem to obtain the optimal fractional solution All are initialized to 0. According to the probability distribution, all have the possibility of corresponding occurrences. Next, these events are simulated through multiple random iterations, and the results of each iteration are calculated. This process is repeated continuously until a feasible solution that satisfies all the constraints is finally obtained Once we finally obtain a feasible solution that satisfies all the constraints, we will preheat the corresponding function containers according to this result. The purpose of preheating is to reduce the cold start time and improve the response speed of the system.
[0073] Step 4: The situation considered in the algorithm of Step 3 is that only one request can be arranged at a time, but in real life, requests arrive at any time in multiple random sequences. Based on the algorithm of Step 3, an online preheating and function scheduling algorithm is designed to handle the situation of multiple online arrivals (as Figure 2 shown).
[0074] Step 401: Based on the algorithm of Step 3, we can calculate the duration of a function in its potential execution path and combine it with the probability of each path being selected to obtain the weight of the function. Assume that the function f v may belong to multiple paths λ k , obtain the set of all possible paths containing this function First, calculate the execution time of the function f v on a specific path λ k and multiply it by the probability p k of this path. Then, sum up these probabilities and the corresponding path execution times among all the potential paths of the function to obtain the weight of the function. Let represent the weight of the function f v , which is defined as follows:
[0075]
[0076] Step 402: We will adjust the preheating process of the container in two stages. The entire time span is divided into multiple fixed time slices. The first stage is to use the x calculated in Step 3 to preheat the container before the start of each time slice. v,i Let s v,i be the number of containers preheated for the function f i on the edge server m v . At this moment, the remaining memory capacity of the server is
[0077]
[0078] The second stage is at the beginning of each time slice. The edge server m i may need to preheat a new container for the function f v . We define y v,i = 1 to indicate that in the current request, a new container is preheated for f v on the edge server m i . The decision-making process (y v,i = 1) will be introduced in the next step. Let q v,i represent the total number of newly preheated containers. Then the remaining resources of the edge server are
[0079]
[0080] At the end of the current time slice, reset q v,i = 0.
[0081] Step 403: The online preheating and function scheduling algorithm efficiently schedules incoming requests by maintaining them in a topologically sorted queue, ensuring that each function is processed in order. It dynamically updates function priorities and server assignments to optimize resource allocation and handle completed functions. First, initialize the request queue and candidate set as empty. When a new request arrives, generate a scheduling list for it in topological order and add it to the queue. Subsequently, extract the function that needs to be scheduled currently from the queue, update the candidate set, and select the function with the highest priority according to the weight sorting and assign it to the best edge server. The scheduled function is removed from the corresponding scheduling list. When the scheduling list is empty, delete the request from the queue. This process is executed in a loop until all requests are processed, ensuring that functions are efficiently scheduled in order and resources are reasonably allocated.
[0082] Step 404: Next, discuss how to determine the best edge server for a function. First, define the concept of the earliest start time (EST), which must be greater than the earliest finish time (EFT) of the previous function in the same request. This ensures that the current function can only start execution after the previous function has completed and the necessary data has been transmitted, that is:
[0083]
[0084] Among them, EST(τ a , f v , m i ) represents the earliest start time of function f in request τ a on edge server m v . EFT(τ i , f a , m u ) represents the earliest completion time of function f in request τ j on edge server m a . u j a It must also be greater than the earliest start time of the same function from different requests on the same edge server, which ensures that functions from multiple requests do not overlap on the same edge server:
[0085]
[0086] EST(τ a , f v , m i ) ≥ min(FET(τ b , f v , m i )) (4)
[0087] Among them, EFT(τ b , f v , m i ) represents the earliest completion time of function f in request τ b on edge server m v . i v
[0088] In addition, it must be greater than the time required to directly start a container. Define Avail(f v , m i ) as the time when edge server m i has sufficient time to warm up function f v , which ensures that the function has been warmed up or cold-started the container before execution,
[0089] 3) On the same edge server where the previous function was executed:
[0090]
[0091] Among them, Avail(f v , m i ) represents the time when edge server m i can warm up function f v .
[0092] 4) On different edge servers where the previous function has not been executed:
[0093]
[0094] The earliest completion time of the function is calculated as follows:
[0095]
[0096] EFT(τ a , f v , m i ) represents the earliest completion time of function f a in request τ v on edge server m i . Denote the processing time of function f v on edge server m i when the execution path is λ k .
[0097] Based on the above, the earliest start time of the function is
[0098] EST(τ a , f v , m i ) ≥ min([3], [4], [5], [6]).
[0099] Experimental configuration:
[0100] The experiment was conducted in a cluster consisting of six edge servers, using the Kubernetes and OpenFaaS frameworks. In practical applications, the cold start time and execution time of the same function on different servers will vary. Therefore, the memory resources of the edge servers were set to different value ranges (0.5 to 3 GB), and the data transfer rate between servers was set to 10 Gbps.
[0101] The experimental application selected the social network application (SocialNetwork) from the DeathStar benchmark suite. For this application, three scales of DAGs (small, medium, and large) were set up, containing 11 functions and 7 paths, 15 functions and 14 paths, and 18 functions and 21 paths respectively. Based on the actual execution information, historical data such as the execution time, cold start time, function utilization rate, and call probability of each function were collected, and these data were preprocessed for experimental modeling.
[0102] Experimental comparison:
[0103] As shown in Figure 3, in the offline experiment, each request only executes one path in the DAG to better observe the overall performance of different algorithms. The evaluation is carried out by measuring the average completion time of each request under different numbers of requests. Figure 2 It shows that when the number of requests is 20, 40, 60, and 80, a search algorithm based on random rounding (EBRO) of the present invention is superior to the baseline algorithm in terms of both cold start and warm start delays of container startup. Figure 3a It further shows the average execution time, cold start time, data transfer time, and function execution time of each request. The results show that EBRO significantly reduces these times, with an average reduction of 63.1%, 61.1%, and 62.7%, and the maximum reduction in request completion time reaches 78.4%, and the maximum reduction in cold start time reaches 88.5%. Figure 3b It shows the average cold start probability of each function under different numbers of requests. The results show that EBRO has the lowest cold start probability, ranging from 5.1% to 13.9%, while the cold start probability of the baseline algorithm ranges from 32.1% to 61.7%.
[0104] As shown in Figure 4, the online algorithm is designed to process requests that arrive sequentially and need to be processed in parallel within a short time. We evaluate the algorithm performance by testing the arrival of different numbers of requests within a short time. Figure 4a It shows the total completion time of all tasks, defined as the time from the arrival of the first request to the completion of the last task. From the results, an online warm-up and function scheduling algorithm (OPTS) of this article always performs the best, saving 21.6% of the time compared with the comparison algorithm Fixed and 25.2% of the time compared with the comparison algorithm FCFS. Figure 4b It shows the total cold start time of all requests. The results clearly show that the cold start time of OPTS is significantly lower than that of the baseline algorithm, and the cold start time is reduced by 76.9% and 80.1% on average compared with Fixed and FCFS, respectively.
[0105] The present invention can also have many other implementation manners. Without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and deformations according to the present invention, and these corresponding changes and deformations should all fall within the protection scope of the appended claims of the present invention.
Claims
1. A method for online deployment of edge dynamic DAG serverless functions to achieve rapid startup, characterized in that: The method comprises the following steps: Step 1: Abstract the serverless application into a directed acyclic graph (DAG), calculate the path selection probability by analyzing the calling probability of the function on the execution path, calculate and smooth the function calling probability using historical data and the EWMA method to improve the prediction accuracy and stability, and determine whether preheating is required based on the function calling probability. When the probability exceeds the threshold, it is marked as requiring preheating, otherwise no preheating is required; Step 2: By constructing a quadratic integer programming model, the goal is to minimize the expected execution time of the entire function. The model uses the historical call data in step 1 to predict possible future calls and reasonably allocates preheating and computing resources on the edge server, thereby reducing cold start delays and resource waste. The constraints ensure that the execution path probability of the task meets the requirements, the resource usage of each edge server does not exceed the available capacity, and the data transmission, processing order, preheating and execution time of the function meet the actual execution conditions. Through these constraints, the model can efficiently allocate edge computing resources and optimize the task scheduling process; Step 3: Based on step 2, by searching for the optimal integer solution that satisfies all constraints, the algorithm first linearizes the nonlinear constraints through slack variables, and uses solvers such as Gurobi to perform initial optimization on the problem to obtain a valid fractional solution. Then, a final solution that meets the integer requirements is generated through randomized search to ensure that the solution satisfies all constraints, and finally further improves the solution accuracy and optimizes the system response speed. Step 4. Based on step 3, an online preheating and function scheduling algorithm is designed. First, the importance of each function is evaluated according to the calculated continuous impact of each function in the potential execution path to optimize resource allocation. Then, before the start of the time slice, the preheating resources and priorities on the edge server are dynamically adjusted to ensure the effective allocation of function resources, and the preheating strategy is flexibly adjusted according to actual needs. Subsequently, all pending functions are sorted according to the request priority and dependency of the task, and the optimal computing resources are allocated to ensure that the task can be completed according to the optimal scheduling strategy, and no longer needed resources are dynamically released. Finally, by determining the earliest start time and earliest completion time of the function, the completion efficiency of the task is compared among the candidate edge nodes, and the transmission delay and resource status are comprehensively considered to select the optimal edge node to maximize the task execution efficiency and reduce resource waste, thereby optimizing the overall task scheduling in the edge computing environment.
2. According to claim 1, a method for online deployment of edge dynamic DAG serverless functions to achieve rapid startup, characterized in that: The modeling preparation for defining the dynamic DAG and function preheating in step 1 specifically includes the following steps: Step 101: define a serverless application as a directed acyclic graph (DAG), in which functions are divided into ordinary functions and dynamic functions. Ordinary functions are always called, while dynamic functions are called according to conditions. The DAG contains multiple execution paths, and the selection probability of each path is calculated by the calling probability of all functions on the path. Step 102: Calculate the historical call probability of each function within a specified observation period by analyzing historical data, and smooth the data fluctuations by normalization and EWMA method to improve the accuracy and stability of the historical call probability; Step 103: Determine whether the function needs to be preheated based on the historical call probability, and introduce a preheating probability threshold. When the EWMA probability of the function reaches the threshold, mark the function as needing preheating, otherwise it does not need preheating. The preheating strategy does not depend on the specific edge server, but directly determines whether the function itself needs to be preheated.
3. According to claim 1, a method for online deployment of edge dynamic DAG serverless functions to achieve rapid startup, characterized in that: In step 2, building a dynamic DAG model with preheating preparation and function scheduling specifically includes the following steps: Step 201: Build a system model, including edge server m i Set M = {m1,...,m l }, l represents the number of edge servers, R(m i ) represents the edge server m i storage resources, G = (F, E, P) represents a DAG graph, where F = {f1, ..., f n } represents the functions f arranged in topological order v set, n represents the number of functions, r v,i Represents the function f v On the edge i The memory resources required for execution. The functions here are divided into dynamic functions f d and the ordinary function f r , E represents the set of functional dependencies, e u,v Represents the function f v Dependency function f u , the set P = {ρ1,...,ρ n } represents the probability of a function being called, G(λ) represents the set of paths in DAG, λ k is a path on the DAG, p k is the path λ k The execution probability, g k is the path λ k The number of functions, p k The calculation formula is Decision variable x v,i Represents the function f v On the edge i Is it a cold start or a hot start, the decision variable Represents the path λ k The function f v Whether to schedule to edge m i superior, The communication time required to transmit data from the previous function to the next function is expressed as where c i,j Indicates that from the edge server m i to m j Communication time to transmit one unit of data, d u,v Represents the function f u Transfer to function f v data, Represents the path λ k The function f v Whether to schedule to edge m i superior, Represents the path λ k The function f v Whether to schedule to edge m j superior, Function processing time can be expressed as where x v,i Represents the function f v On the edge i Is it a cold start or a hot start? Represents the function f v On the edge i Cold start time on Represents the function f v On the edge i When a function is executed on a container, if it is a preheated container and the function is hot-started when it arrives, only the execution time needs to be calculated. If it is not a preheated container, the cold start time of the container needs to be added. The dependency relationship between functions can be expressed as in Represents the path λ k The upper function f v The end execution time, Represents the path λ k The upper function f v The start time of execution, The calculation formula is Establish a quadratic integer programming mathematical model, subject to: The mechanism aims to minimize the overall expected execution time through preheating and function deployment. Specifically, through the historical call data in step 1, the functions that may be called in the near future are predicted, and their containers are preheated on the edge servers to reduce the cold start delay. Then step 2 deploys them according to the calling frequency and resource requirements of the functions to ensure the effective utilization of computing resources. Constraint (1a) ensures that the function requirements on all possible execution paths are met. Constraint (1b) ensures that the resource usage on each edge server does not exceed its available resources. Constraints (1c) and (1d) ensure that the task execution order depends on the same path. Constraints (1e) and (1f) specify the range of the above variables.
4. According to claim 1, a method for online deployment of edge dynamic DAG serverless functions to achieve rapid startup, characterized in that: Step 3 transforms the original problem into a convex optimization problem and proposes a search algorithm based on random rounding. The specific steps include the following: Step 301: The specific optimization goal is to minimize the sum of cold start time and execution time, and to solve the optimal allocation solution under various constraints of warm-up resources and task execution. After optimization, the problem becomes: subject to: Problem (2) is a convex optimization problem, where constraint (2c) corresponds to (1c), and constraint (2d) corresponds to constraint (1d); the remaining constraints remain unchanged, Step 302: A search algorithm based on random rounding is proposed to solve the problem proposed in step 301. The core of the algorithm is to use a random method to gradually search for the optimal integer solution that satisfies all constraints. First, the relaxation variable The solution is a continuous value (between 0 and 1). Gurobi is used to solve the relaxed optimization problem to obtain the initial fractional solution. Then, the solution is approximated to an integer solution that satisfies all constraints through probability and multiple random iterations. Finally, the solution result is used to preheat the corresponding function container to reduce the cold start time and improve the system response speed.
5. According to claim 1, a method for online deployment of edge dynamic DAG serverless functions to achieve rapid startup, characterized in that: The online preheating and function scheduling algorithm described in step 4 specifically includes the following steps: Step 401: Based on the calculation in step 3, the duration of each function in all potential execution paths is evaluated, and the weight of each function is calculated in combination with the path probability. The importance of preheating the function in the path is determined by these weights, so as to give priority to resource allocation to functions with high weights; Step 402: The preheating is completed in two stages. Before the time slice starts, the function container that needs to be preheated is determined according to the calculation result of step 3 and allocated to the edge server, and the memory resource usage of the server is updated at the same time. During the operation of the time slice, the newly added preheating container on the edge server is dynamically adjusted, and the usage is reset at the end of the time slice. Step 403: All requests are maintained in a queue and sorted according to the priority of preheating and function scheduling. When the requests are processed in order, function priorities and resources are dynamically allocated to ensure the optimal function scheduling strategy. At the same time, completed tasks are removed to achieve dynamic scheduling of online requests. Step 404: In order to select the optimal node, it is first necessary to determine the earliest start time (EST) of the function, which depends on the completion time of the predecessor task on its node and the time required to transmit the task data to the target node. At the same time, it is also necessary to ensure that the selected edge node will not have resource conflicts with other tasks. The resource status of the edge node is an important factor in determining whether the function can be started in time. When the resources need to be cold-started, the start time of the function must be postponed until the cold start process is completed. When the node meets the above conditions, the earliest completion time (EFT) of the function is calculated by its start time and processing time. Finally, by comparing the earliest completion time of the task among all candidate edge nodes, the node that can complete the task earliest is selected to ensure that the optimal edge node is found under the premise of considering task dependencies, data transmission and resource constraints.
6. A method for online deployment of edge dynamic DAG serverless functions to achieve rapid startup according to claim 5, characterized in that: In step 401, it is assumed that function f v Belong to multiple paths λ k , get a set of all possible paths that contain the function First, calculate the function f v In a specific path λ k The execution time on the path is calculated by multiplying it by the probability p of the path. k , and then summarize these probabilities and corresponding path execution times in all potential paths of the function to obtain the weight of the function. Let Represents the function f v The weight of is defined as follows: Step 402: The preheating process of the container is adjusted in two stages. The entire time span is divided into multiple fixed time slices. The first stage is to use the x calculated in step 3 before the start of each time slice. v,i To preheat the container, set s v,i For all requests on edge server m i The above is the function f v The number of preheated containers. At this moment, the remaining memory capacity of the server is R ′ (m i )for The second stage is at the beginning of each time slice, the edge server m i Need to be function f v Preheat a new container and define y v,i =1 means in the current request, it is f v On the edge server i Preheating a new container, the decision process (y v,i =1) will be introduced in the next step, let q v,i represents the total number of newly preheated containers, then the remaining resources of the edge server are At the end of the current time slice, reset q v,i =0, Step 403, the online warm-up and function scheduling algorithm efficiently schedules the incoming requests by maintaining them in a topologically sorted queue to ensure that each function is processed in order. It dynamically updates the function priority and server allocation to optimize resource allocation and process completed functions. First, the request queue and candidate set are initialized to be empty. When a new request arrives, a scheduling list is generated for it in topological order and added to the queue. Subsequently, the function currently required to be scheduled is extracted from the queue, the candidate set is updated, and the function with the highest priority is selected according to the weight sorting and assigned to the best edge server. The scheduled function is removed from the corresponding scheduling list. When the scheduling list is empty, the request is deleted from the queue. The process is executed in a loop until all request processing is completed, ensuring that functions are efficiently scheduled in order and resources are reasonably allocated. Step 404: Next, we discuss how to determine the best edge server for a function. First, we define the concept of the earliest start time (EST), which must be greater than the earliest finish time (EFT) of the previous function in the same request. This ensures that the current function can only be started after the previous function is completed and the necessary data has been transmitted, that is: Where EST(τ a ,f v ,m i ) represents the request τ a The function f v On the edge server i The earliest starting time, EFT(τ a ,f u ,m j ) represents the request τ a The function f u On the edge server j The earliest completion time, It must also be greater than the earliest start time of the same function from different requests on the same edge server, which ensures that functions from multiple requests do not overlap on the same edge server: EST(τ a ,f v ,m i )≥min(EFT(τ b ,f v ,m i ))(4) Where EFT(τ b ,f v ,m i ) represents the request τ b The function f v On the edge server i The earliest completion time, In addition, it must be greater than the time required to directly start a container, defining Avail(f v ,m i ) is the edge server m i With sufficient warm-up function f v This ensures that the container is pre-warmed or cold-started before the function is executed. 1) On the same edge server where the previous function was executed: Where Avail(f v ,m i ) represents the edge server m i Function f that can be preheated v time, 2) On a different edge server where the previous function was not executed: The earliest completion time of a function is calculated as follows: EFT(τ a ,f v ,m i ) represents the request τ a The function f v On the edge server i The earliest completion time, Represents the function f v On the edge server i Execution Path λ k The processing time is Based on the above, the earliest start time of the function is IS(τ a ,f v ,m i )≥min([3],[4],[5],[6])。 7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements a method for online deployment of edge dynamic DAG serverless functions to achieve rapid startup as described in any one of claims 1 to 6 above.
8. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by the processor, the steps of a method for online deployment of edge dynamic DAG serverless functions to achieve rapid startup are implemented as described in any one of claims 1-6.
Citation Information
Patent Citations
Task unloading method for intelligent workflow application in edge computing environment
CN114661466A
Robust task deployment method and system for server-free edge computing
CN117675610A
Cold start optimization method, system and equipment for non-inductive framework of server and medium
CN117931316A
Autonomous concurrency for serverless functions
US11614982B1
Cited By
Server-free function workflow scheduling method, medium and device
CN121166319A
A serverless function workflow scheduling method, medium, device
CN121166319B
Cloud function calling method, first platform, storage medium and computer program product
CN121901000A
Cloud function calling method, first platform, storage medium and computer program product
CN121901000B